Pico LED matrix scrolling sign
Build it step by step
0 of 6 doneWire the matrix
VCC to VBUS, GND to GND, DIN to GP3, CLK to GP2, CS to GP5.
Wire the button
GP14 to GND.
Paste the program
Into Thonny.
Run it
HELLO scrolls across the matrix.
Press the button
The next message starts.
Save as main.py
So it runs when you plug in the Pico.
How do you build a pico LED matrix scrolling sign?
A Pico drives a MAX7219 8x8 LED matrix over SPI and scrolls a short message, with a button to change the message. You need Raspberry Pi Pico H, MAX7219 8x8 LED matrix module, Tactile push button 6 mm and Breadboard 830 Tie Points. It takes 6 steps and about 120 minutes.
- Level
- Beginner
- Time
- About 120 min
- Parts
- 4
Parts list
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| MAX7219 VCC | Pico VBUS pin 40 | 5 V from USB |
| MAX7219 GND | Pico GND pin 38 | Common ground |
| MAX7219 DIN | Pico GP3 pin 5 | SPI data out |
| MAX7219 CLK | Pico GP2 pin 4 | SPI clock |
| MAX7219 CS | Pico GP5 pin 7 | Chip select |
| Message button | Pico GP14 pin 19 and GND | Changes the message |
Code
The MAX7219 is a chip that scans an 8 by 8 grid of LEDs for you. You write one byte per row over SPI, which is three wires plus a chip-select line, and the chip keeps the LEDs lit and refreshed without more help from the Pico. This program sets the chip up with a few register writes: wake from shutdown, no digit decoding, scan all eight rows and set a low brightness so the display does not draw much current. It then uses MicroPython's framebuf, a ready-made drawing buffer, to draw text eight pixels wide per letter into an 8 by 8 image and sends the eight rows to the chip. Moving the text one pixel to the left each time makes it scroll. The module is meant for 5 V power; the Pico's 3.3 V signals normally drive it fine, but if the display flickers, try shorter wires or a level shifter. If the letters come out sideways or mirrored, that is only how your module's matrix is wired, so adjust how you draw into the buffer.
import time
import framebuf
from machine import Pin, SPI
spi = SPI(0, baudrate=1000000, polarity=0, phase=0, sck=Pin(2), mosi=Pin(3))
cs = Pin(5, Pin.OUT, value=1)
button = Pin(14, Pin.IN, Pin.PULL_UP)
def send(reg, data):
cs(0)
spi.write(bytes([reg, data]))
cs(1)
for reg, val in ((0x0C, 0), (0x09, 0), (0x0B, 7), (0x0A, 3), (0x0F, 0), (0x0C, 1)):
send(reg, val) # shutdown off, no decode, 8 rows, low brightness
for row in range(1, 9):
send(row, 0)
buf = bytearray(8)
fb = framebuf.FrameBuffer(buf, 8, 8, framebuf.MONO_HLSB)
def show():
for row in range(8):
send(row + 1, buf[row])
messages = ["HELLO", "ELECTROLARK", "PICO", "MAKE IT"]
index = 0
x = 8
prev = 1
while True:
text = messages[index]
fb.fill(0)
fb.text(text, x, 0, 1)
show()
x -= 1
if x < -8 * len(text):
x = 8 # start the message again
b = button.value()
if prev == 1 and b == 0:
index = (index + 1) % len(messages)
x = 8
time.sleep_ms(40)
prev = b
time.sleep_ms(80)Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Run | Text scrolls from right to left |
| Press the button | A new message begins from the right |
| Reach the end of a message | It starts again |
| Brightness | Comfortable, not harsh |
| Unplug and plug in | The sign starts by itself |
If it does not work
Blank display
Check VCC is on VBUS and the three signal wires are on the right pins.
Letters sideways or mirrored
Your module is wired differently; draw the text into the buffer rotated, or flip the rows when you send them.
Garbled lights
Shorten the signal wires and lower the SPI baudrate.
All LEDs lit
The display test register is on; check the setup lines ran.
Too bright or too dim
Change the 3 in the intensity setting, 0 to 15.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the pico LED matrix scrolling sign?
Raspberry Pi Pico H, MAX7219 8x8 LED matrix module, Tactile push button 6 mm and Breadboard 830 Tie Points.
How long does the pico LED matrix scrolling sign take to build?
About 120 minutes for a beginner maker, in 6 steps.
How do I know the pico LED matrix scrolling sign works?
Run: Text scrolls from right to left. Press the button: A new message begins from the right. Reach the end of a message: It starts again.
Blank display: what should I check?
Check VCC is on VBUS and the three signal wires are on the right pins.
Letters sideways or mirrored: what should I check?
Your module is wired differently; draw the text into the buffer rotated, or flip the rows when you send them.
Garbled lights: what should I check?
Shorten the signal wires and lower the SPI baudrate.
All LEDs lit: what should I check?
The display test register is on; check the setup lines ran.
