simple LED chaser brake light.. - Page 1
Forum section: electronics / projects

author: Deutoplasm
author_rank: Contributor
timestamp: June 04, 2012, 09:03:53 pm
content: Project: led chaser for boat trailer brake light. Circuit: 555 timed square wave-->integrator=sawtooth--->lm3914 in dot mode for unidirectional led cascade. Is this a reasonable solution? any suggestions? I'm trying to do this using common chip packages to ease cost. Microcontrollers are obviously overkill, and my logic designs are too complex to be worth it. Any alternatives?

author: PA0PBZ
author_rank: Super Contributor
timestamp: June 04, 2012, 09:32:30 pm
content: That will work, but I guess you want a triangle waveform and not a sawtooth.And a microcontroller being an overkill... I don't know, they are cheap and easy to use.I guess it also depends on the number of leds you want.Something else I was wondering, is it legal to use that?

author: Deutoplasm
author_rank: Contributor
timestamp: June 04, 2012, 09:43:57 pm
content: Well, I guess it would be illegal to use as a brake light on a vehicle, but in this case I want to have the lights mounted on the back of a boat trailer. It should be activated by the brake light switch, perhaps with an on/off toggle to keep it from going off while driving on the highway.The main use would be for "cool factor", plus aiding in loading the boat from the lake in low light situations. Cosmetically, I want the LED's to cascade in one direction, thus the choice of sawtooth input to the 3914. The sharp fall time would make the illumination pattern seem to go in one direction.As for the microcontroller, It would only be programmed for this one pattern, so it seems kind of a wasted potential.

author: Zero999
author_rank: Super Contributor
timestamp: June 05, 2012, 08:30:41 am
content: Quote from: Deutoplasm on June 04, 2012, 09:43:57 pmHave you researched prices?The LM3914 + 555 is far more wasteful, a simple MCU such as the PIC16F505 is much cheaper.The analogue solution is only cheaper if you don't have an MCU programmer or the knowledge and don't want to invest in it for on off project.

author: Deutoplasm
author_rank: Contributor
timestamp: June 05, 2012, 04:23:43 pm
content: Thanks for the advice, I did the research and a PIC16F505 from mouser is only $1! cool. It will be a bit more expensive with the programmer, but that's only $25 or so. I haven't used one before, but it will be a perfect opportunity to learn a new skill.

author: PA0PBZ
author_rank: Super Contributor
timestamp: June 05, 2012, 06:34:36 pm
content: Exactly, and think of all the nice patterns you can create

author: Zero999
author_rank: Super Contributor
timestamp: June 06, 2012, 01:09:44 am
content: If you're really strapped for cash, you could pick up a cheap USB programmer off ebay - I got one awhile ago but I've lost it so will just buy a new one.

author: 6502nop
author_rank: Regular Contributor
timestamp: June 07, 2012, 09:38:38 pm
content: These are known as "Larsen Scanners" (after Knight Rider producer Larsen), btw.As it turns out, I have designed a project based on these very parts. I haven't converted them over to gEDA yet, but soon. I'm also not one of those "There's a PIC for that" posters, since I typically kick it old school. I'll try to outline what I did in text, and present the pros and cons versus PICs...First, I used the 555 in astable, and fed the "tank" circuit (pin 2) triangular wave to the 3914, eliminating the need for the extra R/C integrator output. This frees the output (pin 3) for an LED to use for adjusting the sweep timing, and by playing with the duty cycle parameters, you can give the output a "slow-sweep-in, fast-snap-back" effect.Pro: None, really. Con: Admittedly, not as versatile as a PIC, but gets the job done.Next, I set the 3914 to Dot Mode, and ran the outputs to PNPs (the 3914 has active-low outputs, and are designed to be current-limited). 2N3906s are fine. These were then fed to some TIP31 NPNs, as I was driving T-194 "marker" bulbs. Since the bulbs draw about 3-400mA@12V, I played it safe and went with the TO220s. On the breadboard, they ran fine without heatsinks, not even getting warm. A thing to note: Wire the bulbs "hot" to the TIP31 collectors, and have them switch in the grounds ( +V --> Bulb --> Collector ~ Emitter --> GND). When I used the (+V --> Collector ~ Emitter --> Bulb --> GND), the bulb wouldn't light fast enough. The TIP31s switch GND faster than V+.Pros: None, as you'll need to do this with the PIC, too. Cons: The PIC can be programmed to active-high outputs, so you won't need the PNPs, just swap in some TIP120 Darlingtons.If you use the regular 555, it can run up to 16V on the V+. The CMOS is 15V, but operates up to a few MHz. Since this is faster than we need, a standard 555 works fine. The 3914 operates up to 18V (and can sustain peaks of 25V), which make using both the 555 and 3914 combo almost perfect for automotive use. However, you may still want to use a fixed regulator to supply the chips, as any variance on voltage will pass through to the charge tank of the 555 and affect the waveform output. A simple 7809 should do. DO NOT regulate the V+ to the bulbs or transistors! About 100-150mA will be drawn by the chips, so a non-sinked TO220 will work here, too.Pros: Can be used without Vregs, which would be required for PICs (3v3/5v). Cons: Vreg still recommended for proper operation.Overall, they're both about even. Factor in that you'll need a programmer for the PIC (~$30?), a computer to develop the sketches and program/debug with (~$100-500), and a few weeks to a few years to get the hang of programming for the particular PICs you use, then the single weekend I spent wiring up the 555/3914 saved me lots of money. Oh, and the whole shebang fits on the Radio Shack PCB that follows the breadboard layout (with matching project box)! If you run to the junkyard and grab some marker light sockets, you can mount the control box above the waterline, and seal the bulbs for trailer use.I also developed two other ways of doing this, using standard digital logic, which would require 5Vregs. Since CMOS versions of these chips are available, running off 12V is entirely possible, with no effects noted for operation. Of course, using automotive power guidelines should always apply, no matter which option you choose.QuoteExactly my point.Now, if you want to get started with PICs using this as your first project, then go for it. If you happen to have the 555/3914 chips already, then I'd stick to finishing this before using PICs.nop

author: T4P
author_rank: Super Contributor
timestamp: June 08, 2012, 03:16:38 am
content: Quote from: 6502nop on June 07, 2012, 09:38:38 pmI tried to search for the 3914 and 555 based ones, no go

author: Zero999
author_rank: Super Contributor
timestamp: June 08, 2012, 04:55:35 am
content: Quote from: 6502nop on June 07, 2012, 09:38:38 pmYou're not wrong, it's just I'd recommend in investing in learning a new skill as it'll save you money in the long run and will make it easier to get a job or tackle more complicated hobby projects.Another idea for the non-MCU option is to use flip-flops. He wants each LED to turn on one by one then all of them turn off. This could be done with an RS flip-flop for each LED. The S input could be connected to the Q output of the previous flip-flop via an RC circuit and the R inputs all connected to the final output via another RC circuit. Standard CMOS flip-flop ICs could be used or each bistable could be build with a couple of transistors.

author: TerminalJack505
author_rank: Super Contributor
timestamp: June 08, 2012, 06:20:41 am
content: Another way to do this is to use a Johnson counter. A 74HC4017 or a 4017B, for example. You can drive up to 10 LEDs with it. If you have less than 10 LEDs--6 for example--then tie Q6 to the master reset pin so only Q0 through Q5 are active. Just use a 555 timer for the clock.

author: Deutoplasm
author_rank: Contributor
timestamp: June 08, 2012, 09:10:16 pm
content: Wow! Thanks for all the feedback! I like all of the options posted so far, and being as I'm a bit of a beginner, I'll probably try all of them. The PIC is something I've been interested in for a long time now, and I'm going to try out the RS flip flop version too, just to get a hang of the logic used. Thanks 6502nop for such a detailed explanation, my final project will likely have much to do with what you recommended. This forum, and Dave's EEVBlog are proving an outstanding supplement to formal lectures. Thank you all for what you do!

author: GBarron
author_rank: Newbie
timestamp: June 09, 2012, 07:18:39 am
content: Just a thought, but I found the Arduino to be a much simpler MCU to start with rather than the PIC. You can buy the chip pre loaded without having the expense of buying/using the full Arduino UNO board. That said if you don't have one it's worth spending a few dollars on one to make it easier to prototype your circuits.If you're interested go tohttp://arduino.cc/it/Tutorial/Loopand there is the code and circuit to do what you want.As far as the board goes there are lots of examples for Arduino and lots of free libraries. I prototype my circuits with the full UNO board, which plugs straight into the USB to program. When I have the circuit exactly the way I want it I remove the chip from the board and put it straight in to my circuit with a 16MHz crystal and a couple of caps. Then I go to reliable eBay and buy a new ATMega328P with UNO loaded and put that in the UNO board. Simple.

author: Deutoplasm
author_rank: Contributor
timestamp: June 09, 2012, 08:50:34 am
content: Sounds great, but for a weekend project, I don't have Kip Kay money/time to invest in all that at once. I'll still get an arduino at some point, but for now the best i'll do is salvage parts from junk I have. Hell, I just found an LM358, A 555, butt-tonnes of resistors/caps, and a few reasonable transformers while taking apart old junk. I might just try to MacGyver this thing just to see if I can.'

author: 6502nop
author_rank: Regular Contributor
timestamp: June 09, 2012, 10:35:06 am
content: QuoteThat's because I designed my own. I haven't released it to the wild, yet. Also, just about all the scanners I've run into use the 555 as the main oscillator, running in astable mode. The differences are in what they do with the clock pulses once they leave pin 3 (or, in my case, pin 2).QuoteHeh. A funny thing just happened...Whilst looking for the schematic I used for the described 3914 circuit (to throw into gEDA), I found the box I used to hold the parts, and there was the schematic. Which had, prominently, a 555 running to a CD4017, which fed TIP120 Darlingtons, wired to the 914 bulbs.Well, crappola. I could've sworn that I used the 3914 for that one. I remember tweaking the damned thing to get the sweep right.In any event, as soon as I can, I'll post all FOUR diagrams I came up with for the "KITT kits". Two use TTL/LS/HC, the other two are the 3914 and 4017 described above. The 4017 is preferred because it has active-high outputs, which keeps the parts count low, and the full 3-15V range of CMOS (no Vreg needed).QuoteDon't get me wrong - I rather like the PIC/Arduino/MSP offerings and designs, as a quick jaunt through the SparkFun and AdaFruit sites will attest to their versatility. It's just that if Duetoplasm wants this done in time to put the boat in the water this year, the 3914/4017 (%) solution seems to be the best. Grab the parts, get the RS breadboard PCB and project box, and hack it out in a weekend. I'd also suggest a small tube of RTV (Felpro or equiv) to seal up the box once everything is working.QuoteThese forums remind me of an episode of Deep Space 9 (Valiant?), where Worf is in command of the Valiant, whose butt just got kicked by the enemy-of-the-week, and they need to technobabble their way out. O'Brien reminds Worf that he's ordering around engineers, not command officers. So, Worf (kindly) asks them, "I need a weapon... what can we build with what we still have?"What follows after that is pretty much what you see here. Ideas get thrown around, pros and cons evaluated, and the best solution is arrived at. As shown above, it looks like I scrapped the 3914 circuit for some reason (parts count? stability? I forget.) in favor of the 4017. I'll get to work on gEDA so you can try out my solutions to see which you prefer.nop

author: tom66
author_rank: Super Contributor
timestamp: June 09, 2012, 10:43:08 am
content: This bike light project got me an A in GCSE Electronics about three years ago. I used a combination of a 555 timer for light detection and a PIC for the LEDs. The program did various flashing patterns, the 555 timer acted as a delayed Schmitt trigger to avoid rapid oscillation.

author: Zero999
author_rank: Super Contributor
timestamp: June 09, 2012, 10:56:39 pm
content: Quote from: tom66 on June 09, 2012, 10:43:08 amJust one question: why the 555? Why not use an ADC input and implement the hysteresis in software? The 555 isn't necessary.

author: tom66
author_rank: Super Contributor
timestamp: June 09, 2012, 11:03:10 pm
content: Quote from: Hero999 on June 09, 2012, 10:56:39 pmOf course, but then I wouldn't have gotten the A, as it had to be more than a microcontroller project. The obvious solution is to use the PIC to do everything. Examiners don't mark you on practical or real world engineering.

author: Zero999
author_rank: Super Contributor
timestamp: June 09, 2012, 11:16:16 pm
content: Quote from: tom66 on June 09, 2012, 11:03:10 pmWhat a load of rubbish. You should of course get extra marks for making things more efficient, not have marks deducted.I would try to see if I could use a very basic MCU without any comparators or ADCs and use two inputs for the LDR, each connected to different parts of a potential divider. The hysteresis could then implemented by monitoring which input goes high/low first.

author: tom66
author_rank: Super Contributor
timestamp: June 09, 2012, 11:29:56 pm
content: Quote from: Hero999 on June 09, 2012, 11:16:16 pmBonus points awarded for doing light measurement through the LEDs...http://arduino.cc/playground/Learning/LEDSensor. Heh, I wish.That doesn't even need an ADC or LDR, so a dirt cheap PIC16F505 can be used to do everything. Total cost after LEDs would be £1.50 or so.But we had use to use PICAXE, which is a crippled version of a PIC, and it has some godawful flowchart software we had to design everything in. Because of its stupid limitations I could only fit three light flash patterns in - on a PIC16F887 with 14K flash that's ridiculous! Also the PICAXE doesn't let you change the assignment of IOs, they are fixed 8 input and fixed 8 output.

author: 6502nop
author_rank: Regular Contributor
timestamp: June 13, 2012, 08:03:53 am
content: A bit late, due in part to a 5-year-old girl that wants to clamp on to me like a tumor, now that school's out...Anyway, as promised, I'll present my circuits as separate posts with outlines. I also just realized that the OP didn't specify the type of LEDs to use. I'm assuming an auto/trailer use here, with high current bulbs (or LEDs).First up, I designed my Larsen scanner (I call 'em "KITT kits") at the request of a co-worker that happens to like the show, and happens to own a TransAm. He's also a big Airwolf fan. Thankfully, he doesn't own a Bell 222 helicopter.I came up with KITT-A, based on the 74191 counter. The 555 clocks it, the '191 counts it, and the '138 decodes it to feed the output transistors. I used a two-stage NPN design, but in hindsight, this is wasteful, as turning one on results in the other being off, so there's always one transistor drawing current. A better method is that used on KITT-D (shown later) using a PNP-to-NPN.When the '138 gets to the decoded highest count (I have it so you can jumper between 6, 7, or 8 lights), it will then trigger the '76 to flip the '191 to start counting down. Once the count hits zero, the '76 is flipped again, setting the '191 to start counting up.If you're not using HC logic, then the Vreg is required, which adds to the complexity and parts count. Also, not all Vreg precautions have been shown for automotive use - so play carefully.That method seemed impractical, so I came up with...nop

author: 6502nop
author_rank: Regular Contributor
timestamp: June 13, 2012, 08:06:21 am
content: KITT-B uses the 74193 instead of the '191. The difference is how the '193 flips between up/down modes. There are two inputs for this, /DOWN and /UP (pins 4 and 5, respectively). This is why the 7476 has been swapped out for the 7400 (I suppose the Q and /Q outputs of the 7476 could be utilized, but... meh). Operation is otherwise the same as KITT-A. I also noted on my personal notes that the 7404 inverter can be added to the outputs of the '138 and run to IRL-511 MOSFETs to trigger the bulbs. This would mean yet another IC in addition to the four (five if you have the Vreg) there.It was at this point that I decided to relegate the 74xxx chips to the 5-volt applications (adding a KITT to the front panel of your computer, for instance), and head over to CMOS land to see what I could do there...nop

author: 6502nop
author_rank: Regular Contributor
timestamp: June 13, 2012, 08:10:28 am
content: KITT-C goes full-on 12V capable, using the CMOS CD4017 counter. As mentioned earlier, it's just set as a Johnson counter, with a "loopback" of pins to create the back-and-forth sweep effect. This limits you to six lights, since four of the outputs overlap. I modified a circuit I found online, but since I hadn't thought about publishing my modifications, I have no notes as to who the original author is. I'm pretty sure it was on All Electronics Circuits, and was intended for computer use (it shows a Molex plug in the image).My only major modification was to swap the 2N2222s on the outputs to TIP-120s. Most '2222 type NPNs can only pass about 500mA, which gets a bit too close to actual current measured for the T914s I had (I measured ~330mA draw per bulb). Using TIP-120s bumps that up to about 3 Amps, enough that almost any type of automotive bulb can be used (211-2, 1156/57, 3156/57, etc.). I wouldn't advise using headlamps (it'd be freakin' awesome, though!). Of course, adjust the fuse rating to compensate for the type of bulbs used.Talking Electronics has a version of this that has diodes or resistors tied to the loopback pins to prevent any feedback into the pins they're tied into. I ran this circuit, and found it behaves rather well as presented, since (I think) the dropping resistors to the transistors absorb anything that would cause erratic behavior of the 4017. Again, my main goal was to keep the parts count low, while getting the desired function. This was the circuit I settled on for my friend.The whole thing fits perfectly, with some room to spare, on the Radio Shack PCB (276-170) and in the project box (270-1808). When using the T-914 bulbs, the TIP-120s barely get warm. The higher current 211-2 (dome light) draws about an amp, and will warm up the TIP-120, but not enough to require a heatsink. There is barely enough room for individual heatsinks, but you could make them fit if you need to do so. Since this is for automotive use, remember to secure the chips (solder them in - no sockets!) and components against vibration using electronics-safe silicone caulking (the type that smells like vinegar when curing is ano-no!). I figured the heat issue wasn't too much of a factor, as I used the TIP-120s and lower current, but bright enough, T-194 bulbs. Make sure everything works before sealing up the seams and openings of the box with RTV (Room Temp Vulcanizing, if you need to know) to prevent anything liquid getting in there.Now, I developed all these digital circuits because my original idea was to use the LM3914 driver as the primary chip. I had some issues with that (I forget what they were, exactly), and went digital. However, this thread prompted me to dig up my notes and get this sucker working...nop

author: 6502nop
author_rank: Regular Contributor
timestamp: June 13, 2012, 08:21:14 am
content: The 3914 seems to be the natural choice for the KITT kit. It can operate in "Dot" mode, has up to ten outputs, and can run from voltages up to 18V. Most automotive power systems can drop as low as 9V (really dead battery) and have as much as 14.4V when the alternator is charging (a faulty regulator can easily output over 15V, so design for worst-case scenarios!). Factor in the possibility of reverse-voltage (swapped battery cables or jump-starting) and the inherently noisy enviornment (ignition and switching spikes), and you wind up with some pretty hefty design problems. So, the wider the operating voltage and the less the current draw makes for easier work. The 555 also has, mostly, these same parameters, so it looks, at first, like a match made in heaven. Or Silicon Valley.My first design was to use the 555 in astable mode, with an integrator on the output of pin 3 to shape the square wave to a triangle. Feed this to the input of the 3914 (pin 5), and you have a sweeping effect. Or so I thought. The problem popped up when I looked at the datasheet for the 3914. The input is designed to "see" 0-1.2V, and light up one of ten LEDs based on that. Since there are ten steps, and 1.2V max, each LED represents 0.12V (it's different with the 3915/16 chips, but the range is still 0-1.2V).That wouldn't work, as the output from the integrator would ramp from 0-to-gosh-knows-what and back down. There would be a time where the voltage was out-of-range, and you'd get either a full-bar or no display. Not what we want. We (I) want a consistent range, one that will track with the 555 and the varying Vcc of the car's power. This was the point where a cup of coffee, the drone ofPhineas and Ferbin the background, and the 555's datasheet snapped on the Klieglight in my diabolical mind (Hey, Ferb! I know what I'm gonna do today!).Even when you think you know a chip, there's invariably something you don't see in the datasheet until you really, really need it. Fortunately, it was the fact that I'm looking for a better way to send a triangle wave to the 3914 that the little graph showing what the charge/discharge waveform on pin 2 of the 555 (in astable mode) looks like - a triangle! Another look at the internal block diagram shows the divider network of the 555's comparators, which is a series of three 5K resistors. That makes the waveform hover between 1/3 and 2/3 Vcc. Perfect! All we need to do is match that over on the 3914, and we solve both problems. It won't matter what the voltage is, as we're always dividing it in thirds, and we keep the waveform in that middle third.Sometimes, I just amaze myself.Now, the only problem is to get the 3914 to play nice with the 555. Another peek at the datasheet, and a familiar sight was seen in the block diagram: the same type of divider network as the 555. The "top" of the network is at pin 6 (Rhi), and the bottom is pin 4 (Rlo). In the case of the 3914, there are ten 1K resistors making up the "ladder". So, if one were to put a 10K resistor from Rhi to Vcc, and another 10K from Rlo to ground, we'd have a "Vcc --> 10K --> ladder --> 10K --> GND" configuration, and the 3914 will now track the inputs right along with the "Vcc --> 5K --> CHG/DSCHG --> 5K --> GND" of the 555's tank section. Normally, the 1.2V internal reference of the 3914 is run to the Rhi pin, and that is why the input sees just the 0-1.2V range. Another quick check of the datasheet shows the input can easily handle the full power range, so we're just going to skip the internal reference for the ladder (but not the LED current!), and use Vcc. I don't know who designed the 3914 this way, but I'd like to buy them a cup of coffee.Now, about that internal 1.2V reference: it's also used to set the output current limit for the LEDs. Putting a 1K between pins 2 and 7 allows 1.2V/1000R = 0.0012A, or 1.2mA. This is then factored by ten to get 12mA of current for the LEDs. Don't let this resistor drop too low, as the max current is about 15mA (which would be about 810 ohms - a 2K2 will give about 5.5mA). In any event, this value is why we won't need limiting resistors between the outputs and the first transistor.After a quick breadboarding, the circuit worked as expected (a first!), with the exception of the fact that my resistor's manufacturer took the whole "10% tolerance" a little to the extremes. My high LED (LED10) wouldn't light up. Swapped the 10K pair around, and now my lower (LED1) was dark. My DMM shows that one 10K is 9912 ohms, the other is right at 9997. This was enough to throw things off. I'd recommend measuring your resistors to ensure that the two you put in there are as close to 10K as you can get, and that they're matched to each other (see Dave's video on resistor testing rigs). By the way, since 1/3 of 12V is 4V, and there are ten steps, that's 0.4V per LED. A trivial bit of info, but it may help someone when trying to diagnose a problem.Lastly, we now have to drive high current bulbs from a 10mA output. An active-low output. Great. Experience has taught me that an NPN transistor likes to switch with a positive base input, and a PNP is just the opposite. So, a direct line to the 2N3906's base, a limit resistor on the collector to ground, and tie the emitter to Vcc, and we're in business. Like the 2N2222 or 2N3904 NPNs, the current capability of the TO-92 packages is about 500mA. Way too close to the T-194s, so we're going to add another stage. This time, since we now have an active-high, we'll just use some TIP-31s. This'll give you a good 3A if you want to run brighter bulbs. I didn't seem to need any base resistors on the TIP-31s, but shoving a 100R in there may be a good idea. Yes, I could've used two NPNs creatively wired up, but that would mean that one transistor would be on when the other was off, meaning that current would be flowing somewhere even when we don't need it. Sure, a couple of mA is nothing for a car, especially when there's typically 600A of reserve in the battery, but it's the principle of the thing. Using a PNP means that both transistors are either off or on. There. Much better.If you've read this far, go collect your hazard pay.For those wondering, the program used was gEDA, and I am still trying to cope with the damn thing. There's no easy way to edit components. The 555 shown has pin 2 opposite of where I need it, and the 3914 needs to shift some pins around for my particular application. There's no way to shrink overly-large devices (like those big Darlingtons) to fit, and it keeps attaching traces to points I don't want them. Those annoyances aside, I'm starting to like the (FREE!) program.Disclaimer:I avow that KITT-A, KITT-B, and KITT-D are of my own designs, and that KITT-C was modified from an online collection (somewhere!) that I modified. I also avow that anyone, anywhere, and anyhow can use and abuse these circuits as they please, provided any neat revelations, improvements, or corrections of glaring mistakes make their way back to EEV Blog or other similar online electronics sites. EEV Blog and myself are not to be held liable if this circuit violates your local laws, ordinances, or female relatives.nopNow go out and build something.

author: Deutoplasm
author_rank: Contributor
timestamp: June 14, 2012, 01:44:55 am
content: Bloody hell, what a monster my original circuit has become!Thanks! I originally was going for a simple low current led, but given this option, I might go balls out and put some kind of super bright on it. Maybe I'll incorporate 2 light levels, one for standard use, and one for blinding the piss out of those tailgating-high-beam ne'erdowells on the highway. But that would be hazardous i reckon.