A few years ago, when I finally got around to learning PIC programming, I decided to I wanted to create something that would run LED animations on a small 4x4 matrix. I liked the idea of the small 4x4 size because I was starting with a PIC 16F628A. This chip can not directly control the 16 lines necessary for an 8x8 matrix (unless you get fancy). Also the 4x4 arrangement just seemed easier to work with in terms of coming up with different patterns. And the patterns would require less memory. One frame on a 4x4 matrix is 16bits or just 2 bytes, but on an 8x8 matrix, a frame would require 8 bytes.
I also knew that I did not want to leave this on my workbench. Instead, I wanted it somewhere else in the house. Somewhere where I could see it often and where anyone visiting might notice it. To me this meant that it couldn't just be on a PC board or a breadboard (where most of my projects are). I got the idea of building a small frame with horizontal and vertical bars. These bars would be the rows and colors of the matrix, and I would solder an LED at the intersection of each one. This has worked reasonable well. The problem, I found, is that steel is not the best metal for this since it has rusted slightly and has trouble holding onto the solder. But still, it has been running for about five years. Originally it was in the dining room, but, since we moved about two years ago, it has been in the kitchen, on a small shelf. Most people don't comment on it, a few ask about it, and one thought it was reading her mind.
Once I had it had it built, I then spent a lot of time coming up with as many different animations as I could think of. This was really fun. The video shows almost all of them. Some of the animations are described in the code frame-by-frame, as you might imagine. But for others, I added code that would allow me just to list the LEDs by number that would light up in sequence. These path-style animations saved a lot of memory because instead of needing two bytes to describe a frame, I only needed half a byte to specify the next LED in the path. There are also some animations described procedurally (for lack of a better term). For these animations, each step is described as an action, such as invert frame or invert center. This method was my original plan, but I found that it was not as interesting as I envisioned, and the code for all of the procedures took up too much memory. I will talk in detail about the theory behind each of these animation styles in a later post.
One of the things you might notice in the picture of the back is the strange choice of transistors. This is what happens when you don't know what you are doing. I hope since then I've learned a little more about the difference between PNP and NPN.
Here are pictures of the front, back, and some detail. I also learned that there is a big difference between thinking of building a small square frame and actually building a frame that is square.
Also visit TheVaporTrail website and the Crossbar project page, where you can download the code and some Eagle schematics,
Very cool video! Watching it I thought it would be fun to place the matrix at the end of a tunnel of mirrors for a kind of kaleidoscope effect.
Posted by: Bruce | May 19, 2008 at 10:31 AM
I was looking at the schematic and I was wondering what the resistor values were?
Posted by: og style | May 21, 2008 at 12:06 PM
In the version I actually built (pictured above), I don't have any resistors between the PIC chip and the transistors, and used 220 ohm resistors between the 2N3904 transistors and the LED columns. This has been working great.
From what I read in the Microchip docs, they recommend 2K resistors between the PIC and the transistors, so I have been doing that in my new designs.
For the resistors between the transistors and the LED columns, you want (5v - V.led)/(I.led). If the drop (V.led) of the LED is 2v, and the current (I.led) is 20ma, then R should be 150 ohms. This is the most conservative number. Since the LEDs are multiplexed, you should be able to drive the LEDs with more current. Check the specs.
I also recommend building it on a breadboard first. Please let me know if you build it. I can post your picture here.
Good luck, David
Posted by: David | May 21, 2008 at 04:20 PM
Thanks for the info on the resistors. I am going to try to build it. I belive I have all the parts. I just have to dubble check on the transistors.
Thinks again. Nice job on it.
Posted by: OG Style | May 23, 2008 at 11:21 AM
If you have a regulated power supply, then you don't need the LM7805 or the capacitors. This is what I am using in the pictures above. Let me know if you have any questions or any problems.
Posted by: David | May 23, 2008 at 11:27 AM
I have build the frame for the led's. I was wondering if you by any chance know of a place that I can cross reference the transistors at. I used to use a site but it went down. If now that is ok, I have some that I think will work fine.
Posted by: OG Style | May 24, 2008 at 01:54 AM
The 2N3904 (on the columns) is an NPN general purpose amplifier. The 2N3906 (on the rows) is a PNP.
Posted by: David | May 24, 2008 at 11:12 PM
Well I finished it. The only problem I have is the lights don't fade out. At the start of the program the leds should follow each other on and off. Mine does not do that. I put bigger resistors in from the transistor to the columns and rows. That did not change it. The only thing I can thing of doing is changing the leds. Any ideas??
Posted by: OG Style | June 01, 2008 at 08:43 PM
Do the lights go out at all? Or do they just stay on? Do they go on in order?
Posted by: David | June 01, 2008 at 10:17 PM
They are going on/off in different patterns. They are no runing the same pattern as yours are. I have just check all my connections and rows / columns and they are all correct. I have even chaned my leds still no go.
Posted by: OG Style | June 01, 2008 at 10:24 PM
If you can send me a email I will send you a video of what it is doing.
Posted by: og style | June 01, 2008 at 11:07 PM
Here are some ideas to help figure out how we can make it work:
1. You can put a video on youtube
2. You can put some pictures on flicker
3. You can email me some pictures
4. I can make a new version of the program that firsts tests each LED, then tests each row, then tests each column.
Which do you want to try?
Posted by: david | June 01, 2008 at 11:07 PM
I can send you a video and also if it is easy I will try a test pattern. I am good with hardware but I have never figured out how to program the pic chips. Thanks for the help
Posted by: og style | June 01, 2008 at 11:09 PM
Here is the video of it in action "http://rapidshare.com/files/119468426/100_6940.MOV.html" Let me know what you think. Thanks
Posted by: OG Style | June 02, 2008 at 01:40 AM
I can't see the video. The site says that the download bandwidth is exceeded. I uploaded a version of the crossbar code that will test the LEDs. BUT I haven't tried to run it -- I hope it works! http://thevaportrail.com/projects/crossbar_led_test.zip
Posted by: David | June 02, 2008 at 10:59 PM
The download bandwith is exceeded means your IP has the max allowed for the time frame. I will up it to a different place. And I will try the test. Thanks for the help
Posted by: OG Style | June 03, 2008 at 07:37 AM
Here is what I found the Rows with the 2n3906's are on when they should be off and off when they should be on. I am using this part "http://www.radioshack.com/product/index.jsp?productId=2062585&cp="
Posted by: og style | June 03, 2008 at 09:55 AM
That's how much I don't know about transistors! I built the original with NPN instead of PNP. I uploaded a new version of the code here. I included both the LED test hex file and the regular hex file. The assembly is the same (look for the line that says "#define LED_TEST_BUILD"). -- http://thevaportrail.com/projects/crossbar_fix.zip
Posted by: David | June 03, 2008 at 10:32 AM
That made a difference. Thanks for the help. Will get pictures and video to you when I am done
Posted by: og style | June 03, 2008 at 05:34 PM
Do you have a email address I can send you pics and videos at?
Posted by: OG Style | June 05, 2008 at 12:38 AM
david-at-thevaportrail-dot-com
Posted by: David | June 05, 2008 at 12:40 AM
I sent you pics of mine last night.
Thanks for the help.
Posted by: OG Style | June 13, 2008 at 03:24 PM
hmm great
Posted by: 1$ hosting profesionalstore.com | August 15, 2008 at 11:59 PM
HELLO
VERY GOOOOOOOOD
Posted by: AKBAR MISAGHIAN | September 18, 2008 at 04:56 PM