Build it step by step
0 of 6 doneWire one module
Connect the first module to the Nano and test it with the LedControl example.
Add the chain
Link DOUT to DIN for each next module and share CLK and CS.
Check the order
Light device 0 only and see which module it is.
Show different data
Run the sketch and see counting, text, a heart and an arrow.
Look at the bus
If you have a logic analyser, see four 16-bit words per update on DIN.
Change the order
Swap device numbers if the displays appear reversed.
How do you build an SPI daisy chain of displays?
Chain four MAX7219 displays on one SPI bus and send different text to each. You need Arduino Nano, 8-digit 7-segment module (MAX7219) × 2, MAX7219 8x8 LED matrix module × 2 and 5 V 2 A USB adapter. It takes 6 steps and about 60 minutes.
- Level
- Beginner
- Time
- About 60 min
- Parts
- 4
Parts list
- Development BoardsBuyArduino Nano × 1
- DisplaysBuy
- DisplaysBuy
- PowerBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Nano D11 | First module DIN | Data |
| Nano D13 | First module CLK, and all other CLK pins | Clock to every module |
| Nano D10 | First module CS, and all other CS pins | Load to every module |
| First module DOUT | Second module DIN | Chain |
| Second module DOUT | Third module DIN | Chain |
| Third module DOUT | Fourth module DIN | Chain |
| 5 V adapter + and - | VCC and GND of every module and Nano GND | Shared power |
Code
Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "LedControl" by Eberhard Fahle. All four modules share CLK and CS and pass data on through DOUT to the next DIN. Each update shifts out one 16-bit command per module before CS is raised, and the library does this for you. The modules draw about 0.3 A each at full brightness, so run them from the 5 V adapter at low intensity and keep the Nano's ground joined to the adapter's ground. Use the matrix modules with a common arrangement (check the DIN side).
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <LedControl.h>
LedControl lc = LedControl(11, 13, 10, 4); // DIN, CLK, CS, number of devices
// Device 0 is the one wired to the Nano. If the order looks reversed, swap the device numbers below.
const byte HEART[8] = { 0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C, 0x18 };
const byte ARROW[8] = { 0x08, 0x0C, 0xFE, 0xFF, 0xFE, 0x0C, 0x08, 0x00 };
void setup() {
for (byte d = 0; d < 4; d++) {
lc.shutdown(d, false);
lc.setIntensity(d, 3); // low brightness keeps current down
lc.clearDisplay(d);
}
for (byte r = 0; r < 8; r++) { lc.setRow(2, r, HEART[r]); lc.setRow(3, r, ARROW[r]); } // the two matrices
}
void loop() {
static unsigned long n = 0;
unsigned long v = n++;
for (byte i = 0; i < 8; i++) { lc.setDigit(0, i, v % 10, false); v /= 10; } // first display counts up
for (byte i = 0; i < 8; i++) lc.setChar(1, i, "HELP- -"[7 - i], false); // second display shows text
delay(100);
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Power on | Counter on the first display, text on the second |
| Matrices | Heart and arrow shown |
| Brightness | Even and not too bright |
| Unplug the last module | The others still work |
If it does not work
Only the first module works
Check DOUT to DIN links on the later ones.
Displays reversed
Swap the device numbers in the code.
Dim or flickers
Use the 5 V adapter, not the Nano pin.
Garbled characters
Check that CLK and CS go to every module.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the SPI daisy chain of displays?
Arduino Nano, 8-digit 7-segment module (MAX7219) × 2, MAX7219 8x8 LED matrix module × 2 and 5 V 2 A USB adapter.
How long does the SPI daisy chain of displays take to build?
About 60 minutes for a beginner maker, in 6 steps.
How do I know the SPI daisy chain of displays works?
Power on: Counter on the first display, text on the second. Matrices: Heart and arrow shown. Brightness: Even and not too bright.
Only the first module works: what should I check?
Check DOUT to DIN links on the later ones.
Displays reversed: what should I check?
Swap the device numbers in the code.
Dim or flickers: what should I check?
Use the 5 V adapter, not the Nano pin.
Garbled characters: what should I check?
Check that CLK and CS go to every module.
