Ingenious chap required

Thread Starter

ian.blue

Joined Jul 12, 2011
31
I have made up a very simple circuit to delay an LED from switching off.
I would enclose the circuit but can't see any (attach).
When the switch is on 12 volts feeds in to a capacitor through a small resistor and also connects to the base of an NPN transistor through a second resistor. The transistor switches the LED.
When the switch is turned off the cap continues to feed into the transistor thereby maintaining the LED.
Only one problem....the light slowly dies away.
I want the light to snap off when the time elapses.
I could employ a relay to achieve this but is there a solid state solution?
 

Sparky49

Joined Jul 16, 2011
833
First of all - nice circuit!

The reason the LED 'dies away' is that the capacitor does mantain all it's charge until the last moment - if it did, then the LED would simply 'snap off'.

I've drawn a simple graph to show what I mean.

A simple way to snap off would be to use an integrated circuit (think of a chip), called a 555 timer. Although it needs a few more components to function, it should snap off the LED. What's more, you can easily change the time you want the LED to remain on for.

Without going into too much detail, a 555 timer can be wired into three major confiurations. One is called bi-stable. Another astable. And another called monostable.

Astable means the 555 timer switches its output on and then off again, repeatedly. Think of a metronome, on, off, on, off, 1, 2, 1, 2, and so on...

Monostable mode is when the timer is switched on by an input ( in this case your switch) and the output switches on (goes high). The 555 timer uses a capacitor and a resistor to time how long it should remain high, and when it has finished, it goes low. In other words, it switches off.

Connect your LED and it too will snap off.

Type monostable 555 timer circuit into google images for a circuit. I really recommend the book IC 555 Projects by E.A. Parr. You can get it from Maplins for a fiver.

If you want some clarification, or more help, just ask!:)
 

Attachments

someonesdad

Joined Jul 7, 2009
1,583
Excellent answer, Sparky49! The only thing I'd add is the capacitor equation Q = CV, which shows that if you remove charge from a capacitor, the voltage on the capacitor drops. Since the current flowing into the base of the transistor is removing this charge from the capacitor continuously, it's the reason the LED dims slowly (because the transistor's base current is dropping, causing the collector/emitter current to also drop).

And, kudos on using simple hand-drawn diagrams. They're the mainstay of all engineers and scientists. I can generate a hand-drawn sketch faster than I can find the fancy drawing program on the computer... :p Then all I have to do is take a photo of it like you did. Good job!
 

Sparky49

Joined Jul 16, 2011
833
Thanks - they're done on paint.

Fortunately I have a cheap tablet to use, from when my dad worked away and I needed help with my maths! much easier to use a tablet to write with!

A picture is worth a thousand words - I always look at the diagrams and pictures in a book before I read the words. Something pleasing to the eye and to break up text makes the learning so much easier to concentrate on.:)
 

Thread Starter

ian.blue

Joined Jul 12, 2011
31
Thanks Sparky,
Would this circuit be ok ie.
When the trigger is closed which may be several minutes my LED would be constantly lit and when the trigger is released the led would remain on till the set time has lapsed. The timer would then automatically reset.
Thats exactly how the circuit works with the one transistor.
 

Attachments

Sparky49

Joined Jul 16, 2011
833
It would work, but it could be simpler for you.

I've attached a rough idea, ie i haven't put any values in. If pin 4, called the reset, is always attached to the 9v, then you don't have to worry about resetting it every few seconds.

Sw 1, the switch is effectively the input, when it is pressed, pin 2 goes low triggering the timing. R2 and C1 work together to give the 555 timer something to time with, their values will affect how long the LED remains on. It's easier to do it with resistors. Making R2 bigger will lengthen the amount of time the LED stays on, whilst making it smaller will do the inverse.

If you use a variable resistor, you can easily change the resistance by simply turning a knob, so you can see how it affects the circuit far quicker and easier, but that's another experiment for you.:)

R3 simply protects the LED (D1) from burning out.
 

Attachments

Sparky49

Joined Jul 16, 2011
833
I've drawn a quick sketch to show you what happens in that 555 timer.

You can see that it begins counting as soon as the switch is released. If it set to time for 5 seconds, then it will tie for 5 seconds after that point.

Overall, the LED will light for the amount of time you hold the switch down and the amount of time it times. If it times for five seconds, and you hold the switch down for two seconds, then the LED will remain on for seven seconds.

Even if you hold the switch down for longer than five seconds, it will still light. Hold the switch for ten seconds, and it will time five seconds from the point you let go.

However, it can be triggered whilst it is counting, as seen in the bottom half of the picture. It simply times from the point you open the switch.

E.g. if you hold the switch down for 1 second, then again 3 seconds later for another second, the LED will remain on for 10 seconds.

1+3+1+5=10
 

Attachments

Thread Starter

ian.blue

Joined Jul 12, 2011
31
Thank you Sparky, thats what I was looking for...Now we're cooking with gas!
Good show, excellent information.
Looks very much as if you've got it cracked

Thanks again I will start experimenting right away.
 

PeeSeeBee

Joined Jun 17, 2011
56
Another method is to use an op amp as a comparator.

In the attached circuit, when S1 is closed, the output of the op amp is low as the non-inverting input is at 0.5v, and the inverting input is at 6v, so the LED lights.

When the switch is opened, the voltage on the non-inverting input gradually rises as Ct slowly charges through Rt + the 1k resistor. When the non-inverting voltage rises above 6v the output of the op amp will go high, switching off the LED.

According to Yenka, with the values of Rt & Ct shown, the delay will be 15 seconds. With Rt = 10k, the delay was 7 seconds, and with Rt = 100k the delay was 69 seconds.

You don't say how long you want the delay to be, but if you want to play about with the delay time you could replace Rt with a trimmer (say 200k).
 

Attachments

KJ6EAD

Joined Apr 30, 2011
1,581
Of course, it works. I wouldn't put up a faulty demo. R1=100Ω, R2=10kΩ, R3=390Ω for a red LED and C1=1µF for an on time of ≈10mS. For ≈100mS on time make R2=100kΩ.
 

PeeSeeBee

Joined Jun 17, 2011
56
Of course, it works. I wouldn't put up a faulty demo. R1=100Ω, R2=10kΩ, R3=390Ω for a red LED and C1=1µF for an on time of ≈10mS. For ≈100mS on time make R2=100kΩ.
The OP wanted the LED to stay on while the switch was ON. That circuit doesn't do that.

Is there a way to get that simulator to run in real-time?
 

KJ6EAD

Joined Apr 30, 2011
1,581
The OP wanted the LED to stay on while the switch was ON. That circuit doesn't do that.

Is there a way to get that simulator to run in real-time?
I see the problem. I was just demonstrating Sparky's circuit and didn't notice that it's not just a simple one shot.

I don't know what the simulator's clock synchronizes to but I can get it close to real time by changing the timestep to 2m in the options menu.
 

PeeSeeBee

Joined Jun 17, 2011
56
I see the problem. I was just demonstrating Sparky's circuit and didn't notice that it's not just a simple one shot.

I don't know what the simulator's clock synchronizes to but I can get it close to real time by changing the timestep to 2m in the options menu.
Yep. 2m seems to work. Strange thing is, I've just tried my circuit in the simulator & had to set the time step to 0.6m to get it to run in real time.

Click on the switch to turn on the LED. 15 seconds after the switch is opened the LED goes out.

btw...the capacitor is 1000uF. The simulator changes the notation to 1 milli-Farad (1mF).

http://www.falstad.com/circuit/#%24+1+6.0E-4+10.20027730826997+50+5.0+43%0Aa+224+240+352+240+0+12.0+0.0+1000000.0%0Aw+224+224+192+224+0%0Aw+224+256+128+256+0%0Ar+192+224+192+32+0+10000.0%0Ar+192+224+192+432+0+10000.0%0Ar+128+256+128+32+0+22000.0%0Ar+128+256+128+320+0+1000.0%0Ac+128+320+128+432+0+0.0010+9.11214325193346%0Aw+128+320+48+320+0%0Aw+128+432+48+432+0%0As+48+320+48+432+0+1+false%0Aw+352+240+416+240+0%0Aw+128+32+192+32+0%0Aw+128+432+192+432+0%0Ar+416+240+416+128+0+470.0%0Aw+192+32+416+32+0%0A162+416+32+416+128+1+2.1024259+1.0+0.0+0.0%0Aw+416+32+544+32+0%0Aw+192+432+544+432+0%0AR+544+32+608+32+0+0+40.0+12.0+0.0+0.0+0.5%0AR+544+432+608+432+0+0+40.0+0.0+0.0+0.0+0.5%0A
 
Last edited:

PeeSeeBee

Joined Jun 17, 2011
56
I like your circuit for this. I hope you don't mind that I tightened it up a little and reduced the LED current below 20mA. I also labeled the op amp as the ubiquitous 741.

The speed approximates real time when the simulation speed is set to the middle of it's range and the timestep is at 2mS.

http://www.falstad.com/circuit/#$+1...+Second+Off+Delay x+376+245+397+248+0+12+741
Yep. Looks good.

I noticed that the LED current was a bit high on my simulation. I think this was due to the output voltage that I specified for the op amp (0 to 12v). I wasn't sure what the actual minimum was for the 741, so I chose 0v. Depending on the load, I think a 741's output swing may be a couple of volts within the supply lines.

When I did the simulation in Yenka, the LED current using 470Ω was only 14.85mA, although in Yenka you actually choose a 741, rather than a generic op amp.

Still, better to be safe than sorry when building the circuit for real.

Still trying to work out the correlation between time step, current speed, & simulation speed. This is the first time I have used that simulation website. I never knew it existed until I saw your earlier post.
 
Top