#101 8x8 LED Matrix Raw Drive
Drive an 8x8 LED Matrix with a MAX7219 chip and raw SPI commands.
This is a first test of an 8x8 LED module kit from a seller on aliexpress. This is a pretty common device available from many sources, either as prefab module or parts kit.
The kit includes a “1088AS” 8x8 LED module, which is single colour (red) with row pins cathode and column pins anode.
Although it is possible to drive an LED matrix directly, it quickly becomes wasteful of GPIO pins. This kit minimises the pins required by including a MAX7219 Serial-Interfaced LED Display Driver chip. The microcontroller the just needs 3 pins to drive the MAX7219 using and SPI protocol.
There are libraries available to talk to the MAX7219, such as the LedControl library. However this project uses raw SPI just for the sake of developing some familiarity with the operation of the MAX7219. See the LedControlDemo project for a test driving with the LedControl library.
Module Kit Construction
The LED module is connected to the Arduino with three pins as follows (in addition to +5V power and ground). The actual Arduino pin used is not significant, although in this example I have used the conventional SPI pins.
Turns out that talking to the array via the MAX7219 is pretty simple! We just shift out a 16-bit command which is latched on the rising edge of the CS clock select pin. Each 16 bits comprises an 8-bit register address and 8 bits of data, which is well described in the datasheet.
See code in the MaxRawDemo.ino sketch demonostrates the bare minimum required to start writing to the display. Next up, I guess I need to get it to display something interesting!