Fork me on GitHub

Project Notes

#101 8x8 LED Matrix Raw Drive

Drive an 8x8 LED Matrix with a MAX7219 chip and raw SPI commands.

The Build


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

Kit Parts

PCB Front

PCB Back

Kit Completed

Module Connection

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.

Connection Arduino Pin
CS 10

Example Code

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!



The Schematic

Credits and References

Project Source on GitHub Project Gallery Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is just my personal collection of projects. Two main themes have emerged in recent years, sometimes combined:

  • electronics - usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting
  • scale modelling - I caught the bug after deciding to build a Harrier during covid to demonstrate an electronic jet engine simulation. Let the fun begin..
To be honest, I haven't quite figured out if these two interests belong in the same GitHub repo or not. But for now - they are all here!

Projects are often inspired by things found wild on the net, or ideas from the many great electronics and scale modelling podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know (or send a PR!). See the individual projects for credits where due.