2
\$\begingroup\$

I want to create a circuit that turns on an LED when a switch is flipped and automatically turns it off after some time. I use a capacitor for the timedelay.

Because I want it to be able to be reused I need to discharge the capacitor when the switch is open again. I came up with the following:

enter image description here

I feel like it's a bad way of doing this. Is there a more elegant solution?

\$\endgroup\$
2
  • \$\begingroup\$ I reference a circuit elsewhere on this site in an answer here that may work well. You don't write much about exactly what you want -- time or type of LED, for example -- so I can't say for sure. But it targets a simple indicator LED. \$\endgroup\$ Commented Feb 14 at 21:06
  • \$\begingroup\$ Your circuit seems ok to me. The left resistor should be lower for quicker discharge. Also for that reason you can place a diode accros right resistor (anode to gnd). \$\endgroup\$ Commented Feb 15 at 0:18

2 Answers 2

1
\$\begingroup\$

There will be at least 50 different ways to do this. All varying in features and complexity. Here: is something to get started. C1 and R1 adjust timing. R2 and R3 also change timing.

This is an improvement over what you have because the timing is repeatable and you now have clean on-off and off-on transitions.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
0
\$\begingroup\$

I think in principle your circuit will work but it is not very repeatable nor flexible because the threshold of the mosfet is not well specified. And the circuit relies on a well defined threshold. Moreover, the switching of the mosfet will be relatively slow as the exponentially varying timing waveform's voltage passes through the rather wide gate voltage range of conduction. In general slow switching is to avoid as it increases power loss in the mosfet. In your particular case as indicated by your schematic it is however not of concern. If you insist put the circuit into a simulator like LTspice to have a better idea if it will cover the timing range you require.

A more reliable alternative would be the ubiquitous 555 chip which can be found in numerous incarnations such as LM555. Look in this datasheet for the monostable circuit which looks like this enter image description here

Your switch goes between trigger and GND and you need a pull-up resistor from trigger to supply. The device initiates a cycle upon a falling edge on trigger input. The output goes high during the cycle and back low after the time-out time which is t=1.1 * Ra * C. So depending on the current requirement of your LED you may get away with just driving the LED in series with a resistor from the output and to GND. Datasheet claims up to 200mA of source current - which is the relevant current in this setup. Be aware of the associated voltage drop between out and supply may be up to 1.6V in that case. This is to subtract in the calculation of the resistor to put in series with the LED. But your circuit suggest only a few mA of current so this will work flawlessly.

If you need more current, you can use the output to drive your mosfet gate directly.

\$\endgroup\$
2
  • \$\begingroup\$ Hey thanks for the recommendation I see a lot of circuits using the 555 with push buttons are the possiblilties to do the same with a flip switch? \$\endgroup\$
    – Ron Beton
    Commented Feb 15 at 14:52
  • \$\begingroup\$ If you mean a switch which stays either on or off as opposed to a push button - usually push = connect - certainly, either will work the same. Just connect as described with a pull-up resistor to your 5V. Value is not critical - anything from 1k to 100k and more will do, The trigger input is falling edge active which means that it does not react to the rising edge of the trigger voltage when you open your switch (no current) \$\endgroup\$
    – helarsen
    Commented Feb 15 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.