A trinket for me

I’m redoing my holiday roof outline lights that I’ve had for a long time. The current lights are made with four commercial strands of lights – red, green, blue, and white – wrapped into a single cable. They are driven by a custom (of course) 68HC11-based controller. Most of the effects are simply slowly changing from one color of light to another, though it does do a bit of chaser as well. They have held up quite well, but are showing their age. I’ve considered replacing them with addressable LEDs, but the cost of 25 meters of addressable LEDs is prohibitive (the Adafruit ones I like are $25/meter in quantity, which means $625 in strips). I also thought about it a bit; there are already a bunch of flashing lights going on in my display, so the addressable ones would be wasted.  I therefore decided to go with some non-addressable RGB strips, which means the whole strip will be the same color. By default, you get only the three primary colors + combinations of them, but it is possible to dim them with PWM and get a lot more colors. Through the magic of Ebay, I found these strips, which aren’t even close to the nice ones Adafruit carries, but they only cost $2.80/meter, so I get 25 meters of them for $70.

I’ve been playing with them a bit. They seem to be constructed okay, and come with connectors (though one of my reels has two male connectors, and another has two female connectors). One of the reasons they are so cheap is that they have economized on the amount of copper in the power lines; if I drive all three lines, the only way I can get the amount of current I expect is by driving the power lines from both end of the strip. If I do that, I can get 2 amps of current into each, and pretty good brightness. If, however, I plug a second strip into the first, the second strip pulls much less current (on the order of 1 amp), which means that I’ll have to feed every strip from both ends.

This happens because of how LEDs work. LEDs always drop a specific amount of voltage, depending on their particular chemistry. Lets say, for example, that we are driving LEDs that have a 2V forward voltage, and we want to push 25 mA through each of them. We are using 12V, so that means we need a resistor that will give us 25mA through 12V – 3 x 2V = 6V. That means 240 ohms. I cheated and used this website.  Which is great, if your supply voltage is really 12V, but if we lose a volt to losses, the current drops down to 20mA, which is a pretty noticeably difference in brightness.

Which comes to construction. I have two sections of house to light; one which is about 42’, and another which is about 25’. The strips are pretty flexible, so my plan is to use their self-adhesive strips to attach them to some lengths of 1/2” conduit. I’ll do jumper wires at the end of each piece of conduit, so that I can take them apart and bundle them for storage. This should also make them fairly easy to put up and take down, and for these projects, you always have to think about how much hassle you’re willing to put up with during decorating. I’ll split them into two strips; a 30’ section on the right, and then two sections that add up to 37’ on the left.

To drive it, I don’t need a whole lot of sophistication; I need to be able to drive 3 channels PWM and enough oomph to run some animation code. Even if I have to do the PWM in code, this is a really low bar. I want to try something different, so I settle on the Adafruit Trinket:

It has the mighty ATTiny85, and can be programmed with the arduino IDE. I could have done an 8-pin DIP in my STK500 programmer, but I’ve grown used to the Arduino IDE. The Trinket is very cheap at $7.95.

To drive the RGB strip, I decided to use three MOSFETS. Looking at the trinket, I had a thought – the holes are on 0.1” centers and there’s a bit of space around them, so why not add some headers, and build a shield for it? Seems like a plan.

The circuit is drop-dead simple; a MOSFET with the gate connected to the Trinket output pin, a resistor between the gate and the grounded source, and then the drain connected to the outlet. Assuming I’ve done it right, whenever I switch the MOSFET on it will ground the LED strip and light it up.

On a recent project, I did a breadboard arduino shield, which worked, but was a whole lot of trouble, so I decided that to do a PC board for the shield, especially since I have two 5V 5Amp power supplies, I need two shields.  Since I’m doing shields, the components can’t be too thick, so the TO220 MOSFETS that I was planning on are out. It’s time to head off to Digikey, and after a couple of tries, I settle on a MOSFET that comes in a SOIC package. It’s pretty tiny. I can’t find anything in Eagle that’s the right size, so I build the package for it, and start playing around. I reduce the size of the resistors (0805), and try a few different arrangements.

After playing around with the layout for a while, I find one that works well, and then find that I’ve reversed the source and drain, so I do another iteration. I upload it to OSHPark, and get back a preview of the front and back:


Because it’s such a small board, it only costs $3.70 for three copies of the board. It’s going to be a bit of a bear to solder (look at that really tiny diode on the left side), and I’m hoping that the traces are big enough to carry the current, but at that price I can afford a couple of iterations.

So, what do you think ?