Oct 25 2009
Halloween 2009 : Light Bar : Part 1
Or: We Need More Lights!
Last night Evelyn programmed the Peggy 2 board with a couple of Halloween images. Our neighbors (with kids) were outside, and it quickly got their attention. Six hundred and twenty five LEDs have a way of doing that.
Our garage is looking a little dim, so I decided to make a light bar for it. The idea is to suspend a line of lights across the top of the door. They will then bathe the door with computer controlled light.
I was going through the different colors of 10mm LEDs we have on hand, and again went back to the Blue and Green. Both of these colors are far brighter than the Reds and Pinks we have, and they give a nice gloomy color. I would have preferred more blood-like, but need to go for luminosity instead.
First thing I did was take an 8 foot 1×2 and drill holes every 6 inches. (Our garage door is 8′ wide.) This resulted in 15 holes in total. Then I inserted 10 mm LEDs into the holes, alternating colors. (If I had bright Red, I would have done RGB. In this case, only GB.)
Once the LEDs were firmly in the holes, I put in a dab of silicon caulk (for some water resistance), and then filled in the rest with construction adhesive (PowerGrab).
Then came the wiring. The Allegro A6276 LED driver we are using “sinks” current. So you have one common “positive” and then each LEDs cathode goes to a pin on the driver chip. This particular chip can handle 16 LEDs, and can daisy chain. This makes it a great chip for driving lots of LEDs independently.
The bundle of wires runs down the 1×2, meeting at one end:
In the above photo you can see the common positive wire (red). It’s connected to every LEDs anode. Then each of the 15 LEDs gets its own blue wire (negative/cathode).
At the end, all of the wires meet, at the A6276 LED driver:
There are four sets of four Molex connectors (toward the left). The driver is in the middle. Toward the top right is the common anode (positive) connection, and the lower right is where the power goes.
How does the Allegro A6276 LED driver work? Well, you really need to connect it to a microcontroller (MCU), such as the Arduino. You “tell” the driver what to light via a Data, Clock, and Latch line.
Now at first this may seem like more trouble than it’s worth — why not just tie each LED to a pin on my MCU and be done with it? Well, here are a couple of reasons why you should use LED driver chips:
- The A6276 driver is a constant current source. Current is EXTREMELY important with LEDS — too much and you will blow them. Most LEDs need 20 mA or less. A constant current driver means you need ONE resistor for everything. None of the “resistor for each LED” drag.
- It runs on a 5V supply, so you can power everything directly from the Arduino 5V rail.
- The driver has serial out, so you can daisy chain.
- You can drive 16 LEDs with only THREE data lines on your Arduino — without any fancy multiplexing (like Charlieplexing). Save your pins for other stuff!
- The driver can support up to 90 mA continuous per output — so you can driver brighter/bigger LEDs.
- You can separate your driver chip from the MCU — and only need three wires (plus two power) to connect them. This is great for big displays.
- It makes wiring dead simple.
If you need to individually control a number of LEDs, I highly recommend that you check out these kinds of chips. We’ve tried just about every technique, and this is, by far, the easiest and least aggravating method. All of our new designs use these kinds of LED driver chips. Save yourself a lot of frustration and drop the $3 for the driver. (Newark stocks them.)
A couple of hints on using LED driver chips:
- They either “source” or “sink”. If they source, then you have individual anodes (positive) and a common cathode (negative). If they sink, then you have a common anode (positive), and individual cathodes (negative). The wiring is the same, just think about which LED pin you are connecting to the chip. For the Allegro A6276 you tie the LED’s cathode (negative) to the control pin on the driver chip.
- The LED current resistor is based on the DRIVER CHIP’S CALCULATION. It is NOT based on the the LED’s typical drop resistor. This is VERY important to keep in mind. An example: If you were using a standard 20 mA LED with a 9V source, you’d want a drop resistor in the range of 450 ohms. However, the A6276 does NOT use that standard drop resistor calculation. You must use its calculation, which is roughly: mA = 18 / resistance. So, a 1K resistor would give you about 18 mA, which is okay for your LEDs. This is what was blowing all of our LEDs with the first version: We used a regular drop calc, which resulted in the driver providing us over 80 mA — which blew the LEDs.
- ALL of your LEDs tied to a given driver chip must be able to handle the same current range. DO NOT mix 100 mA LEDs with 20 mA LEDs unless you plan to drive everything at 20 mA. If you need to run big current LEDs along with lower current, then use TWO driver chips. One would handle the low current LEDs, the other the high current LEDs.
Hopefully these hints on using driver chips will prevent some frustration.
They are great chips and save a lot of time — once you know how to use them.
Now that the driver chip is all connected, we just need to test it out with the Arduino. Again, what is cool about the driver is that it can be part of the light bar (which will be outside, but protected from rain), and the Arduino can sit safely inside the garage. The two get connected with 5 wires (3 data related and 2 power).








