Escolar Documentos
Profissional Documentos
Cultura Documentos
Did you know that you can build a digital read out (DRO) for a lathe or milling machine? Learn more...
HOME
KITS
TUTORIALS
PROJECTS
ABOUT
STORE
FORUMS
MEMBERS
Have you ever wanted to have one of those big scrolling LED displays, to keep you up to date on e-mails, news, weather, or stock quotes? In this microcontroller project tutorial, we'll show you how to build an array of 120 LEDs, how to control them all from one microcontroller, and how to talk to it from your computer.
November 3, 2009: Welcome, visitors! We had such a tremendous response to this video tutorial that we decided to make it into a kit of its own! Ready to build your own LED array? Find more details on our LED Array Kit page. - Humberto and Mike
This project makes use of row-column addressing, which lets us control lots of LEDs without having one wire going to each one. We also use one more trick -- the fact that diodes only conduct in one direction -- to double the number of LEDs you can handle with the ATmega168 microcontroller. There are some schemes that you can use to control even more LEDs (see Charlieplexing), but part of the tradeoff is that the LEDs would be on for a shorter fraction of the time, so they'd be less bright. Engineering is all about making smart tradeoffs: here, we're going with somewhat fewer LEDs, but they'll be brighter and the wiring will be much simpler. Here's what the finished product looks like:
www.nerdkits.com/videos/ledarray2/
1/4
1/23/13
Parts List
In addition to our USB NerdKit microcontroller kit and a wall DC adapter, you'll need: Photo Part Quantity Description
120
Our video shows green LEDs, but you can definitely use other colors. Keep in mind that the anode is the longer lead, the cathode is the shorter one (also indicated by a flat section on the plastic case, and by the triangle's tip and line on the schematic), and that current only flows from anode to cathode. Some example part numbers from Digi-Key: Red LEDs Green LEDs Yellow LEDs
We also used cardboard (roughly 21" by 6"), spray paint, wire (roughly 30-50 feet), and some tissue paper as a display diffuser.
If you aren't yet familiar with microcontroller basics or microcontroller programming, then what you first need to know is that each of the 12 column wires and 5 row wires goes to an input/output (I/O) pin of the microcontroller. The software running on the chip can put the pin in one of three states: HIGH (driven to +5 volts), LOW (driven to 0 volts), or FLOATING (undriven -- no current in or out). (There is a fourth state which has to do with pull-up resistors, but this is not important for now.) If a path from HIGH to LOW exists across any LED in the forward direction, current will be allowed to flow, and that LED will light up. To turn on the top left LED in this schematic, we would make row 0 be LOW, column 0 be HIGH, and simply drive no current onto the other row and column wires. For its neighbor one spot to the right, we would make row 0 be HIGH, column 0 be LOW, and not drive the others. The same pattern applies for all of the 5 row and 12 column wires, so that ultimately we can individually control every LED in the array. Row-column addressing, like shown here, is an extremely common way of reducing "pin count" of systems, which allows for simpler wiring and cheaper parts. For example, numeric keypads, like those on a telephone, have a row-column matrix of wires, so that an individual wire per button is not needed. Also, you should be aware that when using this kind of scheme, we are adding another complexity: time. With any sort of multiplexing scheme like this one, we can control or read lots of outputs or inputs, but we can't do them all at exactly the same time. That's why we have the microcontroller quickly loop through the various row/polarity combinations, as described more below.
Physical Construction
The physical construction of the LED Array is where you get to be creative. Feel free to explore different backboard materials, different spacing between the LEDs, even different patterns (who said it had to be a rectangular array). We started off with a piece of cardboard,
www.nerdkits.com/videos/ledarray2/ 2/4
1/23/13
and spray painted it blue. We measured and marked out a grid with spaces 3/4" apart, and drilled small 1/16" holes using a drill press. We understand most people do not have a drill press at home, but a handheld drill should work fine, or even a sharp pencil. Once you have holes in the back board, you need to put the LEDs through. We chose to run the column wires down the back of the array, and run the row wires across the front. This makes it easier to keep them from touching, and shorting out. In order to be able to drive more columns using only one microcontroller we will connect the LEDs using a wiring scheme that takes advantage of the diode properties of LEDs (see wiring plan above). This means we have to very careful to put the anodes of the LEDs through on the first column, then cathodes of the LEDs through on the second column, and keep alternating all the way down the array. On the back, every two LED columns is twisted together with one column wire, and soldered in place. On the front we lay the row wire across the entire row of LEDs, twist the LED pin over the row wire, and solder it together. You can then cut off the excess LED pin on the front using wire strippers, or diagonal cutters if you have them. Click any photo to enlarge:
LED Font
In order for a system like this to be useful for displaying text, you need a way to take characters and transform them into the internal array representation of ON/OFF LEDs. In order to abstract this away from the microcontroller code, we wrote a python font maker. This small program reads a file called font.txt which contains a representation of every character using rows of *s. The font maker python code reads this file and generates a C file called font.h. This font.h file is a giant array which contains every character represented by 5 integers. Each integer represents a whole column, and every bit of each integer is a single LED. Depending on whether the bit is high or low, the LED should be on or off. Loading font.h into our microcontroller code allows us to retrieve the representation of each character we want to display.
1/23/13
take a new character. The computer sends the characters one at a time, and the microcontroller scrolls them across the LED display. We wrote some python code that can accept a connection, and receive text over that socket connection and send it to the LED Array to be scrolled. You can use netcat, to send text to this script, or write your own application that pulls data from the web and pushes it to the LED Array! For example, you can run:
e c h o" H IM O M ! ! ! "|n e t c a tl o c a l h o s t6 6 6 6
to scroll that text across the display. When the text is done scrolling, the display will return to showing the current time.
Source Code
You can download the source code here. This ZIP file includes both microcontroller-side and PC-side code.
Comments
This webpage is not available
The webpage at https://www.facebook.com/plugins/comments.php? api_key=64994793174&locale=en_US&sdk=joey&channel_url=http%3A%2F%2Fstatic.a k.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D18%23cb%3Df30c17b1f4 %26origin%3Dhttp%253A%252F%252Fwww.nerdkits.com%252Ff1accc0c34%26domain% 3Dwww.nerdkits.com%26relation%3Dparent.parent&numposts=10&width=550&href=ht tp%3A%2F%2Fwww.nerdkits.com%2Fvideos%2Fledarray2%2F might be temporarily down or it may have moved permanently to a new web address.
Search NerdKits Home Kits Projects Library About Store Members Area Feedback Videos Capacitive Proximity Sensor C Programming: printf and scanf Motors and Microcontrollers 101 Interrupts & PS/2 Keyboards USB Servo-Guided Water Squirter Valentine's Day LED Heart iPhone-controlled R/C Car and many more... Community Forums Basic Electronics Customer Testimonials Microcontroller Programming NerdKits Newsletter Archives Project Help and Ideas Sensors, Actuators, and Robotics Support Forum and everything else...
www.nerdkits.com/videos/ledarray2/
4/4