LED Matrix and Arduino

LED Matrix Driven by an 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.

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:
https://github.com/pchretien/flash_leds

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:
http://www.arduino.cc/en/Tutorial/ShiftOut

Have fun …

6 Comments

  1. Pato Palacios
    January 20, 2012

    Thanks, you are very generous as a teacher with your examples.

    Reply
    1. pchretien
      January 20, 2012

      Thanks for your comment … I which I had more time to work on my blog!

      Reply
  2. Fernando Perez
    September 20, 2015

    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

    Reply
    1. pchretien
      September 20, 2015

      Glad it helped!
      Send us pictures of your project!
      Phil

      Reply
  3. Chris
    January 16, 2017

    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 :(

    Reply
    1. pchretien
      September 21, 2017

      There are a lot of great tutorials on the Arduino website for total beginners! :)
      Good luck,
      Philippe

      Reply

Leave a Reply

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

Scroll to top