LED Matrix and Arduino

Light Emitting Diodes (LED) are everywhere. There is a good reason for that, we love them! Most of us are using LEDs to communicate information, debug our code or simply add some style to our electronic projects. One of the first things one normally want to do is pack a bunch of LED to create a mini display. Lets see how we can build a simple 3×3 LED matrix display in less than an hour.

LED Matrix Driven by an Arduino
LED Matrix Driven by an Arduino

To build this simple circuit all you have to do is solder the cathodes (longer pin) of each column together and the anodes (shorter pin) of each row together. To avoid shorts between anodes and cathodes I added a layer of cardboard before to bend the anodes over the cathodes. Here is the schematics for this circuit:

LED Matrix Circuit
LED Matrix Circuit

Once the circuit is finished you connect the cathodes (k) to pins 2, 3 and 4 and the anodes (a) to pins 5, 6 and 7 of the Arduino board. You are done with the hardware. Lets make the program …

The following program will display a few different patterns on the LED matrix. The code is ugly and I don’t really care. We are not here to talk about code re-use but to play with LED!

You can find the code on my Github at:

To match the code and the circuit displayed here, connect K3 with pin #5 and A3 with pin #2. I guess you will figure out how to connect the remaining LED wires!

Driving only 9 LEDs using 6 wires is far from efficient. To find out how to drive more LEDs using only 3 pins on your Arduino and an 75HC595 register chip , visit the Arduino Playground website at:

Have fun …


  1. thanks, and nice job i made my led matrix thanks to you, it was very helpfull greetings and farewells from San Luis Rio Colorado, Sonora, Mexico

  2. Really nice tutorial. I did my own 3×3, and it wokred perfectly, although i dont have soldering iron- I used breadboard and some cables. It looks messy, but it works anyway. The only problem for me (I am complete beginner with Adruino, and C++) it the code- i have completely no idea how it works :(

Leave a comment

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