# Time delayed deactivation of a circuit

In a simple electronic circuit with a momentary switched LED (or bulb, tube etc.); what can be done to trigger the LED for several seconds before proceeding to break the circuit?

In other words; I want one quick press of the button to activate the LED, and also deactivate it automaticslly after x amount of seconds; just as if I'd been holding my finger on the button the whole time.

I probably didn't explain it very well, but I'm sure it should be easy to infer my meaning. FYI; I'm just trying to teach myself how to build basic, practical electronic circuits by tinkering with a breadboard.

I know it's pretty simple stuff; but at the moment, the configuration basically looks like this:

• I love all these answers and no idea about the LED current or the battery voltage from the OP. – jonk Jul 30 '17 at 3:44
• Look up monostable multivibrator. This kind of circuit will generally draw a bit of current from the source all the time, even after the LED turns off. As jonk indicates the exact circuit is going to vary considerably depending on whether it's 3.3V and a 0603 LED or if it's 48V and a 100W lighting LED etc. – Spehro Pefhany Jul 30 '17 at 4:09

I thought I'd provide both a thinking process and design procedure, given the lack of information about the current or voltage supply. But I won't provide any part selections or values since there are no specifications for voltages or currents. So just the idea has to suffice for now.

The idea starts with the left schematic below:

simulate this circuit – Schematic created using CircuitLab

The left side shows the basic LED, current-limiting resistor, and the momentary switch. But there is an added "function." This function box is supposed to do the additional work of both detecting when the switch is momentarily closed (debouncing it, as necessary) and then bypassing the momentary switch for some time period. This means it will eventually have to include a "timer" and more.

Moving to the right side above, the first step is to just add a controllable high-side switch. In this case, I chose a PNP BJT as $Q_1$ for this purpose and added a "pull-up" resistor, $R_1$, which has a few simple uses: (1) it helps to remove stored charge in the PNP when turning off; and, (2) it holds the PNP BJT firmly off unless the rest of the circuit firmly turns it on.

The following steps continue the thinking. Starting again on the left:

simulate this circuit

Here in step 2, I've added a driver for the high-side switch in the form of a MOSFET, $M_1$, and a base-current limiting resistor, $R_2$, for $Q_1$'s base. Turning $M_1$ on will then turn $Q_1$ on, as well.

I chose a MOSFET here because I know that there will be some timing yet to be done and a MOSFET gate doesn't require current to hold the MOSFET on and the current leakage is very, very low. So this means that a simple RC timing circuit could finally be considered now. (Another BJT circuit would require current, too, and would be sweeping the problem under a rug to be solved still later.)

(Having gotten to this point, one might wonder why I didn't start with a MOSFET in the first place. Good question. And it's worth considering. But the answer relates to the arrangement of the momentary switch and the direction it pulls on the node it's attached to. And moving the momentary switch to the low side doesn't fix this problem.)

I didn't add a "pull-down" resistor to the gate of $M_1$ because of what's coming up in step 3.

Now, moving to the right side (step 3) of the above schematic, I've added the RC timing circuit and also the switch detection. (They are one and the same.) Here, when the momentary switch pulls up in order to supply power to the LED, it also pulls $C_1$ up and with it the gate of $M_1$, which now becomes active. (This RC also acts to debounce the switch, too.) $C_1$ is nominally discharged at the start of all this, so the voltage across it should be close to zero prior to the momentary switch being engaged.

The values of $R_3$ and $C_1$ (along with the required gate voltage for $M_1$) will determine the duration of the added "hold" time. Because of the low leakage of $M_1$'s gate, the RC time constant can be quite long.

As $C_1$ slowly charges by way of $R_3$, the gate voltage of $M_1$ moves lower and lower and will eventually turn $M_1$ off. At this moment, $Q_1$ will also turn off and the power will be removed from the LED (or other load.)

There is a problem with the version in step 3, though. When $M_1$ finally turns off, $C_1$ is charged up to some voltage (positive side above, negative side below.) When $Q_1$ also turns off as a result of $M_1$ turning off, this allows the load (the LED and its current limiting resistor) to pull the collector of $Q_1$ rapidly down towards ground (the negative rail.) This pulls the positive side of $Q_1$ close to ground, too. Which means the negative end of $C_1$ is very much lower than ground.

This isn't precisely a problem. Technically, $R_3$ does provide a DC path and it will gradually allow the capacitor to discharge. But leaving it to $R_3$ means the circuit is "mostly worthless" while yet another set of RC time constants goes by. So to hasten things, $D_1$ is added. This provides a very fast way for $C_1$ to rapidly discharge and reset itself after the timer expires. And so the circuit resets itself almost immediately. Which is a desired behavior, I think. (Without $D_1$, the circuit will behave "erratically" from the perspective of a user.)

Step 4 on the left side below shows the addition of this diode:

simulate this circuit

In the final step (to the right) one more diode is added to protect the gate of $M_1$ from excessive voltage as well as providing yet another discharge path for parasitic capacitances in the circuit.

(In all of this, the circuit so far assumes that the gate of $M_1$ can withstand the power supply voltage. If not, if the supply voltage required by the LED is too high, then this circuit really isn't a safe approach for the MOSFET and it would need further added design elements -- such as a zener to protect the MOSFET gate.)

Note that the above is not re-triggerable. Once triggered, its time period must be allowed to expire before the momentary switch can be used again. If one wants it to be re-retriggerable, then two new diodes need to be added:

simulate this circuit

Those diodes allow the momentary switch to discharge $C_1$ as well as pull it up, so that the timing is reset when the switch is again pressed momentarily. (Two diodes are needed to avoid unwanted interactions between the nodes on either side of $C_1$.)

So that's it.

Note that no values or selection of parts is included in any of the above examples. That's because there are no voltage or current specifications by the OP. Given the lack of information, this is probably all that can be done for now. And even then, the circuit cannot be expanded easily to some of the high voltages and some newer LEDs may require -- such as LED filaments with 28 series LEDs (of a couple of types) that often require $70\:\textrm{V}_\textrm{DC}$ or more to operate. (MOSFET gates can be a bit too sensitive for such things.)

All I can offer are some notes.

1. $R_1$ is just a pull-up. Its value isn't critical, but if the required base current for $Q_1$ is $I_{B_1}$ and the required base-emitter voltage is $V_{BE_1}$ then perhaps $R_1\approx 100\cdot\frac{V_{BE_1}}{ I_{B_1}}$. It could be less than that, or more.
2. $R_2$ sets the required base current for $Q_1$. Assuming $M_1$'s drain is close to ground, when on, the value should be $R_2\approx \frac{\left(+V\right) - V_{BE_1}}{I_{B_1}}$. Also, one should check the power dissipation required, as well, since an appreciable voltage is dropped here.
3. $R_3$ and $C_1$ set the timing. Because of availability and also the difficulties in keeping a circuit clean enough, $R_3$ should probably be $\le 2.2\:\textrm{M}\Omega$. Somewhat larger values are fine, too. But just be aware that it starts getting more expensive and more difficult, the higher the value gets. Meanwhile, $C_1$, if long delays are anticipated and $R_3$ is rather large, should be a lower leakage type.
4. $Q_1$'s collector needs to be able to support the required current. So select it, appropriately. This will impact it's required $I_{B_1}$ and also its $V_{BE_1}$ when on. Read the datasheet carefully. Also, make sure that it is able to handle any necessary dissipation and that it is operated within the safe-operating area found in the datasheet.
5. $M_1$ only needs to sink $Q_1$'s required base current, $I_{B_1}$. So it probably can be a smaller (or as small) device. The main thing to look for here is that its $V_{GS_{TH}}$ is appropriate for the circuit's operating voltage (and the required sinking current, of course) and that it allows for a reasonable variation so that the RC timing can operate satisfactorily. Again, check the datasheet carefully, too.
6. Obviously, $R_{LIMIT}$ must be chosen appropriately for the LED (or other load.)
7. The numbered diodes I'm imagining are just 1N4148 types. But this may not always be appropriate. Again, consider the above text about what they do when considering a specific choice.
8. No provisions were added here to handle an inductive load's kickback voltages. Using an inductive load may affect a number of circuit elements that I did not consider and may require substantial changes that I didn't (and won't) anticipate here.
9. The potential difference of the voltage supply impacts a variety of part selection details. (For example, if an electrolytic is selected for $C_1$ then the voltage specification for it probably matters and should be observed.) Be sensible.
10. The choice of a momentary switch matters too, depending on the expected load current and voltage. The DC voltage specification for a switch is often many times lower than its AC voltage specification. Be sensible here and read the datasheet.
11. The above circuit is for educational purposes only. Additional protection elements may be required for any given situation. For example, this circuit should never be considered anywhere near a gasoline station pump or near potentially explosive vapors, nor should it be used anywhere near a living heart during a medical operation. Etc. Etc.

Add a large capacitor from the top of the resistor to the bottom of the LED. When you press the button, it will light up the LED and charge up the capacitor. When you release the button, the capacitor will continue to power the LED through the resistor. The LED will extinguish slowly, rather than snap off, but this is a simple thing to try before moving to a more complex circuit.

Based on the battery voltage, resistor value, and LED type, it is possible to calculate approximately the capacitor size for a specified on time. For example, with a 9 V battery, 1 K resistor, and common green LED (2.0 V Vf), a 4700 uF capacitor will light the LED for about 3-5 seconds after the switch is released

ak

You're looking for a "one shot monostable" circuit, or simply a "monostable". Google this.

Here's an example which should solve your problem.

simulate this circuit – Schematic created using CircuitLab

You can try to build a circuit like this. C1 will hold the voltage for a short while to allow Q1 to flow current from it's Collector to Emitter.

• Yes, but not as long as you might think. The Q1 base-emitter junction prevents the cap from charging above 0.6 V, and the transistor will turn off at around 0.45 V. If you move C1 to the other side of R3, and delete R2, you will bet a much longer ON time for the same sized capacitor. – AnalogKid Jul 30 '17 at 2:25
• You're right. If I change the BJT to a mosfet, then C1 and R2 will decide the on time. – Jason Han Jul 31 '17 at 14:14
• True, but the turn-on and turn-off transitions will be much more gradual. The voltage range for a base-emitter junction to go from non-conducting to conducting is much shorter that the equivalent gate voltage range for a MOSFET. – AnalogKid Aug 4 '17 at 3:18

Well, an easy way would be to store a charge quickly in a capacitor and then let it bleed out through a resistor. If you got a BJT transistor, then put the resistor in series with the base of the transistor. If it is a MOSFET, then put the resistor to the ground.

Here's the schematic, the one you should choose is the one to the right.

Here's the link if you want to interact with the schematic. You'll see why the one on the right is the correct one.

The 10mΩ resistance is only there to make the simulation stable, if it's removed the simulation kind of bugs out. So when you make the circuit, just think of it as part of the wire you're soldering, it's not an actual extra component.

## EDIT

This might be more viable, a Darlington transistor. This way you don't need gigantic capacitors of 200µF or 22µF, you'll be fine with small stuff, like 1µF.

• Think of the 10m Ohm as part of the 22uF , which is more like 100m ohm ultralow ESR and 10 ohms if it is a G.P. (general purpose) cheap e-cap – Tony Stewart Sunnyskyguy EE75 Jul 30 '17 at 5:03
• Sure, that works too ;) But that cap doesn't need to have ultra low ESR, it can have as bad as 1kΩ ESR. – Harry Svensson Jul 30 '17 at 5:06
• true but low ESR keep the switch contacts oxide free unless they are rated for <2A gold flash plated but unlikely. – Tony Stewart Sunnyskyguy EE75 Jul 30 '17 at 5:23

All switches including time delay ones must be well defined by output voltage and current. The time delay is easier with FETs due to high input R low output R.

Fast on, slow off, low in current and high output current, time duration and any other features affect the analog, or digital options avail.

Schmitt Triggers, one-shots , FETs and 555 type ccts are common as well as CD4060 digital timers

simulate this circuit – Schematic created using CircuitLab