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…
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:
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…
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.