Sunday, October 09, 2005

8x16 LED Matrix


Here's a project that I'm dusting off from a couple of years ago - a homemade 8x16 LED matrix. Basically this is a small version of the type of sign often used for displaying messages along the sides of roads, in stores, etc... The resolution is not great and it's not really wide enough to be totally practical, but it is a good proof of concept and an excellent way to hone the 'ol soldering skills.

The device is really quite simple from the hardware point of view - it consists of 128 LEDs that are arranged into a matrix of sixteen columns and eight rows. The cathodes of all of the LEDs in a column are all tied together and are only grounded when the circuit is completed by a transistor. Similarly, the anodes of all of the LEDs in a row are tied together and are only supplied current when completed by a transistor. The transistors grounding the columns receive their signals from a 74LS154 demultiplexer that has four digital inputs and sixteen digital outputs. The signals must first pass through a 4069 hex inverter since the output from the demux is opposite of what we want (selected output is low, others are high which is not what we want). Only one column can be grounded at any given time. The input to the demux comes from four of the output pins of a PC parallel port. The rows are driven using the other eight output lines from the parallel port so that any combination of rows can be high at any one time.

This is it for the hardware - everything else is done in software. For this project I have written the test software in Microsoft QuickBASIC 4.5 but have ported the code to C++ so that it can run well on most architectures. Because only one column is grounded at any given time, I had to rely on persistence-of-vision to make it appear that all columns are lit when needed. This is accomplished by looping through all of the columns very rapidly and setting the output on the rows as necessary when the proper column is grounded. This results in a fairly smooth looking picture without too much flicker. The most common application for this sort of sign was the first program that I wrote for it - displaying a scrolling message. Due to the limits on the width (approximately 2.5 characters) scrolling is required to display all but the shortest messages. The software for this is quite simple - just an array to hold all of the row values (I developed a simple font that converts characters to the correct row values) that gets output to the display. When it comes time to scroll, simply rotate the array so that position 1 of the array corresponds with the first column on the display.

Sourcecode (QB)

Schematic - I cannot find the schematic that I based mine on that I was going to post here, and I haven't yet drawn one for what I built - I'll try to make this link useful soon...

No comments: