week 10: output devices

this week i wanted to use a few high-brightness LEDs to make a proof-of-concept test for my lightsaber blade. there are two options for the blade. the first is to use one very high-brightness LED and a parabolic reflector to make the blade. the plus side to this is simplicity: controlling one LED takes very little power and is extremely easy to manipulate. the downside, though, is the mechanical difficulty--getting the reflective blade right would be a challenge, and machining a parabolic reflector for the LED would be quite difficult. i could always buy one, but that would get expensive. the other issue is blade continuity--the light would dim along the blade and be brightest at the bottom, which isn't really ideal.
there is, however, a second option, which is what i wanted to check out this week: a parallel LED ladder. this is more difficult to control since it'll draw at least half an amp of current (and more likely a full amp--50 LEDs in parallel each needing about 20 mA for maximum brightness means a current draw of one amp), but gives much more consistent lighting throughout the blade with much less mechanical complexity.

board design

i again used the attiny44--even though i didn't need very many i/o pins, i thought it would be a good idea to use the 44 instead of the 45 for future development (more outputs for sound, inputs for sensors, etc.). the board i designed was simple: i connected one pwm-enabled pin of the microcontroller to the gate of a mosfet and used that mosfet as a simple driver for a ladder of ~10 LEDs. i used an inventory nfet rated for up to 30 volts and 1.7 A, figuring that since i would use at most 1 A in practice it wouldn't even get close to its maximums. my schematic is below; i ended up having to change the protective resistor value since i decided to use a 9V battery for power rather than the 6V i originally planned on (also several interesting things happened during testing, but that's a story for a bit later).


milling and stuffing

i again had issues milling this week. the bed wasn't completely flat on my first mill, and the endmill ending up cutting very deeply on one side of the board. no serious problem there, but the board had LOTS of burrs. a little gojo and some patience with tweezers cleaned it right up, though. stuffing went perfectly smoothly, and once i rinsed the flux off and dried the board i figured it was time for some testing. the protective resistor i used for the first go was a 499-ohm resistor: given a 9V source on the drain of the FET, i figured that no more than about 1A should be drawn through the transistor even when pulled fully on with 5V at the gate. apparently i was very wrong about this, because the FET exploded in a lovely puff of smoke.


so, i tried again. i decided to just remill the board since it hadn't come out that well the first time and repairing the obliterated traces would have been a bit of a nightmare. the board came out much better this time--i must have found a flatter spot on the bed. after i stuffed it i checked very carefully for shorts; i didn't find any but decided to use the lab power supply instead of a 9V battery so that i could limit the current draw to half an amp. i also increased the protective resistor to 1000 ohms, just in case.
this worked out MUCH better. no transistors exploded, nothing got hot. i was unsure as to whether or not i was reading the power supply correctly because it only ever showed a current draw of 1mA, which was obviously not enough to turn the LEDs on with the brightness it achieved. regardless, neither the transistor nor the LEDs exploded, so that was a good sign.


programming

by the time i got to getting any programming done (the pull-up resistors in the attiny44 were turned on by default, so the FET was on even when the microcontroller was unprogrammed) i was running short on time, so i just uploaded the "fade" example and tested it out on both a single LED and a short LED ladder. it looks like i'll need to mess around with current control circuitry a bit to get the LEDs bright enough, but for now this is a good result.