How to wire a MAX7219 LED matrix to a Raspberry Pi Pico
To wire a MAX7219 LED matrix to a Raspberry Pi Pico, connect VCC to VBUS (5 V from USB), GND to GND, DIN to GP10 (physical pin 14), CS to GP11 (physical pin 15) and CLK to GP12 (physical pin 16). The chip is a 5 V part and the Raspberry Pi Pico’s 3.3 V signals sit at the edge of what it reads as high: many modules still work, and a level shifter on DIN, CLK and CS makes it certain. The sketch below uses the LedControl (LedControl.h) library. It shows a heart on the 8x8 matrix and pulses its brightness.
- 3.3 V logic
- Library: LedControl.h
- 5 wires
MAX7219 LED matrix to Raspberry Pi Pico wiring table
Every wire in the circuit above, with the part’s pin names and the board’s own labels. The wire colors are the ones the circuit uses; on a real bench any colors work.
| MAX7219 LED matrix pin | Raspberry Pi Pico pin | Wire color | Why |
|---|---|---|---|
| VCC | VBUS (5 V from USB) | red | The MAX7219 runs from 4 to 5.5 V; the module is a 5 V part. |
| GND | GND | blue | Common ground. |
| DIN | GP10 (physical pin 14) | green | Data into the chip, clocked in one bit at a time. |
| CS | GP11 (physical pin 15) | amber | Chip select, also called LOAD: it latches the bits into the display. |
| CLK | GP12 (physical pin 16) | violet | The clock that moves each bit of DIN in. |
Power and logic levels for MAX7219 LED matrix and Raspberry Pi Pico
Logic level
The Raspberry Pi Pico’s GPIO pins are 3.3 V logic and are not 5 V tolerant. Nothing wired to a pin may go above 3.3 V.
Supply
The MAX7219 LED matrix takes 5 V from VBUS (5 V from USB). That is the Raspberry Pi Pico’s 5 V rail, so the part shares the current the board can supply.
This pair
The MAX7219 is a 5 V chip and reads a high as about 3.5 V at that supply, so the Raspberry Pi Pico’s 3.3 V signals are right at its edge. Many modules still work from 3.3 V logic, and a 74AHCT125 on DIN, CLK and CS makes it certain. The matrix at full brightness draws a few hundred milliamps, more than a USB pin should be asked for: keep the intensity down or use its own 5 V supply.
Pins to leave alone
The numbers in the code are GP numbers, not the physical pin numbers printed beside the header: GP15 is pin 20. GP23 to GP25 are used on the board itself, and GP25 is the LED.
The working code for the Raspberry Pi Pico
Library: LedControl (LedControl.h). This is the sketch the circuit above runs.
#include <LedControl.h>
const int DIN_PIN = 10; // GP10 (physical pin 14)
const int CLK_PIN = 12; // GP12 (physical pin 16)
const int CS_PIN = 11; // GP11 (physical pin 15)
LedControl lc = LedControl(DIN_PIN, CLK_PIN, CS_PIN, 1); // one 8x8 block
// A heart, one byte per row, top row first.
const byte HEART[8] = {
B00000000, B01100110, B11111111, B11111111,
B11111111, B01111110, B00111100, B00011000,
};
void setup() {
Serial.begin(115200);
lc.shutdown(0, false); // wake the chip up
lc.setIntensity(0, 4); // 0 to 15
lc.clearDisplay(0);
for (int row = 0; row < 8; row++) {
lc.setRow(0, row, HEART[row]);
}
Serial.println("Matrix ready");
}
void loop() {
lc.setIntensity(0, 2);
delay(500);
lc.setIntensity(0, 12);
delay(500);
}
What you should see
The matrix shows a heart whose brightness steps between dim and bright every half second. The serial monitor, at 115200 baud, prints Matrix ready once.
A dark matrix with power on means the chip is still in shutdown: the sketch must call shutdown(0, false) first.
The serial monitor prints this, recorded from the circuit above running:
Matrix readyCommon mistakes wiring a MAX7219 LED matrix to a Raspberry Pi Pico
Forgetting to wake the chip
The MAX7219 starts in shutdown mode with the display off. Without lc.shutdown(0, false) every row you write goes in and nothing lights.
Mixing up DIN and DOUT
DIN is the input end of the module. DOUT is the output to the next block in a chain. Wired to DOUT, the board talks to nothing.
Running the matrix at full brightness from USB
Sixty-four LEDs at intensity 15 draw several hundred milliamps. Keep the intensity low in code, or power the module from its own 5 V supply and join the grounds.
Build your own MAX7219 LED matrix project
Open this circuit in the editor, change the wiring or the code, and keep your version in a free account.