Build an Arduino LED Matrix in 3 simple steps

From our STAR Maker: Sohil Patel
Arduino LED matrix DIY Hacking

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.

Arduino LED matrix DIY Hacking

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.
8. Arduino.

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.

Arduino LED matrix DIY Hacking

5mm Diffused LED

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:

Arduino LED matrix DIY Hacking

Arduino LED matrix connections

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.

Why IC 4017:
To control this arduino LED matrix, 4017 IC is the best way to do it. Here’s a good site to learn the basics of this IC: 4017 IC. The 4017 decade counter helps us with the multiplexing. This IC basically scans the rows of the matrix (lights up one row at a time).
In our case we want to connect the rows to ground but the 4017 provides a signal output and cannot ground the LEDs. So to solve this little problem we need to use a transistor with a resistor.Arduino LED matrix DIY Hacking
The 4017 has 10 output pins, so we need 10 resistors and 10 transistors. We connect the 1K resistors to the outputs of the 4017 and its other end to the base of the transistor as shown in the circuit figure at the top of this page. Next, we connect the collectors of the transistor to the LED rows and the emitter to the ground. You can also use BC547 npn transistor.

Step 3: Programming the arduino LED matrix

I have written a little program that scrolls text and added all the letters and numbers to it too. I used ports for my program because it saves space and is easier to handle.

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.

Arduino LED matrix DIY Hacking

Port control example

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.

And finally, don’t forget to unplug pins 0 and 1 when you upload your program, because these pins are also used as communication pins and may cause some errors with the program.
Download the project files from here  Yippeeee!!!  And its done!

Please share your projects here too so that we can work together :) And now the video demo of my arduino LED matrix:


Sohil Patel- STAR Maker at DIY Hacking

-Sohil Patel
I am a Coder and highly enthusiastic towards Computer Vision and Electronics Hardware.
Co-Founder of





Recommended Posts
Showing 20 comments
  • abhijit

    Can I use ULN darlinton IC instead of transistor?

  • WoRm

    how would i edit the code to control a 5×5 display. i understand that i would have to redo all of the definitions, but after that what is needed?

  • Inoace

    Thank you, very informative, I am working my way towards rgb matrix.

  • Tyler K

    Don’t bend the leads together and short them.
    Buy some 30 aug wire and wrap wrap the positive leads together and
    repeat for the negative. Loner but sure fire way to do it.

  • pratik

    sir i am facing problems with displaying the data in a chain i already have adafruit 16×32 led module but all the modules are displaying the same data at a time insted of sliding. please help me with it

  • Lukas

    For this app is better solution used addressable LED and control it by ONLY ONE pin

  • harikrishna

    how to write a program give any example plsss

  • Brent

    Getting macro names must be identifiers error when compiling. Relativity new to the arduino world, but I can do a few things.

    • Robert Jones

      I was getting the same thing.
      I had to change the #define for the numbers from numbers to words. 1 to ONE, 2 to TWO, 3 to THREE and so on.

      Worked great after that!

  • Elliot

    Hey I’m making a 10.5 by 14 inch LED Matrix with a .060 PET plastic board base so that I can see through it. I’m estimating I’ll need 150 5mm diffused RGB LEDS but I was wondering how many 8t 2200hm resistors,1k resistors and how many 2N3904 transistors I’ll need. Any advice is welcome, thank you!

  • Kevin


  • bella

    Hi. Its me again. From the video the text is scrolling from right to left. It is possible to make it scroll from left to right ?

    • Arvind Sanjeev

      Definitely, but you will have to edit the code correspondingly. Check out the series in which the leds are lit up and then reverse it.

      • bella

        Did you have the tutorial ?

        • Arvind Sanjeev

          Im sorry, I didnt understand.

          • bella

            Sorry if my question is not clear. What I mean is did you have the tutorial to make the text scrolling from left to right ?

            Thank you for keep replying my questions. I really appreciate your time.

  • TerrenceJ

    Excellent project, some great possibilities with this one, I can see it as part of a robot to give the robot some character or feedback from sensors, the list is huge, well done.

    • Arvind Sanjeev

      Wow, nice idea :) I hope you will build something and share it with us soon.

Leave a Comment

81 − = 80

Start typing and press Enter to search