Wiring guide

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
Raspberry Pi Pico · MAX7219 LED matrixlive0.000 s 0.00x
Click to open it in the editor
The circuit itself, running on the simulator with the sketch below. Press what can be pressed; click anything else to open it in the editor.
Pin to pin

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 pinRaspberry Pi Pico pinWire colorWhy
VCCVBUS (5 V from USB)redThe MAX7219 runs from 4 to 5.5 V; the module is a 5 V part.
GNDGNDblueCommon ground.
DINGP10 (physical pin 14)greenData into the chip, clocked in one bit at a time.
CSGP11 (physical pin 15)amberChip select, also called LOAD: it latches the bits into the display.
CLKGP12 (physical pin 16)violetThe clock that moves each bit of DIN in.
Voltage

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 sketch

The working code for the Raspberry Pi Pico

Library: LedControl (LedControl.h). This is the sketch the circuit above runs.

MAX7219 matrix on Raspberry Pi Pico GP10 (physical pin 14), GP12 (physical pin 16), GP11 (physical pin 15)
#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);
}
Output

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 ready
Pitfalls

Common 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.