fading LED - nearly there

Trying to do a "simple" fade in and fade out of LED as I switch it on and off.

So far I have the LED working with a 9V supply, a 1000uF Cap, LED and small resistor(adjusts fade time) across cap and a resistor before the lot on the + to time the illumination. I am using variable resistors at the moment to fine tune the timing. Simple enough(?)

I have since discovered that if the power is not switched off cleanly the cap discharges and the LED just goes off. Clever me thought "simple, I'll debounce it" but now the circuit gets more complex as I need the full 9 volts for the LED circuit so I can't use the IC(used to debounce) output to power the LED.

So here are my questions.

Can the 74ls00 run directly off the 9v supply?

I obviously need a transistor setup on the output to switch on the 9v to LED circuit but what sort? Should the be a resistor pulling the base high or low when not getting a + output?

and lastly

How do I wire up the debouncer with an on/off switch? I tried a simple setup with 2 NAND gates with outputs looped back to each other but no end of probing with inputs helped me turn it on and off. A simple circuit diagram would be great, everything I seem to find is a tutorial.

Any help appreciated

Regards Macros

Reply to
stardockmagic
Loading thread data ...

On 26 Aug 2006 07:13:30 -0700, snipped-for-privacy@gmail.com wrote:

...

--- View in Courier:

+9V>---[1N4148>]-----+--------+--[100R]--+ | | | [1KR] | | | C | +------B 2N3904 |+ | E [1000µF] | | | |+ [300R] | [1000µF] | | | [LED] | | |K | GND>-----------------+--------+----------+

LTSPICE schematic list:

Version 4 SHEET 1 880 680 WIRE -64 16 -224 16 WIRE 64 16 -64 16 WIRE 96 16 64 16 WIRE 208 16 176 16 WIRE -64 80 -64 16 WIRE 64 160 64 16 WIRE 208 160 208 16 WIRE -64 208 -64 160 WIRE 0 208 -64 208 WIRE -224 304 -224 16 WIRE 64 304 64 256 WIRE -224 432 -224 368 WIRE -64 432 -64 208 WIRE 64 432 64 384 WIRE -224 560 -224 512 WIRE -64 560 -64 496 WIRE -64 560 -224 560 WIRE 64 560 64 496 WIRE 64 560 -64 560 WIRE 208 560 208 224 WIRE 208 560 64 560 WIRE -224 608 -224 560 FLAG -224 608 0 SYMBOL npn 0 160 R0 SYMATTR InstName Q1 SYMATTR Value 2N3904 SYMBOL cap -80 432 R0 WINDOW 0 -45 30 Left 0 WINDOW 3 -78 62 Left 0 SYMATTR InstName C1 SYMATTR Value 1000e-6 SYMBOL voltage -224 416 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(0 9 0 1e-3 1e-3 5 10) SYMBOL res -80 64 R0 WINDOW 0 -53 40 Left 0 WINDOW 3 -65 70 Left 0 SYMATTR InstName R1 SYMATTR Value 1000 SYMBOL res 80 400 R180 WINDOW 0 36 76 Left 0 WINDOW 3 36 40 Left 0 SYMATTR InstName R2 SYMATTR Value 300 SYMBOL diode -208 368 R180 WINDOW 0 50 33 Left 0 WINDOW 3 24 0 Left 0 SYMATTR InstName D3 SYMATTR Value 1N4148 SYMBOL cap 192 160 R0 WINDOW 0 51 30 Left 0 WINDOW 3 28 62 Left 0 SYMATTR InstName C2 SYMATTR Value 1000e-6 SYMBOL LED 48 432 R0 SYMATTR InstName D4 SYMBOL res 80 32 R270 WINDOW 0 32 56 VTop 0 WINDOW 3 0 56 VBottom 0 SYMATTR InstName R3 SYMATTR Value 100 TEXT -202 584 Left 0 !.tran 20

-- John Fields Professional Circuit Designer

Reply to
John Fields

aHH a nice simple schematic to answer everything, Thanks John. Couldn't help noticing the lack of gates for debouncing, this looks much simpler.

Shall put it together tonight and see how it goes, shall need to change atleast the 300R as the super bright blue led I am using needs only 100 or less.

One more thing, what exactly is ltspice? and is it downloadable? Could I instal it and use the list you posted with the schematic to recreate in ltspice?

Thanks again John, been looking thru' some old posts and constantly come across you helping people, well done and thank you.

Macros

John Fields wrote:

Reply to
stardockmagic

Hi John, I made the circuit as described and then tweaked a few things and altho' it is now fading out beautifully it does not illuminate slowly.

I have changed to 220uF caps as they are better for the timing and replaced some of the caps with pots to set the timing. The 100R replaced with a pot adjusts the fade time perfectly. Adjusting the 1KR doesn't seem to do anything noticable and the cap between base and ground seems to only add to the fade time, putting it in only added to the fade time.

Any further help would be great, most enjoyable playing around with some electronics again :)

Macros

Reply to
stardockmagic

oops 100uF caps not 220

snipped-for-privacy@gmail.com wrote:

Reply to
stardockmagic

--
Yes to all.  It\'s at:

http://www.linear.com/designtools/softwareRegistration.jsp

and it\'s free.
Reply to
John Fields

oops 100uF caps not 220

snipped-for-privacy@gmail.com wrote:

Reply to
stardockmagic

On 27 Aug 2006 04:03:56 -0700, snipped-for-privacy@gmail.com wrote:

--- That's odd, the way the circuit is supposed to work is that when you turn the switch ON, C2 charges to 9V (minus a diode drop) through CR1 and R2, R2 being in there to limit the charging current and give the switch a break. C1 also charges up, through R1, (after you get rid of CR1) its purpose being to cause the voltage on the base of Q1 (wired as an emitter follower) to rise slowly. Since the load is connected to the emitter the voltage across it will follow the voltage on the base, but the majority of the load current will be supplied by the collector, keeping the impedance looking into the base high. As a result of the slowly rising current into the LED, it will fade in depending largely on the time constant of R1 and C1.

When the switch is turned OFF, the battery will no longer be supplying the current for the LED, but C2 will until its charge is depleted. As its charge becomes depleted the voltage across it will fall, with the effect that the voltage on the base _and_ the collector will fall, causing the current through the LED to fall gradually, fading it out.

I think the reason it's not fading in properly is because C1 is too small. You might try increasing it to around 1000µF to see what happens.

Thinking a bit more about it, this might be a better circuit:

+9V>---+--------+--[10R]---+ |R1 | R2 | [1KR] | | | C | +------B 2N3904 C2|+ | E Q1 [4700µF] | | | C1|+ [100R]R3 | [1000µF] | | | [LED]LED1 | | |K | GND>---+--------+----------+

Note that the diode wasn't needed since when you turn the switch off it disconnects the battery from the circuit. Duh...

I'm not sure of the component values with your LED, but it simulates nicely with what's shown above.

Here's the new circuit list:

Version 4 SHEET 1 880 680 WIRE -272 16 -384 16 WIRE -64 16 -192 16 WIRE 48 16 -64 16 WIRE 208 16 128 16 WIRE -64 64 -64 16 WIRE 208 160 208 16 WIRE 208 160 64 160 WIRE -64 208 -64 144 WIRE 0 208 -64 208 WIRE 64 304 64 256 WIRE 208 304 208 160 WIRE -64 352 -64 208 WIRE -384 432 -384 16 WIRE -256 432 -256 64 WIRE 64 432 64 384 WIRE -384 560 -384 512 WIRE -256 560 -256 512 WIRE -256 560 -384 560 WIRE -208 560 -208 64 WIRE -208 560 -256 560 WIRE -64 560 -64 416 WIRE -64 560 -208 560 WIRE 64 560 64 496 WIRE 64 560 -64 560 WIRE 208 560 208 368 WIRE 208 560 64 560 WIRE -384 608 -384 560 FLAG -384 608 0 SYMBOL npn 0 160 R0 SYMATTR InstName Q1 SYMATTR Value 2N3904 SYMBOL cap -80 352 R0 WINDOW 0 -45 30 Left 0 WINDOW 3 -78 62 Left 0 SYMATTR InstName C1 SYMATTR Value 1000e-6 SYMBOL voltage -384 416 R0 WINDOW 3 24 104 Invisible 0 WINDOW 123 0 0 Left 0 WINDOW 39 0 0 Left 0 WINDOW 0 -77 57 Left 0 SYMATTR Value 9 SYMATTR InstName V1 SYMBOL res -80 48 R0 SYMATTR InstName R1 SYMATTR Value 1000 SYMBOL res 80 400 R180 WINDOW 0 36 76 Left 0 WINDOW 3 36 40 Left 0 SYMATTR InstName R2 SYMATTR Value 100 SYMBOL cap 192 304 R0 WINDOW 0 51 30 Left 0 WINDOW 3 28 62 Left 0 SYMATTR InstName C2 SYMATTR Value 4700e-6 SYMBOL LED 48 432 R0 SYMATTR InstName D4 SYMBOL res 32 32 R270 WINDOW 0 32 56 VTop 0 WINDOW 3 -9 56 VBottom 0 SYMATTR InstName R3 SYMATTR Value 1000 SYMBOL voltage -256 416 R0 WINDOW 0 -53 5 Left 0 WINDOW 3 -242 110 Invisible 0 WINDOW 123 0 0 Left 0 WINDOW 39 0 0 Left 0 SYMATTR InstName V3 SYMATTR Value PULSE(0 1 0 1E-6 1E-6 10 20) SYMBOL sw -176 16 M270 WINDOW 0 32 15 Left 0 WINDOW 3 32 44 Left 0 SYMATTR InstName S1 TEXT -202 584 Left 0 !.tran 20 TEXT -192 616 Left 0 !.model SW SW(Ron=1e-3 Roff=10Meg Vt=0.5Vh=0)

-- John Fields Professional Circuit Designer

Reply to
John Fields

I'm guessing he's got the led & R3 on the collector side.

Ed

Reply to
ehsjr

Shorted transistor actually, but connected wrong way was just as likely.

Macros

Reply to
stardockmagic

Still trying to get this thing working, easy job my arse.

If any one is still willing to help me I now have the specs for the LEDs I will be using.

Forward voltage =3D 3.1 - 3.4 Current 20mA Peak pulse forward current 150mA reverse voltage 5v power disipation 80mW

Working on a 9 volt battery there will be 3 LEDs wired in parallel. I have used the calculator here

formatting link
to calculate that I need a 100 ohm resistor. Try as I might I can't get this array of LEDs to fade in and out. Could anyone figure this out in splice or something? I downloaded splice and it looks great but a bit advanced for me I think, I can't get it to simulate yet, even saving the previous lists as .app files I can open them and see the schematic, but when I try to run it I get an error."previous analysis found: .tran

20"

Deadline on this looming and everytime I think I have it it fails, gonna throw this breadboard across the room soon.

Macros

Reply to
stardockmagic

--
OK
Reply to
John Fields

Yes, yes it is :)

yes, yes it does :) now I can look into spice a bit more

just over a week to have it working then gotta fit it into an ornate staff

Macros

Reply to
stardockmagic

On 1 Sep 2006 08:54:40 -0700, snipped-for-privacy@gmail.com wrote:

--- OK.

First thing that's wrong is that calculator. You can't use a single resistor for parallel LEDs because the forward voltage will be slightly different for each one, with the one with the lowest Vf hogging the current and maybe overheating and getting destroyed.

Here's a new list:

Version 4 SHEET 1 880 696 WIRE -272 16 -384 16 WIRE -64 16 -192 16 WIRE 96 16 -64 16 WIRE 256 16 96 16 WIRE 528 16 336 16 WIRE -64 64 -64 16 WIRE 96 160 96 16 WIRE -64 208 -64 144 WIRE 32 208 -64 208 WIRE 96 272 96 256 WIRE 256 272 96 272 WIRE 416 272 256 272 WIRE 96 304 96 272 WIRE 256 304 256 272 WIRE 416 304 416 272 WIRE 528 304 528 16 WIRE -64 352 -64 208 WIRE -384 432 -384 16 WIRE -256 432 -256 64 WIRE 96 432 96 384 WIRE 256 432 256 384 WIRE 416 432 416 384 WIRE -384 560 -384 512 WIRE -256 560 -256 512 WIRE -256 560 -384 560 WIRE -208 560 -208 64 WIRE -208 560 -256 560 WIRE -64 560 -64 416 WIRE -64 560 -208 560 WIRE 96 560 96 496 WIRE 96 560 -64 560 WIRE 256 560 256 496 WIRE 256 560 96 560 WIRE 416 560 416 496 WIRE 416 560 256 560 WIRE 528 560 528 368 WIRE 528 560 416 560 WIRE -384 608 -384 560 FLAG -384 608 0 SYMBOL npn 32 160 R0 SYMATTR InstName Q1 SYMATTR Value 2N3904 SYMBOL voltage -384 416 R0 WINDOW 3 24 104 Invisible 0 WINDOW 123 0 0 Left 0 WINDOW 39 0 0 Left 0 WINDOW 0 -77 57 Left 0 SYMATTR Value 9 SYMATTR InstName V1 SYMBOL res -80 48 R0 SYMATTR InstName R1 SYMATTR Value 1000 SYMBOL res 112 400 R180 WINDOW 0 36 76 Left 0 WINDOW 3 36 40 Left 0 SYMATTR InstName R2 SYMATTR Value 240 SYMBOL res 240 32 R270 WINDOW 0 32 56 VTop 0 WINDOW 3 -9 56 VBottom 0 SYMATTR InstName R3 SYMATTR Value 10 SYMBOL voltage -256 416 R0 WINDOW 0 -53 5 Left 0 WINDOW 3 -242 110 Invisible 0 WINDOW 123 0 0 Left 0 WINDOW 39 0 0 Left 0 SYMATTR InstName V3 SYMATTR Value PULSE(0 1 0 1E-6 1E-6 10 20) SYMBOL sw -176 16 M270 WINDOW 0 32 15 Left 0 WINDOW 3 32 44 Left 0 SYMATTR InstName S1 SYMBOL LED 80 432 R0 WINDOW 0 -44 34 Left 0 WINDOW 3 -129 77 Left 0 SYMATTR InstName D1 SYMATTR Value NSPW500BS SYMBOL res 272 400 R180 WINDOW 0 36 76 Left 0 WINDOW 3 36 40 Left 0 SYMATTR InstName R4 SYMATTR Value 240 SYMBOL LED 240 432 R0 WINDOW 0 -39 34 Left 0 WINDOW 3 -129 75 Left 0 SYMATTR InstName D2 SYMATTR Value NSPW500BS SYMBOL res 432 400 R180 WINDOW 0 36 76 Left 0 WINDOW 3 36 40 Left 0 SYMATTR InstName R5 SYMATTR Value 240 SYMBOL LED 400 432 R0 WINDOW 0 -42 32 Left 0 WINDOW 3 -132 74 Left 0 SYMATTR InstName D3 SYMATTR Value NSPW500BS SYMBOL polcap -80 352 R0 WINDOW 0 -41 33 Left 0 WINDOW 3 -76 62 Left 0 SYMATTR InstName C3 SYMATTR Value 1000e-6 SYMBOL polcap 512 304 R0 WINDOW 0 45 35 Left 0 WINDOW 3 24 67 Left 0 SYMATTR InstName C1 SYMATTR Value 8600e-6 TEXT -338 592 Left 0 !.tran 20 TEXT -344 624 Left 0 !.model SW SW(Ron=1e-3 Roff=10Meg Vt=0.5Vh=0)

-- John Fields Professional Circuit Designer

Reply to
John Fields

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.