push button LED light with modes

Hi,

I'd like to build a LED circuit. I have a very basic knowledge of electronics, components, etc.

I'd like to use a momentary push button, perhaps a small tactile switch.

The circuit would light the LED. Another press would cause it to flash. And a final press of the switch would shut off the light.

I've looked around for a circuit like this but I can't seem to find anything! I can find all kinds of flip-flops and oscillators and astable multi-vibrators. But again that's just one of the "modes" I would like to have.

Can something like this be done simply without getting into programmable chips? I don't have programming gear. If I can build it with timer ICs or logic ICs, that would be great!

Thanks, in advance. Blake

Reply to
blakesphere
Loading thread data ...

Clock a '1" into a shift register, use the first output to switch the led, the second together with a 555 chip to pulse the led, and connect the 3rd output to the reset of the shift register.

Reply to
Sjouke Burry

Go to the store, and buy any of a number of bicycle lights. They all seem to have the ability to go between always on and flashing. You can get tiny ones that run off button cells (which are great pocket flashlights but have a tendency to go on too easily when something in your pocket touches the button) to full blown headlights.

The first LED flashlight I bought was a bicycle headlight, about 5 years ago. I was curious, and at ten dollars it was cheaper than LED flashlights of equivalent power. Worked fine, but gave it away to someone with an actual bike.

The trouble was that as a source of light, you rarely need flashing. It can become a bother to have to cycle through the modes to turn it off. Better to ask how to modify one to avoid the flashing mode.

When I bought that first LED bicycle light, people were still going on in this newsgroup about making LED flashlights. By now, there's really no good reason to make one, you can surely get one cheaper than buying the parts. You will have to buy the white LEDs, unless you buy a cheap LED flashlight to take the LEDs out of. And once you are buying in order to get cheap LEDs, there's little reason to build. At the very most, buy a commercial LED bike light, and put it in the package of your own making.

Michael

Reply to
Michael Black

On Sun, 22 Feb 2009 15:56:43 -0800, blakesphere wrote:

See the appended LTSpice model for a general idea (note that most part numbers and values were pulled out of thin air).

Anything that can be built with a microcontroller can also be built out of discrete logic. But the microcontroller approach will almost invariably be simpler.

Version 4 SHEET 1 2820 900 WIRE -640 -32 -768 -32 WIRE -496 -32 -640 -32 WIRE 960 -32 -496 -32 WIRE 1376 -32 960 -32 WIRE 1888 -32 1376 -32 WIRE -640 32 -640 -32 WIRE -496 32 -496 -32 WIRE 1600 64 544 64 WIRE 64 128 -112 128 WIRE 384 128 336 128 WIRE 704 128 656 128 WIRE 336 144 336 128 WIRE 656 144 656 128 WIRE 64 176 64 128 WIRE 384 176 384 128 WIRE 704 176 704 128 WIRE 1888 176 1888 -32 WIRE 1600 192 1600 64 WIRE 1632 192 1600 192 WIRE 2304 192 2224 192 WIRE -16 224 -176 224 WIRE 304 224 144 224 WIRE 624 224 464 224 WIRE 864 224 784 224 WIRE 1504 224 864 224 WIRE 1632 224 1600 224 WIRE 1824 224 1696 224 WIRE 2304 224 2304 192 WIRE 1504 256 1440 256 WIRE 1600 256 1600 224 WIRE 1600 256 1568 256 WIRE -16 272 -48 272 WIRE 304 272 272 272 WIRE 544 272 544 64 WIRE 544 272 480 272 WIRE 624 272 592 272 WIRE 960 288 960 -32 WIRE -768 352 -768 -32 WIRE 64 352 64 320 WIRE 2304 352 2304 304 WIRE -640 384 -640 112 WIRE -352 384 -640 384 WIRE -112 384 -112 128 WIRE -112 384 -288 384 WIRE 384 384 384 320 WIRE 384 384 -112 384 WIRE 704 384 704 320 WIRE 704 384 384 384 WIRE 1888 416 1888 272 WIRE 960 448 960 368 WIRE 1056 448 960 448 WIRE 1376 448 1376 -32 WIRE 1376 448 1344 448 WIRE -496 480 -496 112 WIRE -352 480 -496 480 WIRE -48 480 -48 272 WIRE -48 480 -288 480 WIRE 272 480 272 272 WIRE 272 480 -48 480 WIRE 592 480 592 272 WIRE 592 480 272 480 WIRE 2208 480 2112 480 WIRE 2528 480 2432 480 WIRE 960 496 960 448 WIRE 1376 512 1376 448 WIRE 1376 512 1344 512 WIRE -176 544 -176 224 WIRE 864 544 864 224 WIRE 864 544 -176 544 WIRE 2208 544 2112 544 WIRE 2528 544 2432 544 WIRE 1056 576 1024 576 WIRE 1440 576 1440 256 WIRE 1440 576 1344 576 WIRE -640 592 -640 384 WIRE -496 608 -496 480 WIRE 2208 608 2112 608 WIRE 2528 608 2432 608 WIRE -400 624 -448 624 WIRE 960 640 960 576 WIRE 1024 640 1024 576 WIRE 1024 640 960 640 WIRE 1056 640 1024 640 WIRE 1440 640 1344 640 WIRE 1888 656 1888 496 WIRE -384 672 -448 672 WIRE 2208 672 2112 672 WIRE -384 704 -384 672 WIRE 960 704 960 640 WIRE -768 832 -768 432 WIRE -640 832 -640 656 WIRE -640 832 -768 832 WIRE -496 832 -496 688 WIRE -496 832 -640 832 WIRE 960 832 960 768 WIRE 960 832 -496 832 WIRE 1440 832 1440 640 WIRE 1440 832 960 832 WIRE 1888 832 1888 720 WIRE 1888 832 1440 832 WIRE -768 880 -768 832 FLAG -768 880 0 FLAG 64 352 0 FLAG 336 144 0 FLAG 656 144 0 FLAG -400 624 Push IOPIN -400 624 In FLAG 2224 192 Push IOPIN 2224 192 Out FLAG 1344 576 Out IOPIN 1344 576 BiDir FLAG 1056 448 Dis IOPIN 1056 448 BiDir FLAG 1056 576 Trig IOPIN 1056 576 BiDir FLAG 1056 640 Thr IOPIN 1056 640 BiDir FLAG 1344 640 Gnd IOPIN 1344 640 BiDir FLAG 1344 512 Rst IOPIN 1344 512 BiDir FLAG 1344 448 Vcc IOPIN 1344 448 BiDir FLAG 2528 544 Dis IOPIN 2528 544 BiDir FLAG 2112 544 Trig IOPIN 2112 544 BiDir FLAG 2528 608 Thr IOPIN 2528 608 BiDir FLAG 2112 672 Rst IOPIN 2112 672 BiDir FLAG 2112 608 Out IOPIN 2112 608 BiDir FLAG 2112 480 Gnd IOPIN 2112 480 BiDir FLAG 2528 480 Vcc IOPIN 2528 480 BiDir FLAG 2304 352 0 FLAG -384 704 0 SYMBOL Digital\\\\dflop 64 176 R0 SYMATTR InstName A1 SYMATTR SpiceLine Td=10n tripdt=10n trise=30n vhigh=5 SYMBOL Digital\\\\dflop 384 176 R0 SYMATTR InstName A2 SYMATTR SpiceLine Td=10n tripdt=10n trise=30n vhigh=5 SYMBOL Digital\\\\dflop 704 176 R0 SYMATTR InstName A3 SYMATTR SpiceLine Td=10n tripdt=10n trise=30n vhigh=5 SYMBOL cap -656 592 R0 SYMATTR InstName C1 SYMATTR Value 1µF SYMBOL res -656 16 R0 SYMATTR InstName R1 SYMATTR Value 10K SYMBOL voltage -768 336 R0 WINDOW 3 24 104 Invisible 0 WINDOW 123 0 0 Left 0 WINDOW 39 0 0 Left 0 SYMATTR InstName V1 SYMATTR Value PULSE(0V 5V 10ms 1ms 1ms) SYMBOL Digital\\\\inv -352 320 R0 SYMATTR InstName A4 SYMATTR SpiceLine Td=10n tripdt=10n trise=30n vhigh=5 SYMBOL Digital\\\\inv -352 416 R0 SYMATTR InstName A5 SYMATTR SpiceLine Td=10n tripdt=10n trise=30n vhigh=5 SYMBOL sw -496 704 R180 WINDOW 3 24 -12 Left 0 SYMATTR InstName S1 SYMATTR Value "" SYMATTR SpiceModel Switch SYMBOL res -512 16 R0 SYMATTR InstName R2 SYMATTR Value 10K SYMBOL voltage 2304 208 R0 WINDOW 3 24 104 Invisible 0 WINDOW 123 0 0 Left 0 WINDOW 39 0 0 Left 0 SYMATTR InstName V2 SYMATTR Value PULSE(0 1V 1s 1ms 1ms 0.2s 1s 6) SYMBOL Digital\\\\and 1536 176 R0 SYMATTR InstName A6 SYMATTR SpiceLine Td=10n tripdt=10n trise=30n vhigh=5 SYMBOL npn 1824 176 R0 SYMATTR InstName Q1 SYMATTR Value 2N3904 SYMBOL res 1872 400 R0 SYMATTR InstName R3 SYMATTR Value 270R SYMBOL LED 1872 656 R0 SYMATTR InstName D1 SYMATTR Value QTLP690C SYMBOL Misc\\\\NE555 2320 576 R0 SYMATTR InstName U1 SYMBOL res 944 272 R0 SYMATTR InstName R4 SYMATTR Value 10K SYMBOL res 944 480 R0 SYMATTR InstName R5 SYMATTR Value 100K SYMBOL cap 944 704 R0 SYMATTR InstName C2 SYMATTR Value 1µF SYMBOL Digital\\\\and 1664 144 R0 SYMATTR InstName A7 SYMATTR SpiceLine Td=10n tripdt=10n trise=30n vhigh=5 TEXT 2230 -72 Left 0 !.tran 10s TEXT 1952 32 Left 0 !.model Switch SW(Ron=.1 Roff=1Meg Vt=0.5 Vh=-.1) TEXT 1168 512 Left 0 ;555

Reply to
Nobody

OK. I'll look into shift registers. Thanks.

I guess I could do more states if I wanted to. With a wider register?

Say:

1 =3D steady on 2 =3D very fast flash 3 =3D medium flash 4 =3D slow flash 5 =3D off

cheers, Blake

Reply to
blakesphere

Hey, thanks for the suggestion.

I did take apart one of the white LED bicycle headlights. But the COB is covered so I have no idea how it works. It's back on the bike now...

cheers, Blake

Reply to
blakesphere

I'm sure.

But I'll need to buy more gear, get some software (I gather there's free public domain or GPL stuff), and learn how to program is these environments... So that's weeks or months down the road. If that's what I have to do, well, I guess I'll have to start learning microcontrollers. But I'm still learning discrete stuff.

I can sorta make sense of this stuff you sent. But I guess I'll need a particular application for the full visual effect...

Thanks though. Blake

Reply to
blakesphere

Do you know how to proceed towards a realistic design? (Do you understand that he was recommending using the push button as a clock input and that you may want to use a schmitt trigger gate input or some other arrangement to debounce it? Etc.)

Jon

Reply to
Jon Kirwan

It's probably worth the learning curve, long term. You can almost always get access to an assembler directly from the manufacturers (or from someone they affiliate closely with) without charge. The c compilers may require a gcc-based implementation for a free version, which may be a bit "batty" to use at times or quite good, depending. You should carefully look for debugging support before buying, as you may need this in order to move along quickly in your learning. And things may be a bit "spotty" there if you are using GNU GCC, depending on the processor.

For hobby use, the Microchip PIC parts are good because Microchip has an active forum board and there are plenty of designs around. Many of their processors are like the "transparent man" in that you get to see pretty much how a CPU is designed, when using one (people complain about just how "bad" their machine language is... but it remains a very good way to learn about cpu operation, all the same.) Atmel has some very nice parts, though I can't say that the company does well by hobbyists in terms of active support, direct from them. They like "big buyers." But their parts are nice and there are some very nice development tools available, so they are fine to work with even without a lot of hand-holding from Atmel. Texas Instruments has some very nice parts with the MSP430 line and some very cheap entry-level hardware, as well.

All of these have various peripherals. And learning how to "think" well about them will take some serious effort. You can ignore all that and just concentrate on learning about I/O pins and directly working them in software and still get a lot done without having to learn about various peripherals and how to make those work.

However, you are right. It's a learning experience. But once you get past some of the initial barriers (mental road blocks), you will rapidly find them useful for a whole range of ideas. It's an investment of time that will pay itself off entirely after just two or three projects.

Jon

Reply to
Jon Kirwan

LTSpice:

formatting link

Save the text with a .asc extension, open in LTSpice, click the "run" button to perform the simulation, then click on traces or components to view voltage/current waveforms.

Reply to
Nobody

You could have the switch (debounced) clocking a binary counter (say

74HC393), with the counter output connected to the select lines of a MUX (say 74HC151), with the last count output tied to reset the whole thing. This would cycle through your modes, allowing you to feed whatever "mode signal" you like into each channel of the MUX. e.g. first MUX input LOW (LED off), second MUX input HIGH (LED ON), 3rd MUX input say 5Hz clock (fast flash), 4th MUX input say 2Hz clock (medium) flash, etc

Dave.

Reply to
David L. Jones

Yep. just use the first unused output to reset the shiftregister. Common length 4 or 8 stages.

Reply to
Sjouke Burry

Like the man said. Debounce a switch, use the debounced output to clock a 4017. A 4017 will give you up to 10 outputs. Use each output to activate whatever function you want. Tie 5 to the reset.

See:

formatting link

It explains the 4017 pretty well, and includes a LED chaser circuit. But, since you'll use a debounced switch instead of the 4093 oscillator to clock the 4017, it will increment only when you press the switch. (You could use a 4093 in the debounce circuit if you want.)

Ed

Reply to
ehsjr

Is the pursuit the learning experience or the end result at lower cost? There are plenty of multi-mode LED drivers at

formatting link
.com or
formatting link
Worst comes to worst, order one (they're only about $4 ea.) and learn from the circuit before DIY.

Reply to
emailaddress

eme.com

Well. That's a really, really good question. :-)

I am proactively teaching myself electronics. Learning basic digital circuits now... Going slow. But I'm enjoying it.

Still, I get ideas. Things I want to do! I start wondering how things work. I think of projects I want to build. This one? Maybe I'm getting a bit ahead of myself. So, to learn it properly, I've got other things to do first.

I appreciate your suggestion though. I can always buy something prefab, if in a hurry.

cheers, Blake

Reply to
blakesphere

someone's making those chips they use in bike lights, if you could get one of them it'd be fairly simple.

Reply to
Jasen Betts

Of course, the most available source, and maybe the cheapest, is in those very lights, complete with the needed LEDs. Then one has to consider what the end goal is.

Michael

Reply to
Michael Black

It can be done with simple logic chips. There is a circuit out there for "debouncing" a pushbutton switch. Have that clock a 4017 or similar counter-divider, whose #3 output is connected to its reset pin. The 4017 will cycle through states "0", "1", and "2".

Have the "1" pin ANDed or NANDed with a squarewave oscillator. Put the output of that and the output of the 4017's "0" pin through diodes to a MOSFET gate that has a 100K resistor to ground. The MOSFET switches the LED.

I think there is a switch debounce circuit using a schmidt trigger inverter such as the 40106. The 40106 has 6 inverters in it - one of them can be used for the squarewave oscillator.

If you want to get more modes with this, you can. With the 40106, some of the inverters can be used to make oscillators at different frequencies. You may be able to use 5 of them. The 4017 has outputs "0" through "9" - ten of them. You can use up to 7 of them - on, off, and five blinking at different rates. One can have a blink rate fast enough to appear continuously on at half power.

The schmidt trigger squarewave oscillator can be modified by having the feedback resistor replaced by two in parallel, except one of those two resistors would have a diode in series with it. That will change the dury cycle of the squarewave. With a flash rate too fast to see, different duty cycles will give different brightnesses.

- Don Klipstein ( snipped-for-privacy@misty.com)

Reply to
Don Klipstein

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.