This is only a preview of the January 2024 issue of Silicon Chip. You can view 35 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Raspberry Pi Clock Radio, Pt1":
Items relevant to "WiFi Relay Modules":
Items relevant to "USB to PS/2 Keyboard Adaptors":
Items relevant to "Secure Remote Switch, Pt2":
Items relevant to "Multi-Channel Volume Control Part 2":
Purchase a printed copy of this issue for $12.50. |
Using Electronic Modules with Jim Rowe
4-digit, 14-segment
LED module
Instead of seven segments, this LED display
module has 14 segments per character, so
it can display letters, digits and even a few
symbols. It has a built-in I2C serial interface,
allowing popular microcontrollers like the Arduino Uno or Nano to drive it easily.
T
he module is about the same size
as a 4-digit, 7-segment display
at 50mm wide by 28mm high, with a
total thickness of a little over 10mm.
The two side-by-side dual-character
LED displays have 14 segments per
character, plus the usual decimal point
LED. This allows them to reasonably
display numerical digits, upper-case
letters, many lower-case letters and a
few symbols.
The module (available from Jaycar)
features an I2C serial interface that
allows easy connection to just about
any popular microcontroller unit
(MCU). We will now look more deeply
into the 14-segment LED displays, followed by the useful IC that drives them
and provides the I2C interface.
The 14-segment displays
Fig.1 shows how the dual character displays used in the module have
six of the seven segments used in the
familiar 7-segment displays; the outer
ones labelled ‘a’ to ‘f’.
Instead of the single central horizontal segment, there are eight inner segments: three in the upper half labelled
‘g’, ‘h’ and ‘j’, three in the lower half
labelled ‘l’, ‘m’ and ‘n’, and two in
the centre replacing the original single horizontal segment, labelled ‘p’
and ‘k’. This gives 14 segments in
each character, not counting the decimal point.
The LEDs in these segments are
connected in a common-cathode configuration, so each character (plus its
decimal point LED) has a single cathode pin.
The anodes are connected to the
anode of the corresponding segment of
the other character, eg, segment ‘1a’ to
segment ‘2a’ etc. That allows the segments of both displays to share pins,
as shown in the internal circuit, on the
right side of Fig.1.
So each dual-character display
needs only 17 connection pins: 15 for
the LED anodes and two for the cathodes. The displays have 18 physical
pins, but one (pin 3) is not used.
Two main suppliers of these dual
14-segment displays are Kingbright
(PDC54-11GWA) and Lite-On (LTP3784E). The characters are 13.8mm
(0.54in) high in both cases. These manufacturers also label the inner display
segments differently, but the pin connections are the same.
The displays used in this module
have segments that emit orange-yellow
light, but displays with other colours
are available.
Inside the HT16K33 IC
Now we can look into the IC used
to drive each pair of dual 14-segment displays in the module. This is
the HT16K33, made by Taiwan firm
Holtek Semiconductor Inc (www.
Fig.1: how the LEDs are
arranged in each of the
2-digit, 14-segment displays.
64
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
holtek.com/page/vg/HT16K33A),
which also provides the I2C interface.
Holtek makes a range of microcontrollers, some of which are used in popular home appliances and various other
ICs, including display drivers like the
HT16K33.
Holtek describes the HT16K33 as
a 16×8 LED Controller Driver with
RAM Mapping and an optional keypad scanning ability. It can be used
for driving virtually any matrix of up
to 16 × 8 LEDs, not just 14-segment
alphanumeric displays, as in this
module. It can also scan a matrix of
13 × 3 keys, although that feature is
not used here. It can be powered from
4.5-5.5V DC.
Fig.2 shows the basic block diagram of the HT16K33. The I2C interface controller is at lower left, with
an internal RC clock oscillator to its
right feeding a timing generator, and
two random-access memories (RAMs)
below them. The upper RAM is for the
display control data, with a capacity
of 16 × 8 bits, while the lower RAM
is for storing the key scanning data, if
that function is used.
On the right-hand side are the
two controller blocks. The upper
one provides eight outputs (COM0COM7) for control of the ‘common’
LED lines (in this case, the cathodes
of the 14-segment displays) and the
key scanning outputs. The COM0 output is also used to sense the desired
I 2C address for the HT16K33, as
explained shortly.
The lower controller block provides
16 outputs (ROW0-ROW15) for driving the rows of LEDs in a matrix or the
segments in the 14-segment displays.
It also provides inputs for sensing the
desired I2C address, plus inputs for the
key scanning function. The power-on
reset (POR) block at upper left resets
most of the other blocks when power
is first applied.
One of the functions of the HT16K33
not shown in Fig.2 is its ability to provide programmable 16-step dimming
of the LED outputs. That is achieved
by controlling the pulse width of the
ROW outputs, with a range from 1/16th
to 16/16th duty cycle. Another handy
feature!
Finally, the HT16K33 can be programmed to have any of eight different
I2C addresses, from 70h to 77h, using
three links on the circuit around the
chip. We will see how this is done in
the next section.
siliconchip.com.au
The rear of the
14-segment LED
module contains
just a few
components and
the HT16K33 IC.
The module’s I2C
address is set by
the three links
labelled A0-A2 on
the PCB.
Note that the HT16K33 IC is now
obsolete, but Holtek still sells the
HT16K33A, which is pretty similar.
The module circuit
As you can see from the circuit in
Fig.3, there’s not much in the module
apart from the HT16K33 device itself
(IC1) and the two dual 14-segment displays. Two pull-up resistors are connected between its SDA and SCL lines
and the VHI input, while the HT16K33
chip is powered from the VIO input
from CON1, with a 10μF capacitor
providing filtering.
5-pin SIL header CON1 is used to
make all the power and signal connections to the module.
Programming the module’s I 2 C
address is achieved using diode D1,
three resistors and three PCB links
A0-A2, shown above IC1 in Fig.3.
The anode of D1 is connected to the
COM0 output (pin 2) of IC1, while its
cathode connects to the three links via
three 10kW resistors. The other ends of
the links are connected to the ROW0,
ROW1 and ROW2 lines of IC1, which
are used as inputs when IC1 detects
the desired I2C address.
As shown in the small table at upper
right in Fig.3, when no links are connected (A0=A1=A2=0), the module
has an I2C address of 70h (h = hexadecimal). If only the A0 link is connected,
the address is changed to 71h; if only
the A1 link is connected, this changes
the address to 72h etc.
Fig.2: the block diagram for the HT16K33 IC which is used to drive both
14-segment displays.
Australia's electronics magazine
January 2024 65
An example of what the lowercase letters “qrst” and “abcd” look like on the
LED module. The letters ‘q’ and ‘a’ are some of the more strange choices.
This ability to set the module’s
I2C address to eight different values
means it is possible to connect up to
eight of the modules to the same I2C
port of an MCU. It also means that if
you have another device on your I2C
bus within the range of 70h to 77h,
you can program the 14-segment display to one of the unused addresses to
avoid a collision.
Connecting it to a micro
A nice feature of this module is that
its I2C interface makes it easy to connect to most MCUs. This is illustrated
in Fig.4, which shows how it can be
connected to an Arduino Uno. The
module’s VHI and VIO pins are both
connected to the Arduino’s +5V pin,
its GND pin to one of the Arduino’s
GND pins, its SDA pin to the Arduino’s A4/SDA pin and its SCL pin to
the Arduino’s A5/SCL pin.
Note that with R3 and later versions
of the Uno, the last two pins can be
connected to the SDA and SCL pins
at upper left on the Arduino, just to
the left of the AREF pin.
Connecting the module to an Arduino Nano is just as easy, as shown in
Fig.5. The connections are very similar
to those for the Uno in Fig.4.
The only other thing you need to do
to get the module to communicate with
an MCU is to change its I2C address
if necessary; it defaults to 70h when
none of the links on the rear of the
PCB are joined.
You should find it just as easy to connect the module to most other MCUs,
such as a Micromite, Maximite, Pico
Mite, WebMite and so on.
All that’s left then is to come up with
some suitable software to drive the display. For an Arduino, as usual, that
will involve finding a software library
designed to communicate with the
HT16K33 module, plus one or more
example Arduino sketches to show
how it’s done.
Arduino libraries
After looking around on the web
for Arduino libraries written to communicate with the HT16K33 module,
the best one I could find was from US
firm Adafruit, called Adafruit_LED_
Backpack. This one was listed on the
main Arduino Reference website but
was also available on GitHub:
• siliconchip.au/link/abpk
• https://github.com/adafruit/
Adafruit_LED_Backpack
However, to work with the
14-
segment displays used in this
module, two other libraries must be
installed: Adafruit-GFX-library and
Adafruit_BusIO_library, see:
• https://github.com/adafruit/
Adafruit-GFX-library
• https://github.com/adafruit/
Adafruit_BusIO
Fig.3: The full
circuit of the
4x14-segment
display
module. The
table at upper
right shows
how its I2C
address can be
set using the
PCB links A0,
A1 and A2.
66
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
Once the three Adafruit libraries
have been downloaded (as zip files)
and installed on your PC as part of
the Arduino IDE or installed via the
Library Manager, you will find a
“quadalphanum.ino” sketch in the
Examples folder. Verify and compile
this sketch, then upload it to the Arduino connected to the module, and you
should find the module’s displays will
spring to life.
First, it will show a stream of all the
characters it can display (this takes a
while). Then, if you have the IDE’s
Serial Monitor open, it will allow you
to type in any combination of four
characters you want and they will
be displayed immediately. You can
repeat this over and over.
While doing this, I took a few photos
to illustrate how the module’s displays
show many of the common alphabetic
characters. They should give you a
good idea of what can be achieved.
The upper-case characters are all
reasonably clear, but the lower-case
characters are less so. Some are pretty
unclear, like “p” and “q”, while some
of the symbols are very clear, such
as “+” and “-”. Unsurprisingly, the
numerals are also quite clear.
It was a little disappointing to find
nothing in the Adafruit libraries to
show how to control the light output of the module’s displays. However, if you read Holtek’s data sheet
on the HT16K33 (see siliconchip.au/
link/abpj), they provide quite a bit of
information on how the PWM dimming of the displays works and can
be achieved.
Editor’s note: some lower-case letters could be made clearer by modifying the libraries to change which
segments are used. To do this, edit the
entries in the “alphafonttable” array
within the “Adafruit_LEDBackpack.
cpp” file. Examples of shapes we
think would be more clear are shown
in Fig.6.
Figs.4 & 5: connecting the LED
module to an Arduino Uno (above)
or Nano (below) is simple. You just
need to connect the SDA & SCL
pins respectively to A4 & A5 on the
Arduino. VHI then goes to 5V on
the Arduino and is bridged to VIO,
while GND goes to GND.
Fig.6 (left): you can edit the library code
to output arguably better representations
of different letters. An example of what
segments could be enabled for the letters ‘p’
and ‘q’ are shown here.
Where you can get it
The module shown in the pictures
is currently available from Jaycar
(stock number XC3715) for $9.95. It
is also available from Core Electronics
(ADA2158) for $21.15 and from AdaFruit (ID 2158) for US$10.50.
Adafruit also has versions with different display colours, such as red
(1911) for US$9.95. They also sell blue
(1912), white (2157) or green (2160)
displays, each for US$13.95.
SC
siliconchip.com.au
Upper case vs lower case
We recently came across an interesting fact about where the terms “upper
case” (capital letters) and “lower case” (smaller letters) came from.
In early printing presses, the “moveable type” letters were kept in cases near
the press. As the smaller letters were used more often, they were kept in a box
(case) closer to the worker. The capital letters were in a case that was higher
and further away, above the other. Hence, “upper case” and “lower case” refer
to where the letters were found in those early presses!
Australia's electronics magazine
January 2024 67
|