Build an Arduino LED Matrix in 3 simple steps
LED matrix is one of the most popular projects that are built using the Arduino. Its really fun working with LEDs and the kind of output you get from it is mesmerising. You can use these matrices for various applications such as to create cool sign boards with scrolling texts, to play animations, etc. Its really cheap and simple to build one and can be easily reprogrammed using the arduino. You can even customise it to be used with the output of a music system, so we get cool synchronised visuals along with it.
In this tutorial I will show you how to build a fancy 8 by 10 arduino LED matrix (with scrolling text and animations) using the arduino and 4017 decade counter. Or you can even buy assembled LED matrix online. This type of matrix is easy to make and program and it is a good way to learn about multiplexing.
What are the stuff required to do this?
1. 80 LEDs.
2. Eight 220Ohm resistors.
3. CD4017 decade counter IC.
4. Ten 1K resistors.
5. Ten 2N3904 transistors.
6. Single strand wire.
7. Solder dot board.
How does it work?
This whole arduino LED matrix project works on the principle of multiplexing. Here, the arduino is connected to the 4017 decade counter IC and sends the data through two lines. The multiplexed data from the arduino is then decoded into separate signals for the LEDs via the 4017 IC. This then drives the corresponding LEDs in the various rows.
Step 1 : Soldering the Matrix
Choosing the right LEDs is one of the most important parts of this project, because choosing the right ones is very critical to the execution of this project. I recommend using 5mm diffused LEDs because they supply a decent amount of brightness and delivers a clear image.
Soldering the arduino LED matrix is the tricky part, there are a lot of ways to do it and I will share my method with you. You need to connect all the positive leads of the LEDs in columns and the negative leads in rows. You can use the solder dot prototyping board for soldering the LEDs on it. Push the LEDs through the adjacent holes on the board. Use the circuit figure below for connecting the arduino LED matrix together.
Then, take the positive lead of the first LED and bend it down to the other LEDs, solder the pins which touch each other. Next, take the last lead that you soldered and bend it again down and repeat till you have all the positive leads connected in the column. Snip off the extra length of the leads that you didn’t use.
Now a new dilemma is created ;) That is: connecting the negative pins in a row, because you can’t bend them and solder like you did with the positive leads, as it will short each other. My method saves a lot of time and is simpler. The trick is to put some tape or simple adhesive tape on the column’s connections to isolate them from the negative pins. And if you do that you can bend the negative leads too and connect them like you did with the positive ones. And they wont short each other as they will be isolated :)
The circuit for the arduino LED matrix is as shown:
Via a resistor you have to connect each column to the arduino (pins 0-7). The reset pin of the 4017 goes to pin 8 on the arduino and the clock pin goes to pin 9 on the arduino.
Step 2 : Multiplexing for the Arduino LED matrix
So what is multiplexing:
It is basically a way to split information into little pieces and send it one by one. This way you can save a lot of pins on the arduino and keep your program quite simple. In our case we split the image that we want to display into 10 pieces (10 rows). We want to scan the rows of the matrix (light up one row at a time) and send info from the arduino to the columns. All the columns are positives of the LEDs and the rows are negatives. So if the first row is connected to ground and we send signal to the first column, it will only light the first LED in the row.
To get a good display we need to scan the rows very fast, so fast the the human eye thinks that all of the rows are connected at the same time.
Step 3: Programming the arduino LED matrix
If you don’t know how to work with ports on the arduino I recommend to go on the arduino web site to learn quickly a few basic stuff before you start. Here’s the link: Arduino port manipulation.
Port control is really easy, check out the above figure as an example. Here the red dots indicate the LEDs which are ON and the white as OFF. So in the first row of the matrix, to turn the 2nd and 7th LEDs ON, we give a command to arduino port: B01000010. Here the 2nd and 7th bits are “1”, which inturn turns the LED ON. “B” indicates to arduino that the port is an output port. We do this exercise for all the rows and finally we will get a lighted up smiley, like in the figure :).
If you want to make your own images I have made a little excel tool that will make writing images a lot easier. You can find it in the zip folder which I have attached at the end.
Please share your projects here too so that we can work together :) And now the video demo of my arduino LED matrix:
I am a Coder and highly enthusiastic towards Computer Vision and Electronics Hardware.
Co-Founder of www.printajoy.com