Friday, 11 October 2013

How to find the pin-out for an 8x8 LED matrix

Determined not to let last night's BuildBrighton meeting be a waste (I forgot half my stuff and couldn't get the other half to work!) I put some prep-work in for the word clock idea that Steve and I spoke about a little while back.

I had some 8x8 LED matrix modules. From the look of them (they had 24 not 16 pins) each was a dual-colour matrix; the problem was not being able to find out anything about them: Google drew a blank on the part numbers, and I've had them for that long, I've no idea where to begin looking for the datasheet. So I started tracing out the pins.

Working out the pins for an 8x8 LED matrix isn't as difficult as some people think.
Firstly, each dot is a diode (that's what the D in LED - light-emitting-diode - stands for) so it doesn't matter if you connect the power supply the wrong way around through them. Armed with this knowledge, I connected a 5v supply to a breadboard, routed a ground wire through a 100 ohm resistor (don't want to go blowing any of the LEDs on the matrix!) and connected power and ground to two pins at random.

Ok, it wasn't really random, it was quite methodical - but the point is it didn't really matter which two pins I chose, I just kept trying pin combinations until something lit up.


Eventually, with power on pin 3 and ground on pin 1 of the lower row, a green LED lit up.
Perfect! So I drew a grid and recorded P3,G13 in the corresponding location. Keeping the power connected to pin3 and moving the ground connection resulted in each of the top row being lit up.

Occasionally a red LED would light up, in the same location as the green, but with the ground connection on the next pin along than the green light. So once I'd mapped out the grid for one colour, I could move the ground connection along one pin and get the same result for the other colour.



Now keeping the ground in a known place, and moving the power connection, I was able to map out which LEDs lit up with which combinations of power and ground on different pins.


There was no need to try every combination of pins - once I knew which ground pins caused which columns to light, and which power pins caused each row to light, the rest of the grid could be inferred from these results.


I couldn't be bothered drawing each and every LED on the paper, but you can see the results. To get the top left LED to light, put power on pin three and ground pin 1 (the green LED lights) or ground pin 2 (the red LED lights up). The numbers down the left represent which pins need power to activate which rows, and the numbers along the top tell us which pins need grounding on which column to get a particular single LED to light.

That's really all there is to it. It seems a bit hit-and-miss (it probably is) but within about 10 minutes, you can work out the pin-out for just about any 8x8 LED matrix.

No comments:

Post a Comment