This is only a preview of the July 2025 issue of Silicon Chip. You can view 37 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. Articles in this series:
Articles in this series:
Items relevant to "The SmartProbe":
Articles in this series:
Items relevant to "Hot Water System Solar Diverter, part two":
Items relevant to "Low-cost electronic modules: 8×16 LED Matrix module":
Items relevant to "SSB Shortwave Receiver, part 2":
Purchase a printed copy of this issue for $13.00. |
Using Electronic Modules with Tim Blythman
8×16 LED
Matrix
These LED matrix panels
are bright, compact and
easy to drive, although
there are a couple of tricks to them.
After looking at the driver IC, we’ll provide demonstration software
for Arduino and BASIC code for the Micromite and PicoMite.
T
his LED matrix module was the
display and the base on which
we mounted the components for our
Digital Spirit Level project from the
November 2024 issue (siliconchip.au/
Article/17021).
We used Jaycar’s Cat XC3746 (www.
jaycar.com.au/p/XC3746), although
other modules with the same controller are available elsewhere. Our software should work with any of these
modules as long as they use the same
AIP1640 control chip.
In the Digital Spirit Level article,
we noted that the Matrix has pins
labelled SDA and SCL. While you
might think it would thus use an I2C
interface, that is not the case. So we
thought it would be helpful to delve
into the AIP1640 driver chip and the
communications protocol that it uses.
That will allow us to create software
to control the chip.
There isn’t much more to the module than the chip and its LED matrix.
The AIP1640 IC
The Wuxi I-core Electronics
AIP1640 is the main driver IC on the
module. Fig.1 shows the circuit of the
module, where IC1 is the AIP1640. It
comes in a 28-pin SOIC (small outline IC) package and 24 of its pins
connect to a matrix of 128 blue LEDs,
with eight anode drivers and 16 cathode drivers. It has an internal 450kHz
oscillator to control the multiplexing
of the output drivers.
Such an arrangement would be wellsuited to driving 16 common-cathode
70
Silicon Chip
seven-segment displays too. The only
other components are the standard
100nF supply bypass capacitor and
two 10kW pull-up resistors on the communication lines.
Unlike the Matrix module, the data
sheet labels the communication pins
as DIN and SCLK, hinting at the divergence from I2C. The power, ground,
DIN and SCLK lines are wired to a
locking four-way receptacle; a matching plug with wires comes with the
module.
This makes it easy to wire up to a
development board like an Arduino
Uno, since all the functions are controlled from the communication interface. You can download the data sheet
for the AIP1640 controller IC from
siliconchip.au/link/ac3e
Control interface
The data sheet includes sample
communication waveforms. Fig.2
shows this, along with a single byte
transmission in the I2C protocol. You
can see that the AIP1640’s protocol
resembles I2C, but it is not identical.
The idle state appears to have both
DIN and SCLK at a high level, like SDA
and SCL in I2C. The text describes the
lines being set low and high, whereas
I2C would have the lines set low and
allowed to rise to a high level through
the action of the pull-up resistors. It
seems that the start, stop and bit clocking restrictions are much the same
as I2C, although the AIP1640 only
expects eight, not nine bits.
A START condition occurs when
Australia's electronics magazine
DIN (or SDA) goes low, while SCLK
(or SCL) is high. During data transmission, DIN can only change state
when SCLK is low, while the END (or
STOP) condition is when DIN rises
while SCLK is high.
The AIP1640 sends the least significant bit (LSB) of the byte first,
while I2C sends the most significant
bit (MSB) first. The AIP1640 protocol
denotes the first byte as a command,
while I2C starts its transmissions with
an address byte.
The protocols are similar enough
that an I2C transmission could possibly be used to control an AIP1640 controller, but it would probably not allow
other I2C devices to coexist on the
same bus, since the I2C addresses may
clash with the AIP1640 commands.
Indeed, the AIP1640 has no concept
of addressing, so only a single unit can
be connected to a bus. Note that the
data sheet does not make any claims
to I2C compatibility; any confusion
appears to originate from sample code
that has been posted online.
Now that we’ve established that the
protocol is not I2C, we can examine
how to communicate with the chip.
The data sheet explains that some
commands are followed by data bytes.
Each command must be preceded by
a START condition, so the first byte is
a command and subsequent bytes in a
transmission are data.
Table 1 shows the commands that
the AIP1640 responds to. Each command is typically sent between a
START and END condition, except the
siliconchip.com.au
Fig.1: 128 blue LEDs are driven in matrix fashion by 16 cathode drivers and eight anode drivers in the chip, with all
timing controlled internally. Only two resistors and one capacitor are needed in addition to the AIP1640 driver IC.
Fig.2: the protocol used by the AIP1640 has a lot of parallels with I2C, but since it does not implement an addressing
scheme, it will not work on an I2C bus.
Set Column command, which would
be followed by data that is sent to the
display RAM for output.
Like many such devices, a small
siliconchip.com.au
amount of internal RAM stores the
display data and the host controller
can choose where in RAM it writes to.
There are 16 bytes, corresponding to
Australia's electronics magazine
the GRID1 to GRID16 cathode drivers.
Each bit corresponds with one of the
SEG1-SEG8 anode drivers, with SEG1
being the LSB and SEG8 the MSB. You
July 2025 71
Column 15
Bit 7
Bit 0
Column 0
Fig.3: the pixels are mapped logically, meaning it is quite intuitive to program the display. There is a column auto-increment
setting, so writing text from left to right can be accomplished easily. The back of the PCB is as sparse, with just the control IC
in an SMD SOIC-28 package, a few passive components and a four-way socket to suit the provided plug with leads.
can see the mapping of this to LEDs
on the XC3746 in Fig.3.
A typical display driver might send
a couple of commands to set up an initial state, after which pixels are written as needed to achieve the desired
display and display updates are sent
as required. A command might update
part of the display, or it might make
use of the auto-increment function and
send entire screenfuls of data at a time.
Power supply
The AIP1640 data sheet specifies a
5V±10% supply voltage, with input
voltage thresholds of 30% for a low
input and 70% for a high input. We
performed some tests with our Coin
Cell Emulator from December 2023
(siliconchip.au/Article/16039) and
found that our Matrix worked perfectly
well down to around 2.8V for its supply and logic levels.
With a 5V supply, the peak current
draw with all pixels lit was around
140mA. There are eight PWM settings
and thus brightness levels. We found
that a setting of 1 or 2 (0b001 or 0b010)
was adequate for indoor viewing.
Level 1 draws around 20mA with all
pixels lit, while level 2 draws around
40mA. The data sheet notes the different settings and their corresponding
fractions of the maximum duty cycle.
Unlike some controllers (eg, for
some OLEDs and LCDs), there is no
hardware register to flip or rotate the
display. For the Digital Spirit Level,
we had to invert the pixels and columns in software to have the connector
at the bottom of the display. You can
contrast that with the layout shown in
Fig.3, with the connector at the top.
driven by calls to the digitalWrite()
function, which all Arduino boards
and platforms support. We expect
you could use any Arduino board,
although we have not tried any others ourselves.
Arduino connections
PicoMite connections
Wiring the XC3746 up to an Arduino
Uno or similar board is easy enough
since there are just four wires. We
have written the software to be able
to use any digital pins. Fig.4 shows
the wiring with the default Arduino
sketch settings; if you change the connections, you will need to change the
driven pins by modifying the XC3746_
CLK and XC3746_DAT #defines in the
library file.
The “matrix” sketch uses the same
library we created for the Digital Spirit
Level, which provides simple functions to initialise and write to the display, including a simple font containing the digits 0-9. To use the library in
your own project, simply copy it to the
sketch folder and add the #include
directive.
The sketch lights up all pixels,
switches them off, then shows a rising count of elapsed seconds on the
display.
We used an Arduino Uno in our
examples, but there are no special
hardware features or other libraries
needed, so other Arduinos could be
used, like the Leonardo. The pins are
We’re using the PicoMite as our
exemplar BASIC platform since it is
easy to distribute a UF2 firmware file
that contains the BASIC environment
and code.
The firmware files can be loaded
onto the PicoMite without any special hardware using its USB flash
drive bootloader (accessed by holding
the BOOTSEL button while powering
on the PicoMite). All that needs to be
done is to copy the MATRIX.UF2 file
to the RPI-RP2 virtual drive.
The BASIC code should work on
other MMBasic platforms, such as
the Micromites, and we have also
included it in the software download.
You can load this directly using the
AUTOSAVE or XMODEM commands.
Fig.5 shows our wiring to the Pico
Mite. We used the 3.3V supply to
ensure there are no problems with the
logic levels from the I/O pins differing from the supply voltage. The 3.3V
regulator on the Pico can source up to
800mA, so it will have no trouble powering the Matrix.
We did notice a lower brightness
compared to using a 5V supply, with
brightness level 2 drawing only 4mA
with all pixels lit. That’s about a factor
of 10 difference compared to a 5V supply. Still, it seemed to work OK, and
there is scope to increase the brightness if needed.
You can change the pins used
by modifying the CONST values of
XC3746_DAT_PIN and XC3746_CLK_
PIN in the code. The BASIC program works the much the same as the
Arduino sketch, although it uses the
Table 1 – AIP1640 commands
Command
Action
Notes
0b0100bc00
Configuration
If b=0, auto-increment column
otherwise fixed
If c=1, activate test mode
0b10000000
Turn off display
0b10001ddd
Turn on display and
set duty cycle
ddd is three-bit duty cycle
(brightness) setting
0b1100eeee
Set column
eeee is 0 (GRID1) to 15 (GRID16)
72
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
Fig.4: we used
the connections
here with our
example Arduino
sketch,
although
the data
and clock
pins can be
altered in the code
if necessary. The
XC3746 comes with
male jumper lead
ends that can be
plugged directly
into a board like
the Arduino Uno.
Fig.5: to interface
with a Pico (running
MMBasic), we used
the 3.3V supply to
ensure there was no
mismatch between the
supply voltage and I/O
pin logic levels. The
3.3V regulator on the
Pico can supply 800mA,
so it can easily drive the
display.
The XC3746
pack includes
the display
module and
a set of flying
jumper leads
equipped with
a plug, so it is
easy to wire
up. To connect
the Matrix
module to a
Pico, you can
solder socket
headers to its
pads or use a
breadboard.
The demo
software can
be downloaded
from
siliconchip.
com.au/
Shop/6/2756
internal PicoMite timer, so it might not
start counting from zero.
Note that the UF2 file will only work
with the original Pico and not the Pico
2. The BASIC code is compatible with
the Pico 2, but you’ll need to load the
latest version of MMBasic and then
the BASIC code yourself. If you see the
Pico’s LED flashing, that means BASIC
has been loaded correctly. So if the
Matrix is not working, but the Pico’s
LED is flashing, check your wiring.
Conclusion
These LED Matrix displays are simple enough to control, although you
might get tripped up if you try to use
example code that works with I2C,
since the interface is not the same.
They are great for small numerical
displays, as we have demonstrated.
Despite what the data sheet says,
our units seemed to operate happily
on 3.3V (which bodes well for many
modern microcontrollers). However, if
you want maximum brightness, a 5V
supply is the way to go; you may need
a level shifter if your microcontroller
has 3.3V I/Os. Perhaps the reason for
the specified narrow voltage range is
to provide a degree of uniformity to
the brightness.
With 128 pixels, these Matrix modules can display simple graphics or
other patterns. Jaycar sells the XC3746
Duinotech Arduino Compatible 8×16
LED Matrix Display for AU$19.95. SC
siliconchip.com.au
Australia's electronics magazine
July 2025 73
|