Once I push and release a pushbutton I want a LED to light for say 10 seconds. I found a design for this on the web and tried it out:

enter image description here

What I observed on the breadboard was that the LED lighted for at least 60 secs and seemed to be exponentially decaying.

I also found equations describing a discharging RC circuit:

$$V_C=V_0e^{-\frac{t}{RC}}$$ $$I=\frac{V_0}{R}e^{-\frac{t}{RC}}$$

According to these equations the capacitor should be "fully discharged" in t=5*R*C.

In my case R = 10kOhm and C=220uF => t = 5*1e4*2.2e-4 = 11 secs.

So what is wrong in this analysis? Also since the transistor (BC 548) needs V_BE about 0.7 V or more I would think that the LED would decay exponentially until the voltage out of the capacitor dropped down to 0.7V and then the LED would instantly shut off.

How can i modify the Circuit to behave more like what i want?

  • 1
    \$\begingroup\$ Transistors do not instantly turn on or off. It is a transition (and logarithmic at that). The formulas describe RC discharge in a short circuit which you do not have. \$\endgroup\$ – Peter Smith Dec 8 '18 at 15:14
  • \$\begingroup\$ But I read there is something called "cut-off mode": "there is no collector current, and therefore no emitter current" for a transistor. \$\endgroup\$ – Andy Dec 8 '18 at 16:10
  • 1
    \$\begingroup\$ Two things to verify (1) is your 10K resistor really a 10K (if a 100K that would put you into the ballpark of 60s). The other is if your LED is a high efficiency type, then the current required to drive with visible light output can be less than 1mA, and the BC548 is a high gain transistor, so even a little bit of base current will keep the LED illuminated longer than you expect. Also, you may want to put a small (1K) ohm charging resistor so you're not putting (in effect) a short circuit current through your switch when you initially charge your capacitor; it can damage a low power switch. \$\endgroup\$ – isdi Dec 8 '18 at 16:44
  • 1
    \$\begingroup\$ You can potentially get much better results if you replace the transistor with a comparator, but you will also need a bit more circuitry. \$\endgroup\$ – mkeith Dec 8 '18 at 17:09
  • 1
    \$\begingroup\$ Like isdi said, double-check resistor and capacitor values. If those are correct, then the transistor leakage current may be turning on the LED. You can work around that by putting a 10k resistor in parallel with the LED. This will prevent low current from turning it on. \$\endgroup\$ – mkeith Dec 8 '18 at 17:11

Use the following circuit to turn an LED fully on with button and off after 10 seconds. You will still have to connect a transistor to the OUT terminal like you did in your circuit (The timer IC 555 might not be able to drive a LED directly). enter image description here

  • \$\begingroup\$ Thanks for the help! This solution worked beautifully. I connected the LED directly to the out. How do I calculate the time the LED stays lit from the capacitances and impedances? \$\endgroup\$ – Andy Dec 8 '18 at 22:12
  • \$\begingroup\$ R1=10*T/(11*C1) is the answer. \$\endgroup\$ – Stefan Wyss Dec 8 '18 at 22:22
  • \$\begingroup\$ Does R1 and C1 form a charging RC circuit? And do the NE 555 stop the pulse when the voltage at pin 6 reaches 2/3 of supply voltage? Which happens at 1T =R1*C1=10 secs, which fits observed value (I used R1 = 1M Ohm instead). \$\endgroup\$ – Andy Dec 8 '18 at 22:54
  • \$\begingroup\$ Yes, all of that is correct. \$\endgroup\$ – Stefan Wyss Dec 9 '18 at 7:29

The following schematic will do what you ask, I think:


simulate this circuit – Schematic created using CircuitLab

\$Q_1\$ can be any small signal PNP BJT and \$M_1\$ might be a BSS123 or BSS145 or any of a list of small signal NFETs.

The timing of the circuit depends upon \$R_1\$, \$C_1\$, and the threshold voltage of the NFET you choose.

The circuit requires the use of \$M_1\$ because there's no gate current to speak of. This allows the RC timing to be selected over a very wide dynamic range of possibilities and for extended periods of time. (A BJT in its place would not allow such a dynamic range and would greatly complicate extended periods of time.)

\$Q_1\$ is isolated from the timing issues, so it's just operated as a "switch" to supply the needed current to your LED when it is turned on by the momentary push-button \$SW_1\$. Note that \$Q_1\$ appears to parallel \$SW_1\$? That's for a reason. When you press the push-button, the circuit causes \$Q_1\$ to activate and bypass the push-button. So when the push-button is released, \$Q_1\$ stays on, keeping your LED on for the timed period, and thereby replacing the need for holding down the push-button. By the time you release the push-button, \$Q_1\$ is already active and taking over, supplying current to the LED until the timing period expires.

The BAV99 is a 2-diode part with three pins. If you feel okay grabbing up one of those, use it. If not, there's really no serious need for \$D_2\$. But \$D_1\$ is required (to speed up resetting the circuit when the timing is over.) So you can use a 1N4148 for \$D_1\$ (or some other small signal diode of your choice, I suppose) and just eliminate \$D_2\$.

This circuit also completely debounces your push-button switch. So it should work consistently and as you would want to expect from it.

  • \$\begingroup\$ Gate threshold voltage of the BSS123 varies from 0.8V to 2.0V, so this circuit is not a good recommendation. \$\endgroup\$ – Stefan Wyss Dec 8 '18 at 20:30
  • \$\begingroup\$ @StefanWyss Assuming this is hobbyist purposes, the OP can adjust the resistor (or capacitor) per need. \$\endgroup\$ – jonk Dec 8 '18 at 20:32

You don’t have an RC circuit, that formula does not truly apply. The discharge rate with your circuit actually follows a 1/t as the capacitor approaches ~0.6V

As the voltage on the capacitor goes down, and the current through the transistor is lowered, the effective resistance is parallel with the capacitor goes up. Increasing the linearized time constant.

To get it to do what you want, add a resistor directly from the capacitor to ground to set the time constant, and increase the resistor to the base of the transistor to reduce its effect.

Alternatively, you can add a resistor in parallel with the BE junction, to define the maximum impedance on that node.

  • \$\begingroup\$ Thank you for the help. I added a 10 k Ohm in parallell with BE junction and that worked great. The LED lit for almost exactly 11 secs. I also tried this 10 k from the anode of the capacitor to ground but this did not work. Instead the LED surprisingly stayed always lit even if I had not pressed button. \$\endgroup\$ – Andy Dec 8 '18 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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