9*9 LED matrix with Arduino by zmolroc
DSC01153.JPG
Ever wanted to have a bigger display?

This display is based on an 9*9 green LED Matrix. The display is driven just with one Arduino board (Duemilanove in my case).

Why do we use a matrix and we don't light's up the leds individually?

Basic :
A led have 2 pin's: anode & cathode.
So even we put the led's with the common cathode, we will still have 81+1 pin's, the arduino board isn't enought for this.

In a matrix we can put the columns to the cathode and the rows to the anode of the Led's, so here we will have just 9+9 pin's, better then the other but a little tricky on the programming stuff.

 
Remove these adsRemove these ads by Signing Up

Step 1: Basics

DSC01022.JPG
Matrix_sch.jpg
DSC01059.JPG
DSC01089.JPG
DSC01091.JPG
DSC01108.JPG
 What do you need : 

- 81 green LED's (or other color)
- an test PCB
- and an arduino board

next we need the schematics : 

Matrix hardware

I have build the matrix like next :
- the columns have the cathode's of the LED's
- the rows have the anode of the LED's

Arduino Pin's :

Now we will have to connect the matrix to the arduino board :

the rows :
 
- the row 1 to digital pin 0
- the row 2 to digital pin 1
- the row 3 to digital pin 2
- the row 4 to digital pin 3
- the row 5 to digital pin 4
- the row 6 to digital pin 5
- the row 7 to digital pin 6
- the row 8 to digital pin 7
- the row 9 to digital pin 8 

the columns :
- the column 1 to digital pin 9
- the column 2 to digital pin 10
- the column 3 to digital pin 11
- the column 4 to digital pin 12
- the column 5 to analog input pin 0 (there is no problem we can use it like a digital one, i'll show you later)
- the column 6 to analog input 1
- the column 7 to analog input 2
- the column 8 to analog input 3
- the column 9 to analog input 4
Diljot says: May 5, 2013. 11:39 AM
is it necessary to use resistors and transistors to make the matrix work? cause when i type n the code, the entire row lights up, can't get a single led to light up.
CairParavel314 says: Dec 23, 2011. 11:08 AM
Can you show me a more detailed example of how soldering the LED in the board? I want to do the matrix, but I can't see much from the image and I'm starting with the Arduino also.
zmolroc (author) says: Dec 23, 2011. 1:17 PM
Them are solder like in the image with schematics. On the test board you have lines with anodes and in the air lines with cathode or reverse (this is my version)...... You can use whatever you want, as long as you respect the schematic.
axeman911 says: Jun 22, 2011. 3:38 PM
there still seems to be something wrong with your program about the while statement?
zmolroc (author) says: Jun 22, 2011. 10:00 PM
There is nothing wrong with the loop, the problem is in another place, after defining the matrix you must close that with }; , i typed wrong.... but c'moon this is basic programming ......
axeman911 says: Jun 23, 2011. 9:08 AM
yeah i figured that out, now when i upload it, it doesnt light up anything, even though the rows and columns are all in the proper pins.
zmolroc (author) says: Jun 23, 2011. 11:29 AM
check if you connected the led's ok, i mean the anode and the cathode are were they are suppose to be. if this is ok, please check if the led's are functional (they are not burned or something, light one up "manually"), next step will be to write a program to light up just one led ....
axeman911 says: Jun 23, 2011. 12:28 PM
thanx, i will try that
axeman911 says: Jun 23, 2011. 1:53 PM
so here is my program that turns on one led it works, so what is the next step, but when i define the columns 5, 6, 7, 8, and 9 and put them as ouputs to the analog pin, then nothing blinks???

#define R1 0 //digital pin C stands for colums
#define R2 1 //digital pin R stands for rows
#define R3 2 //digital pin
#define R4 3 //digital pin
#define R5 4 //digital pin
#define R6 5 //digital pin
#define R7 6 //digital pin
#define R8 7 //digital pin
#define R9 8 //digital pin
#define C1 9 //digital pin
#define C2 10 //digital pin
#define C3 11 //digital pin
#define C4 12 //digital pin

void setup() {
pinMode(R1, OUTPUT);
pinMode(R2, OUTPUT);
pinMode(R3, OUTPUT);
pinMode(R4, OUTPUT);
pinMode(R5, OUTPUT);
pinMode(R6, OUTPUT);
pinMode(R7, OUTPUT);
pinMode(R8, OUTPUT);
pinMode(R9, OUTPUT);
pinMode(C1, OUTPUT);
pinMode(C2, OUTPUT);
pinMode(C3, OUTPUT);
pinMode(C4, OUTPUT);
}

void loop() {
digitalWrite(R1, LOW); //here all the way till the first delay
digitalWrite(R2, LOW); //i set the anodes and cothodes opposite
digitalWrite(R3, LOW); //so that they are all off
digitalWrite(R4, LOW);
digitalWrite(R5, LOW);
digitalWrite(R6, LOW);
digitalWrite(R7, LOW);
digitalWrite(R8, LOW);
digitalWrite(R9, LOW);
digitalWrite(C1, HIGH);
digitalWrite(C2, HIGH);
digitalWrite(C3, HIGH);
digitalWrite(C4, HIGH);
delay(500);
digitalWrite(R6, HIGH);
digitalWrite(C1, LOW);
delay(1000);
}
zmolroc (author) says: Jun 24, 2011. 1:08 AM
ok, first, nothing blinks because you have them all the time on, they blink but too fast for us, you have to turn them on, then of then on, with a specific delay
axeman911 says: Jun 16, 2011. 10:59 AM
there is something wrong with ur program a copyied it and ran it but there is some problem with the while(1){} command?
zmolroc (author) says: Jun 16, 2011. 11:40 AM
What problem ?, as you can see, in the video it works is the same program, of course maybe when i've typed here, appeared a space or something and a copy paste will damage the arduino format.
axeman911 says: Jun 17, 2011. 9:17 AM
well every time i try to compile or upload it it says that before the while(1) { command a , or ; is expected but i can't find where?
zmolroc (author) says: Jun 19, 2011. 9:34 AM
Sorry, for the delayed response, check all the program if there are all the } closed in a correct order, and check if all the lines for ;
axeman911 says: May 25, 2011. 6:19 PM
like other matrixes in this one is it possible to make the leds light so that you can make words actually fly across the screen and the same for letters
zmolroc (author) says: May 25, 2011. 7:07 PM
Yes, i've done exactly this in the demo.
axeman911 says: May 24, 2011. 6:02 PM
if the input voltage is 5v don't you need a resistor for the leds?
zmolroc (author) says: May 25, 2011. 10:52 AM
Yeah, but you keep the led on for a fraction of a second so, first, second : arduino doesn't have 5v, it's around 2.5v, i don't know why, i measured it.
axeman911 says: May 25, 2011. 12:03 PM
and what if i leave the leds on for longer.
axeman911 says: May 25, 2011. 12:01 PM
srry but if u plug in the usb cable it is 5v.
but would it still work if i put a resistor
zmolroc (author) says: May 25, 2011. 12:09 PM
you don'y let the led on longer time, because you have a matrix, and you shift the lines very fast to obtain the object, at a specific time you don't have 2 lines or 2 columns fully on.

So what the usb has 5v, the internal resistance of the controller reduces the voltage, measure it, the only I/O that has 5v is I/O 13, tested. If you put a resistor of course will work, the resistor limits the current delivered to the led.
axeman911 says: May 25, 2011. 2:04 PM
thanx but what if i want to turn on an entire colum or row on at a time to spell words?

so ur saying that the voltage that comes out of the pins is less then 5V?
zmolroc (author) says: May 25, 2011. 5:15 PM
doesn't matter you cannot keep the line or column ON, more than a fraction of a time, play with it and you will see why.

Yes, i've seen this to the newest boards, the older ones have 5v, but the newest around 2.5v, exception at I/O 13.
axeman911 says: May 25, 2011. 6:42 PM
srry last one i swear so if i am using the 5v ones i need a resistor
zmolroc (author) says: May 25, 2011. 7:06 PM
ok, i think a 470 Ohm resistor it's enough
axeman911 says: May 25, 2011. 8:34 PM
thank you soooo much!!! :)
zmolroc (author) says: May 26, 2011. 11:54 AM
no problem .....
crusy says: May 8, 2011. 3:37 AM
from what I read the Arduino can provide 40 mA per pin (http://arduino.cc/en/Main/ArduinoBoardUnoSMD) - isn't this a problem when you turn on all 9 (or even 10) LEDs?
zmolroc (author) says: May 8, 2011. 4:09 AM
the brightness of the LED suffers, but Arduino it's ok. If you want the LED full power you need to integrate some transistor.
pbriz says: Oct 13, 2010. 12:13 PM
I'm pretty new to this (physical computing) but i'm trying out this project. So far its all good, and makes perfect sense but i noticed that other charlieplexed LED matrixes that I've seen out there tend to include resistors between the LEDs and the power sources (the output pins). Is there a reason why this project doesn't include resistors? Are they used as some sort of precaution normally?

By the way, thanks for this post, its been very helpful!
Mario1 says: Oct 7, 2010. 1:54 PM
Whats up with most of your LEDs not lighting?
Is this caused by an LED itself or you messed up the soldering?
zmolroc (author) says: Oct 8, 2010. 6:53 AM
The LED itsefl, i found too late.
GOwin says: Jan 9, 2010. 10:05 AM
CAn you use the original Arduino serial for this? Can the ATMega8 handle this?
zmolroc (author) says: Jan 10, 2010. 10:25 AM
 i think he can handle. i haven't worked with atmega8 but i think he can do the job
winkman says: Nov 21, 2009. 8:24 PM
 I did this for a project a while ago, because  saw a description etc on the Arduino website. Worked well :)
zmolroc (author) says: Nov 22, 2009. 3:16 AM
 Thanks :D
just_watching says: Nov 18, 2009. 10:47 AM
you could also use the arduino mega or a clone of it then u can drive even more leds
zmolroc (author) says: Nov 18, 2009. 11:20 AM
 yes you are right, you could do that, but i wanted to do it with a regular arduino, and you can drive up to 10*10 but i've let 2 pin's free  for buttons or something else ....
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!