In the magazine "Kitplanes," a guy named Jim Weir writes a column on all sorts of electrical topics, from basic concepts to DIY projects. One of the tasks he tackles is building your own LED lighting kit for significantly less than you can buy one. Naturally, I was impressed, and after purchasing the components listed, I built the circuits in their entirety on a breadboard and plugged them in. Unfortunately, nothing happened. I started taking the circuit apart and focusing on individual components, making sure they worked as I thought they should. The only part that wasn't working was the part of the circuit that caused the strobes to.... well.... strobe. I sent email after email to several of Jim's email addresses, and email after email to the contact address for the magazine. After a couple of months of no response from anyone, I decided to give up on the strobe circuit as published.
My solution was to digitize. I've been playing around with Arduino at work, and decided to see what I could accomplish here.
The LEDs I'm using are made by LEDEngin. The strobe part numbers are LZ1-00R102 (red), LZ1-00G102 (green), and LZ1-00CW102 (white). I'm running these at 800mA, which isn't quite as bright as they can be, but should keep them from burning out for at least a decade. The landing light part number is LZ9-00CW00.
So, the difficulty is in powering these guys. That part of the circuit I went ahead and borrowed from Jim. Basically, you use a transistor and a resistor wired up as a current limiting circuit. To tune the current, you adjust the resistor.
Now, for the landing light, that's it. Case closed. Toss a switch in there and all the heat shrink and wire loom you can find, and then cover the whole thing over with electrical tape and dunk it in that Plasti-Dip stuff for good measure. (Pretty sure that's not how the Designated Airworthiness Representative wants to see your electrical work done.) The strobes still need some work, though, and for that we turn to a tiny electronic arachnid called an ATTINY85.
The AT-Tiny-85 is programmed with the Arduino IDE. Arduino borrows heavily from C++, but it's so well documented that even a complete ape like me can copypasta (that's internet lingo for copy and paste) and make things work. The ATTINY85 has 8 pins, but we only need 3 - one for each strobe. The ATTINY85 puts out 5v, which is plenty for our LEDs, but it only sends a measly 40mA per pin. That's not enough to light our LED, but it *is* enough to trigger a Darlington transistor... which is exactly what we'll do.
A transistor can act like an electronic switch - voltage won't flow across two pins, unless voltage is applied to the third pin. A Darlington transistor is akin to two transistors paired in order to handle large amounts of power, while being switched by just a little bit. In our case, we're controlling 800mA at 12v by applying >40mA at 5v. This means that not only can we turn our LEDs on and off electronically, but we can write code for any strobe pattern or brightness (by using Pulse Width Modulation) and upload it to the chip, rather than swapping analog electronic components for different timing or brightness. What's more, we can control each LED on its own pin, so they can be independently programmed, but they're all running from the same chip, so they can be synced perfectly if we so desire. And we do so desire.
So, in the end, I spent >$150 for everything, including lenses and having the PCB printed and shipped to me. That's pretty stinking good, considering these lights are significantly brighter than what's on the old Cessna 172 I learned to fly in. Total power consumption is >5 amps, which is significantly less than what the old Cessna draws for its dim lights. This may not be the best solution, but it is *a* solution, and I'm pretty happy with it.
In the spirit of sharing, I've added the board and parts list below, and the board can be ordered at https://oshpark.com/shared_projects/6PehzB0Z .
*edited March 29,2017: Turns out the board isn't quite right... Upon population, the landing lights worked just fine, but the strobes weren't working at all. I'll link to the new board once I figure out what's wrong and fix it...
Parts list:
1x LEDEngin LZ1-00R102
1x LEDEngin LZ1-00G102
1x LEDEngin LZ1-00CW102
1x LEDEngin LZ9-00CW00
1x ATTINY85
3x 2 watt 1.5 ohm Resistors
3x 2 watt 1.8 ohm Resistors
3x 1/4 watt 1k ohm Resistors
6x LM317 Transistors
3x BDX33C Transistors (TIP-120s will work just as well)
You'll also need a way to program the ATTINY85. I use the AVR USB programmer from SparkFun. The code in its entirety can be copypasta'd from below:
_________________________________________________________________________________
/*
LED_Flashers_Rev_3
Designed for a homebuilt airplane's LED strobe lights using an
ATTINY85 chip. This code will flash the LEDs 10 times in 800ms,
then leave them off for 800ms.
modified March 15, 2017
by Matt Quimby
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(0, OUTPUT);
pinMode(1, OUTPUT);
pinMode(2, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
for(int i = 0; i < 10; i++) // using a "For Loop," int = integer, used as a counter to count "i." Starts by assigning a value of 0 to "i," and states that the bracketed code should loop if it reads "i" to be less than 10. "i++" tells the counter to add 1 to "i" each time the sequence is run.
{
digitalWrite(0, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(1, HIGH);
digitalWrite(2, HIGH);
delay(40); // wait for 40 milliseconds
digitalWrite(0, LOW); // turn the LED off
digitalWrite(1, LOW);
digitalWrite(2, LOW);
delay(40); // wait for 40 milliseconds
} // completes the inner loop
delay(800); // wait for 800 milliseconds
} // completes the outer loop and starts from the "void loop" again
_________________________________________________________________________________
And the board: (2.51" x 2.61")
And finally, the followiing is how I spent my afternoon and evening.
No comments:
Post a Comment