Ribbon cables and their corresponding headers are sometimes a topological puzzle. Here’s a trick to help keep track…
If you hold the ribbon cable flat — no folds — and with both connectors facing you, keys pointed the same direction — now there is a 1:1 correlation between the pins. The top-right pin on one plug links to the top-right on the other plug, and so forth. This holds true even if the cable has a doubled-over strain relief. As long as the keys point the same way and the plugs face the same way, pins are in the same positions at both ends.
Plugged into a socket on the LED matrix, one header now faces away from you. If you double the cable back on itself (not a twist, but a fold)…to access a specific pin on the socket, the left and right columns are now mirrored (rows are in the same order — the red stripe provides a point of reference). You’re looking “up” into the plug rather than “down” into the socket.
For example, R1 (the top-left pin on the INPUT socket) appears at the top-right of the exposed plug. You can jam a wire jumper in that hole to a corresponding pin on the Arduino…
So! From the prior page, refer to the socket that’s correct for your matrix type. The labels may be a little different (or none at all), but most are pretty close to what’s shown here.
Then swap the columns to find the correct position for a given signal.
Either end of the ribbon cable can be plugged into the matrix INPUT socket. Notice below, the “key” faces the same way regardless.
With the free end of the ribbon toward the center of the matrix, the Arduino can be hidden behind it.
With the free end of the ribbon off the side, it’s easier to see both the front of the matrix and the Arduino simultaneously, for making additional connections or for troubleshooting.
Using color-coded wires helps a lot! If you don’t have colored wires, that’s okay, just pay close attention where everything goes. Our goal is a fully-populated plug like this:
32x32 and 64x32 matrices require three ground connections. 32x16 matrices have four.
Current Arduino Uno form-factor boards have three ground pins (the third is next to pin 13). If you need additional ground connections — for a 32x16 matrix, or if using an older Arduino board with only 2 ground pins — a solderless breadboard is handy for linking all these pins.
Arduino Mega boards have five ground pins. Same three as the Arduino Uno, plus two more next to pins 52 & 53.
Pins R1, G1 and B1 (labeled R0, B0 and G0 on some matrices) deliver data to the top half of the display.
On the Arduino Uno and Adafruit Metro (328, M0 or M4) boards, connect these to digital pins 2, 3 and 4.
On Arduino Mega, connect to pins 24, 25 and 26.
Pins R2, G2 and B2 (labeled R1, G1 and B1 on some matrices) deliver data to the bottom half of the display. These connect to the next three Arduino pins…
On Arduino Uno and Adafruit Metros, that’s pins 5, 6 and 7.
On Arduino Mega, pins 27, 28 and 29.
Pins A, B, C and D select which two rows of the display are currently lit. (32x16 matrices don’t have a “D” pin — it’s connected to ground instead.)
These connect to pins A0, A1, A2 and (if D pin present) A3. This is the same for all boards.
The LAT signal connects to Arduino pin 10.
This is the same for all boards.
The LAT (latch) signal marks the end of a row of data.
OE connects to Arduino pin 9. This is the same for all boards.
OE (output enable) switches the LEDs off when transitioning from one row to the next.
CLK connects to…
- Pin 8 on Arduino Uno, Adafruit Metro 328 or Metro M0.
- Pin 11 on Arduino Mega.
- Pin A4 on Adafruit Metro M4 (not shown, but you get the idea).
The CLK (clock) signal marks the arrival of each bit of data.
That’s it. You can skip ahead to the “Test Example Code” page now.