Midnight Experiments – 8 by 8 LED Matrix

Aug 29, 2011   //   by The Resident Fundi   //   Blog  //  Comments Off

LEDs are light emitting diodes, and they are those little red, green, blue, green, etc lights that you see blinking from almost every electronic device these days. Phones, DVD players, TVs, clocks, etc.

An 8×8 LED Matrix looks like this.

8x8 LED Matrix - Fundi Bots

An 8×8 LED Matrix. Each white dot contains a red LED.

It’s basically a little square electronic device that has 8 rows of LEDs with 8 LEDs per row, making for a total of 64 LEDs. They are used mostly to as a visual component of a project or application. basically to display low resolution graphics, numbers, letters and so on.

Controlling them is a bit of a pain, because logic would dictate that if each LED has two wires sticking out of it, then an 8×8 LED matrix should have 128 wires, right? Wrong. They actually have 16 wires total. The internal wiring is a little outside of the scope of this post. But let’s just say if you need to light a single LED, you need to power up the column it’s in, then power up the row it’s in. The LED that is at the intersection of the row and column will then be lit. A lot easier said than done.

This weekend, I remembered I had not yet setup an 8×8 matrix code library to use for experiments. Heck, I hadn’t even used an 8×8 matrix with an Arduino. Last time I set one up, I used a PIC 16F. Let’s just say I would NOT like to use Assembly to program again.

So I figured I’d build the code library over the weekend. After much trial and error trying to figure out the wiring, I eventually managed to get the array working. It looked like this.

8x8 LED Matrix fully lit, next to an Arduino board.

8x8 LED Matrix fully lit, next to an Arduino board.

Low light view of an 8x8 LED Matrix fully lit, next to an Arduino board.

Low light view of an 8x8 LED Matrix fully lit, next to an Arduino board.

Once that was done, the next step was to control it more precisely. Basically to build the code to allow it to show what you want it to show.

Now, there’s something very sneaky about the eye. Every thing you see stays “in your eye” for a split second, before your eye processes the next thing you are seeing. This is called persistence of vision, and it’s what allows you to watch movies and animations. Essentially, you are seeing a very fast sequence of still images, but because the images sort of “overlap” in your eye, you do not notice that they are still images. The average movie or tv show contains 25 images in every second of video.

To show an image on an LED matrix, you basically start at the top left corner of the array, and going column by column, row by row, you turn each LED on and off very very fast, lighting only the LEDs you want to show. If you do this fast enough, the person looking at it will be tricked into thinking she is looking at a still image/graphic/number. Like this.

8x8 LED Matrix showing the number 7

8x8 LED Matrix showing the number 7

8x8 LED Matrix showing the number 3

8x8 LED Matrix showing the number 3

In reality, what you are seeing is one light being turned off (or on) at a time, starting from the top right, but it’s so fast that your eye is fooled into thinking all of them are on. Sneaky huh?

Here’s a video showing the LED running through a sequence of numbers and patterns. Note: I’ve deliberately customised some patterns so you can see the LEDs being lit up one at a time.

The next step is to clean up the code (right now it’s a little too elementary), and then build the entire alphabet library. Very time intensive stuff. We’ll share the code once we’re done.

Well, that’s it for this update.

Please post your comments and questions below.

Comments are closed.

Links & Stuff

We've listed some useful places, contacts, friends, vendors and sponsors below. We hope you find them useful.

Friends

  • The Rogue King Founder’s blog. Rants and raves about everything and nothing.

Resources

Sponsors

  • Google RISE. We won a grant from these awesome folk!
  • Node Six Generously providing hosting, design & maintenance for Fundi Bots.
  • Spark Fun Have given us lots of awesome education dev kits.

Vendors

  • Solarbotics Vendors of some seriously cool electronics and robotics parts.
  • SparkFun They sell electronics but they are also passionate tinkerers.