8×8 LED matrix control on an Arduino Diecimila tutorial by Selim Kurar


Options To Control Every LED Separately;

1- LED Display Drivers (ie. MAX7219, MAX7221 http://www.maxim-ic.com/quick_view2.cfm/qv_pk/1339 - http://www.arduino.cc/playground/Main/MAX72XXHardware )

2- Bitmap Array

Basic Info

-There are 16 pins on the matrix representing rows and columns. Best way to figure out rows and columns is to get a pen and paper, put your multimeter on the diode check setting, and start touching pins. Once you get one LED lit up, know that your positive meter lead is on a row, and your negative is on a column.  Keeping the positive lead in place, move the negative lead in order to find the other columns.

-To light a LED connect its row’s anode to +5volts, and through a resistor, its column’s cathode to ground.

-To control a matrix, you connect both its rows and columns to your microcontroller. The rows are connected to the LEDs anodes, so a row needs to be high for any of the LEDs in that row to turn on.  The columns are connected to the LEDs cathodes, so the column needs to be low for an individual LED to turn on. If the row and the column are both high or both low, no voltage flows through the LED and it doesn’t turn on.

Best Replica Watches

Row/Column Led Matrix Arduino Pin

C8 1 D5

R5 2 D4

R3 3 D3

C5 4 D2

R8 5 A0

C7 6 A1

R2 7 A2

R1 8 A3

C4 9 D13

C2 10 D12

R7 11 D11

R6 12 D10

C1 13 D9

R4 14 D8

C3 15 D7

C6 16 D6

C=Column  R=Row  D=Digital  A=Analog

Both Analog and Digital can be used as long as they are set as output on software.

Based on Direct Wiring on previous page. Do not use RX/TX pins (D1,D2).

Test Code for Checking Proper Connection

Using direct wiring shown above…

byte col = 0;
byte leds[8][8];
// pin[xx] on led matrix connected to nn on Arduino (-1 is dummy to make array start at pos 1)
int pins[17]= {-1, 5, 4, 3, 2, 14, 15, 16, 17, 13, 12, 11, 10, 9, 8, 7, 6};
// col[xx] of leds = pin yy on led matrix
int cols[8] = {pins[13], pins[10], pins[15], pins[9], pins[4], pins[16], pins[6], pins[1]};
// row[xx] of leds = pin yy on led matrix
int rows[8] = {pins[8], pins[7], pins[3], pins[14], pins[2], pins[12], pins[11], pins[5]};
void setup() {
// sets the pins as output
for (int i = 1; i <= 16; i++) {
      pinMode(pins[i], OUTPUT);
// set up cols and rows
for (int i = 1; i <= 8; i++) {
      digitalWrite(cols[i - 1], LOW);
for (int i = 1; i <= 8; i++) {
      digitalWrite(rows[i - 1], LOW);
void loop() {
for (int i = 1; i <= 8; i++) {
      digitalWrite(rows[i - 1], HIGH);
for (int i = 1; i <= 8; i++) {
      digitalWrite(rows[i - 1], LOW);

Animation with Bitmap Array

To create an animation, we will use a scan pattern. In the code we define a series of bitmap images (arrays of 8 bytes, each bit representing one LED). Next we scan through each array one byte at a time, displaying one column then the next. If we do this fast enough (about 1000 times a second) it appears as an image.

What can be done?

Puzzlemation was awarded Distictive Excellence in the Microchip 16-bit Embedded Control Design Contest 2007, and an Editor's Choice Award at the 2008 Bay Area Maker's Faire.


Other examples, (some may require separate libraries check websites);





 likes / 0 Comments
Share this post:

Leave a Reply

Your email address will not be published. Required fields are marked *

five − 4 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


> <
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec