Understanding the Pin-Out
The image below (from arduino.cc) shows the pin out of the 8×8 LED Matrix LD-1088BS. Basically, this schema shows that:
- column 1 is controlled by pin 13
- column 2 is controlled by pin 3
- column 3 is controlled by pin 4
- …
- row 1 is controlled by pin 9
- row 2 is controlled by pin 14
- row 3 is controlled by pin 8
- …
Image may be NSFW.
Clik here to view.
The next image shows where each pin is located. Pin 1 is in the lower left corner in this picture, pin 8 in the lower right corner, pin 9 in the upper right corner and pin 16 in the top left corner.
- Green = pins
- Cyan (light blue) = columns
- Red = rows
Image may be NSFW.
Clik here to view.
The next picture shows where the rows and columns are located, i.e. the first row (r1) and first column (c1) start at the top left. This image also summarizes all of the above, illustrating which pin controls which column and row, e.g. column 1 (c1) is controlled by pin 13 (p13). When comparing this picture to the first picture it becomes clear that the picture below is simply a different illustration of that initial image.
Image may be NSFW.
Clik here to view.
Driving the LEDs
CAUTION: Before you put any voltage on pins make sure you limit the current through the LEDs by using a resistor. A resistor is necessary for each row, i.e. a total of 8 resistors.
Now, how does one turn on a particular LED? Let’s take another look at the first picture.
Image may be NSFW.
Clik here to view.
As a brief summary, an LED turns on when a certain threshold voltage is exceeded with the positive on the wide part of the triangle and ground where the pointy part with the bar in front is located. The LED will NOT turn on if the threshold voltage is not exceeded and/or when the polarity is reversed, i.e. the positive is on the side where the pointy part of the triangle is.
Let’s say we want to turn on the top right LED, i.e. where row 1 and column 1 intersect. To turn that LED on we need a positive voltage on row 1 as it connects to the flat part of the triangle. Ground then must be on column 1. This will turn on the top left LED. With that we have the following polarities on row 1 and column 1.
Image may be NSFW.
Clik here to view.
Given this, what does need to be done so all other LEDs do not turn on? Let’s look at the LED in row 2 and column 1, i.e. just below the LED we turned on. We can prevent this second LED turning on by simply putting that row on ground. That way there is 0 volt difference across the LED and hence the threshold voltage is not exceeded to turn the LED on. The same applies to all the other rows. With this we get the following:
Image may be NSFW.
Clik here to view.
Now let’s look at the LED in row 1 and column 2, i.e. the LED to the right of the LED we turned on. Column 2 cannot be set to ground as otherwise the LED in row 1 and column 2 would turn on. Therefore, we have to set it to a positive voltage. By doing that the voltage across the LED is 0V and hence the threshold voltage is not exceeded, i.e. the LED stays off.
Let’s verify that the LED in row 2 and column 2 also stays off. As we can see ground is connected to where the flat part of the LED is and positive is where the pointy part is, i.e. exactly the opposite for what is needed to turn on the LED. With that the threshold again is not exceeded (as the voltage over the LED is negative) and the LED stays off. We can do the same for all the other columns. With that we get the following:
Image may be NSFW.
Clik here to view.
As can be seen from this drawing, we had to set a positive voltage on row 1 and ground on all other rows. Further we had to put ground on column 1 and a positive voltage on all other columns.
The above can be generalized, i.e. we need to set the column to positive in which the LED is located that we want to turn on and all other rows to ground. Further, we have to set the column to ground in which the LED is located that we want to turn on. All other columns need to be set to a positive voltage.