-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Welcome to the LedMatrixSPI wiki!
An Arduino library for controlling multiple 8x8 LED displays in a matrix style format using the MAX7219/7221 display drivers. It does not support 7-segment displays.
The library was written after creating a 48x32 LED dot matrix, and using the LedControl library was simply not fast enough. Initially I wrote the LedMatrix library, which uses a software SPI implementation. It was significantly faster, but displays with more than 16 drivers started getting slow. This is because the MAX72XX IC use a cascading data protocol which means in order to update an led on a single display, all display in the grid must be updated too. So the more ICs you have, the slower the refresh rate becomes.
For example, updating a single row of leds on a single MAX72XX IC requires a 2-byte data packet. So to update all 8 rows requires 16 bytes. Say the MCU requires 5 clock cycles to send one bit of data, then 16 bytes takes 1,280 clock cycles (plus some overhead for code to send the data, but we'll stick with 80). Therefore, updating 16 displays takes 20,480 clock cycles. If the Arduino's SPI runs at 8MHz, sending 20,480 bits takes approx 1/400th of a second. So 16 displays has a refresh rate of about 400Hz. Essentially if you double the displays you halve the refresh rate.
The LedControl library only updates one row, on one IC, per data packet. So if you have 16 displays, it would send 16x the data. To update all 8 rows, it would require 128 packets (rather that just 8). Plus it uses a much slower method of sending data, taking 3-4x the clock cycles.
Note: I have no idea these numbers are accurate, but it gives you an idea of why it was necessary to write a faster library.
The LedMatrix and LedMatrixSPI libraries are identical except that this library requires you to use the Arduino's SPI pins, where the LedMatrix library allows you to specify the pins used.
NOTE: The library can handle up to 32 rows and 32 columns of 8x8 displays (1,024 8x8 displays or 256 x 256 leds); however, due to display buffering it's unlikely the MCU will have sufficient memory to support more than 180 8x8 displays.