LED arrays are lots of fun, and easier than you may think to control. In this Instructable, you will learn how a LED matrix is built and works and how to drive it using a MAX7219 driver chip. We will be using an Intel Edison with Arduino breakout board to program static images and animations.

After learning the basics, check out the resources page, where you can build a binary clock, a game of Tetris and more!

## Step 1: Gather Materials

[1] 8 x 8 Matrix

[1] .01 uF capacitor

[1] 10 uF capacitor

[1] 28K resistor

[many] jumper wires

## Step 2: How an LED Matrix Works

An LED array is a collection of LEDs, they can be arranged in many patterns, the most typical being a single line, or a matrix pattern. Here we cover the matrix pattern. A matrix defines a rectangular or square consisting of intersecting rows and columns. The intersection of these rows and columns are important to how we talk to the matrix and address individual LEDs.

Let’s start by looking at an LED, there is a negative (cathode) terminal that goes towards ground, and a positive (anode) one that goes towards power. The power terminal gets connected to a microcontroller I/O pin, which will pump out voltage, turning it on and off based on the uploaded program. The anodes and cathodes are connected, forming the columns and rows. A LED matrix can either be column anode or column cathode (like in the diagram above).

If we wanted to be able to control each LED individually, every LED in a matrix would need it’s own I/O pin. A 8x8 matrix would need 64 pins. That’s a lot! Luckily there is something called multiplexing which reduces the number of pins needed to 16 in order to control the matrix. The pins can then be referred by the row number or column number, for example, Row 1-8 (R1 - R8) or Column 1-8 (C1 - C8).

Multiplexing works by turning on LEDs in one row or column at a time, for simplicity’s sake, lets say we are turning on rows. Each row is turned on and off right after one another at a rate quick enough that the persistence of vision causes us to see a static image.

## Step 3: Wiring

If a multiplexed matrix is wired up to the microcontroller, each of the 16 pins on the matrix will need to be wired to 16 digital I/O pins. No matter what dimension the matrix is, those pins add up. This is where the MAX7219 driver chip comes in handy. It takes all 16 pins of an 8x8 matrix and reduces the number the pins connected to a microcontroller to 3, the data in, Load (CS) and clock pin.

Identifying Pins on Matrix

Before the matrix gets connected to the driver chip, you need to identify which pins correspond to the columns and rows that each LED intersects at. We can find that out by looking at the datasheet for the LED matrix being used. It helps to put a piece of tape along the right and bottom edge of the matrix and then write down what the pin corresponds to.

Connecting MAX7219 to Matrix

Once the pins are identified, they can be connected to the driver chip. Looking at the datasheet, we can see there are Seg and Dig pins. The Seg pins get connected to the anodes, the Dig pins connect to the cathodes. Like the matrix, the Seg pins aren't necessarily in sequential order when looking at the chip pins, each pin needs to be identified as which Seg and Dig pin they are. To make it easier, I've identified and mapped the pins of the driver chip the pin number of the matrix for you. See the image above and make the connections using jumper wires.

Connecting MAX7219 to Edison

Connect these 3 pins to the Arduino breakout board:

Driver pin 4 and 9 -> GND

Driver pin 19 -> +5 volts

Driver pin 12/Load (CS) --> 10

Driver pin 13/Clock --> 11

Driver pin 1/Data In --> pin 12

If connecting multiple matrices, daisy chain drivers by connecting the driver pin 24/Data Out to pin 1/Data In on the next driver chip.

## Step 4: Code

To turn on a LED, either the integer 0 or 1 needs to be sent through software. The pattern can be thought of a grid, each LED or pixel that needs to be turned on corresponds with the row and column set up of the LED matrix. Any LEDs that need to be turned on is assigned a 1, LEDs that are turned off are assigned a 0. Above you will find the patterned logic used to display an asterisk.

Remember, we are working with a column cathode matrix, so we will be sending the rows the data. If one row is thought of as an array, you can turn on R1 by sending the binary logic:

R1 : 10011001

You can then turn on rows 2 – 8 by sending the following:

R2 : 01011010

R3 : 00111100

R4 : 11111111

R5 : 11111111

R6 : 00111100

R7 : 01011010

R8 : 10011001

By turning on and off LEDs in a grid design, any static image can be made, within the matrix's resolution constraints. What if you wanted to create an animation? It's easier than you may think, each frame of the animation just needs to be thought of as a static image. Load up a function with arrays that holds each frame of the animation, when called your design will play. To dictate the frame rate, place a delay() after each frame with the value in milliseconds.

Download the attached example code and go to the next step to learn how to upload to the Edison. The program displays a static bang(!), asterisk (*) and heart and an animated exploding heart.

The Edison can be programmed via the Eclipse and Arduino IDE. Languages that can be used are C/C++, Arduino language and Javascript.

Intel has extensive documentation on their website for the Edison and Galileo. Below are listed some of the main steps to be aware of when preparing to upload a program to the Edison board with links to relevant pages. For more details and documentation, begin at Intel’s Get Started page. There you will learn how to assemble hardware, download software and find demos and links providing example code.

Arduino

Get your Edison flashed with the latest firmware and learn how to connect to it through the USB serial port. To upload Eclipse you will also need to connect it to a WiFi network, with Arduino it’s not necessary. Download Intel’s Arduino IDE , when you open it you will see the Intel Edison and Galileo boards under the Tools menu. An understanding of Arduino is recommended before getting started with Intel’s version.

Getting Started with Arduino

Eclipse

To upload a program via Eclipse, the Edison board needs to be connected to a network and your computer needs to be connected to the same network. After flashing the latest firmware and connecting to the USB serial port, visit Intel's Get Started page and choose how you want to get your board online.

If programming in C/C++, Intel provides example code on their Github MRAA and UPM library pages.

Follow the steps on Intel’s website for how to install the Eclipse IDE and how to create a new project, which shows how to upload the blink program via Eclipse.

If you get stuck, the best place for help with troubleshooting is Intel’s forum.

## Step 6: Going Further

Projects

LED Matrix Safety Backpack

Flame Effect

Bi-color LED Matrix Tetris Game

Pong with 8x8 LED Matrix

Binary Clock

Resources

MAX7219 datasheet

8x8 Matrix datasheet

Sparkfun

Learning

Persistence of Vision

LedControl : Arduino.cc

MAX7219 : Arduino.cc

There is another way that matrices can be configured in, other than multiplexed that uses even fewer pins. This is called Charlieplexing. To learn more about what it is and how to hook one up, start with the Make: article on this very subject.

<p>so where are the capacitors and resistor supposed to go? I have read though this like 4 times, am I missing something here?</p><p>and on the max7219 to edison, what is meant by;</p><p>&quot;Driver pin 12/Load (CS) --&gt; 10</p><p>Driver pin 13/Clock --&gt; 11&quot;</p><p>10 and 11 on what exactly?</p><p>Help would be appreciated.</p>
<p>The LedControl.h library does not seem to work on the Edison. Was any hardware configuration done on the Edison to get it to work? On the other hand, was there any modifications made to the library to get it to work with the Edison? </p><p>Thanks</p>
<p>Incredibly Great.....</p>
<p>Great write out on the control of a single color LED Matrix module using MAX7219 IC. We are pleasantly surprise you referenced one of our instructables to build a Bi-color LED Matrix Tetris Game in your instructable.</p><p>We designed the Bi-color LED Matrix module which is used in quite a few of our instructables. These modules can be easily daisy-chained to make a longer display such as in our Arduino (SPI) 7 Bi-color LED Matrix Scrolling Text Display instructable at <a href="https://www.instructables.com/id/Arduino-SPI-7-Bi-color-LED-Matrix-Scrolling-Text-D/" rel="nofollow">https://www.instructables.com/id/Arduino-SPI-7-Bi-c...</a></p>
<p>nice </p>
I make it<br>
This one is simplest<br>http://blog.circuits4you.com/2015/04/led-8x8-matrix-display-interface-with.html<br><br>Only two components required
<p>How about controlling bigger arrays joined, and using them to display video at decent frame rates have seen rbpi projects for that, but none is on the level of replacing expensive solutions can that be done with an Edison???</p>
<p>Or you could just save 100 bucks (80%!) by using an arduino like everyone else does. What a waste of an Intel Edison.</p><p>Sure, I understand the point of sponsored content. But please use at least its unique features not just for an LED matrix. Introduce us to it's wireless capabilites, IOT applications, bluetooth, or make use of it's powerful processor! There's so much more to discover.</p>
<p>Not to mention there are dozens and dozens of Instructables already detailing everything you could ever want to know about how to work with LED matricies.</p>
<p>I understand your point, this information can still be applied to other microcontrollers and folded into projects that use a matrix like the one above. This is the last of the Intel "intro" projects. Keep a look out for wireless projects coming up soon. </p>
<p>I'll wait patiently. I just followed you so I won't miss a thing. ;) </p>
awsooooooome