MAX7219 driver for LED Matrix 8×8

UPDATE 2022: The MAX7219LED8x8 library, now renamed to MAX7219tiny has now a new home at tinusaur.com/libraries/max7219tiny. Check also this MAX7219 & ATtiny85 tutorial to learn how the library works.

MAX7219LED8x8 is a C library for working with the MAX7219 display driver to control 8×8 LED matrix. It is intended to be used with the Tinusaur board but should also work with any other board based on Atmel ATtiny85 or similar microcontroller.

MAX7219 with LED matrix 8x8

The MAX7219 is manufactured by Maxim Integrated is compact, serial input display driver that could interface microcontrollers to 64 individual LEDs such as 8×8 LED matrix. Only one external resistor is required to set the segment current for all LEDs.

MAX7219 Timing Diagram

To put that in simpler words – with the MAX7219 driver it is possible to control 8×8 LED matrix using just 2 wires serial interface – one for the sync clock and one for the data. There is another wire that could be used to enable/disable the communication with the chip. The maximum frequency for the serial interface is 10MHz.

The LED matrix 8×8 is connected almost diretcly to the MAX7219 driver – only few external components are required.

Working with MAX7219 is very simple – turning on and off individual LEDs is done by sending 2-bytes command to the driver containing the row and the byte which bits define which LED value to set.

There are also few other command that are needed during the initialization process.

The library supports short buffer – only 8 bytes in size – to keep the values before sending them to the driver.

MAX7219LED8x8 is written in plain C and does not require any additional libraries to function except those that come with the WinAVR SDK. Check our WinAVR Setup Guide.

Using it is very simple …

    MAX7219_init();
    MAX7219_buffer_set(2, 3); // Set pixel
    MAX7219_buffer_clr(4, 5); // Clear pixel
    MAX7219_buffer_out(); // Output the buffer

Please continue to MAX7219LED8x8 page to see full source code the rest of the article.

External Resources

The source code of the MAX7219LED8x8 library is available at https://bitbucket.org/tinusaur/max7219led8x8

MAX7219 specification and datasheet:

Leave a Comment