# Can I use a capacitor and a transistor to create a circuit which automatically turns off an LED after a period of time?

I'm extremely new to electronics and I find I learn things better when I have physical examples to examine. I'm trying to understand the way capacitors and transistors work on a practical level, and I thought this might be a good way to get a better understanding.

So, let's say I have this circuit:

Supposing the capacitor is fully discharged when the battery is first connected, would the LED light and then switch off after about 15 seconds? Here's my reasoning, and my (extremely ignorant and naive) expectation of how the circuit will flow:

• When the battery is connected, current flows through R1 into C1, charging C1
• 5RC = 5 * 3000 * 0.001 = 15, so C2 should take 15 seconds to charge up
• During that time, current is flowing into the base of T1, allowing current to flow between the collector and emitter, thus powering the LED
• When C1 is fully charged, current stops flowing into the base of T1, therefore current stops flowing between the collector and emitter, therefore the LED switches off.

Have I fundamentally misunderstood how capacitors work in DC circuits, and perhaps how transistors work too? If so, how could this circuit be reworked to produce the outcome I'm expecting (i.e, a circuit which uses a capacitor and a transistor to automatically switch off an LED after some period of time)?

• Your circuit is so confused I'm not even sure exactly what you don't understand. Two thoughts: 1. Connecting the cathode of the LED to the most positive supply voltage is almost never going to turn on the LED. 2. The base of the NPN BJT needs to be driven to a voltage above the emitter voltage to turn it on. – The Photon Apr 24 '17 at 16:28
• Let's start with your first bullet point. Why do you think that turning on the battery would allow current to flow through R1 and C2, when they're connected to the battery only through a reverse-biased diode (D2) and a reverse-biased b-e junction? – The Photon Apr 24 '17 at 16:29
• @ThePhoton I think the OP has the "little pointy things" mixed up in mind. Reverse the LED direction and substitute in a PNP. – jonk Apr 24 '17 at 16:42
• Your circuit won't work, your explanation is therefore wrong, your commentary is fundamental to the questions you ask therefore, this cannot be answered. Voting to close as reason: unclear. – Andy aka Apr 24 '17 at 17:12
• I've just edited the circuit to follow conventional flow as best I can - again, I'm new to this, condescension isn't going to be particularly useful - and whether it works or not is entirely the point of the question: if it doesn't work, why doesn't it work? The commentary is an explanation of why I believe, wrongly or rightly, it should work, and isn't fundamental to the question of whether or not it actually would work and how it could be changed in order to work. – sdmtr Apr 24 '17 at 17:17

So many things wrong with that circuit, lets go back to the start.

The transistor is a valve that lets current flow through it from collector to emitter (the pointy arrow) when current is injected into the base.. as shown below.

As such, as long as you feed current into the base, current will flow through the transistor and, if the voltage on the base is high enough, it will act like a kind of switch.

When turned on, current can flow from the battery through the LED lighting it up. The LED can only withstand so much current or it will burn out. The resistor is included to limit that current to the rated amount specified by the manufacturer's specifications.

simulate this circuit – Schematic created using CircuitLab

So now you have a circuit that will turn on an LED.

Now you need to drive that circuit with something that turns it on for a while, then turns it off. Now your idea is to do something like this.

simulate this circuit

Idea being C1 takes a while to charge up through the base limited by the resistor. Indeed with the indicated values the transistor will start to turn off around eight seconds after the power is applied.

Unfortunately a 1mF capacitor is rather physically large and expensive. The resistor choice also affects the current in the LED.

A better solution for this task is to use a different device like an N-Channel MOSFET.

simulate this circuit

A MOSFET is gated by voltage not current. This effectively decouples the timing side from the driving side. That means you can use much larger resistances, and therefor a smaller capacitor for timing without affecting the LED current.

• Can you add why the FET makes a better choice? It's there, sorta, but it would be great if you finish the thought. Is it just that you don't have to worry about driving the FET to saturation, like the bipolar circuit? – Scott Seidman Apr 24 '17 at 17:53
• Thank you, I think I understand. Incidentally, I edited my original circuit as you were writing this to make it fit conventional flow and to correct the polarity of the LED so I don't think you saw it before commenting - is my new version still wrong (putting aside for the moment the extraneous wires and amateurish layout)? – sdmtr Apr 24 '17 at 17:53
• @ScottSeidman.. done. – Trevor_G Apr 24 '17 at 18:00
• @sdmtr your new circuit layout is still off. BTW, don't change your drawings in questions or it messes up the nswers and comments. If you need to change something add it at the bottom of the question as an UPDATE. Also, use the built in schematic editor, it has a simulator too. – Trevor_G Apr 24 '17 at 18:04
• @Trevor Sorry, I figured since nobody had yet answered it would be okay. In future I'll (a) get the layout right the first time and (b) add updates rather than make edits. Thanks again for taking the time to answer, I appreciate it. – sdmtr Apr 24 '17 at 18:20

Let's redraw the schematic. I think you either misunderstood the conventional direction of current or else how the diode is drawn (cathode and anode.) The reason I'm pretty sure you misunderstood something like that is because you otherwise got a reasoned description written out. So let's take your description and redraw the schematic.

Before I do that, there is something else you should immediately work on. And that's learning when to draw wires and when not to. Excess wiring often adds nothing to understanding a circuit, but adds "little black wires going from here to there" that can actually act to confuse rather than improve reading. And there is orientation. You may not understand this point right away, but tuck it away for later. If you just look at a schematic as a picture residing on a big sheet of paper, you want the current flow to go from top (more positive) to bottom (more negative) and you want signal flow to go from left (inputs) to right (outputs.) Broadly speaking, these rules work well to help communicate a schematic better than not following them. (Of course, there are corner cases or idiomatic expressions where the rules probably should be broken. But those are rare.)

simulate this circuit – Schematic created using CircuitLab

1. The battery and/or power supply isn't really needed because most of us can simply take note of a node voltage and make the right assumption about the intent. Besides, busing wires around just to show a supply rail and ground line connections is more for people who are wanting to wire up a circuit than for people who want to discuss how a circuit works. Different needs. It's distracting, besides. Though most learn to get past it quickly and get to the meat of the matter, with or without all that, it's still unnecessary.
2. I've shown $R_1$ and $C_2$ with currents flowing on the sheet downward. I could have shown them horizontally, too. Whether one wants to look at this leg as being "signal" that should flow left to right, or as a circuit connection where current should flow top to bottom, is a matter of what you want to communicate, I suppose. But here I decided that we are not talking about "signal" but more about initial circuit conditions leading to later circuit conditions. So I show it this way.
3. Note that I've taken it as granted that you still want to talk about a $+9\:\textrm{V}$ supply and that I needed to reverse the arrow directions, as it is the case today that the semiconductor PN junction arrow points from more positive to more negative, when active.
4. I've used a PNP transistor to remain consistent with the rest.

Assuming the LED, when on, drops about $2\:\textrm{V}$ (red), and if the initial conditions for the capacitor are that there are zero volts across it, then, yes... $R_1$ will supply base current into the PNP transistor and pull it active. I'd expect a base current of about:

$$I_B\approx \frac{9\:\textrm{V}-2\:\textrm{V}-750\:\textrm{mV}}{3\:\textrm{k}\Omega+\left(\beta+1\right)\cdot 330\:\Omega}$$

If $\beta\approx 200$ then this suggests about $90\:\mu\textrm{A}$ of base current. Multiplied by $\beta+1$ to get the emitter current (in the hopes that the BJT is active and not yet saturated), I get an emitter current of about $18\:\textrm{mA}$. This suggests a drop of $18\:\textrm{mA}\cdot 330\:\Omega\approx 6\:\textrm{V}$ across $R_2$. So this means about $9\:\textrm{V}-2\:\textrm{V}-6\:\textrm{V}=1\:\textrm{V}$ on the emitter itself and that means that $\vert V_{BE}\vert=1\:\textrm{V}$ and that the BJT is actually still active and not yet saturated. So my assumption is born out and I can apply the $\beta$ I assumed earlier.

That is the initial condition. As the capacitor charges up, as you write, it acts to oppose the remaining voltage left available to supply base current (see the above equation and now also subtract the capacitor voltage in the numerator) and the collector current gradually diminishes over time, eventually becoming extinguished when the remaining voltage falls below the ability to keep the BJT active (usefully, when it falls below about $550-600\:\textrm{mV}$.)

The time period, or $\tau$, will be the value of the capacitor times the associated resistance. In this case, this resistance is "as seen" by the capacitor and it will include both resistors in this way: $R_2\cdot\left(\beta+1\right)+R_1$. So with your values and assuming $\beta=200$, then $\tau=1\:\textrm{mF}\cdot\left(\left(\beta+1\right)\cdot R_2+R_1\right)\approx 70\:\textrm{s}$. Which is pretty darned long.

• Unfortunately this is more of a dimmer than a switch though. – Trevor_G Apr 24 '17 at 17:40
• Thank you, this is very comprehensive and I especially appreciate the notes on improving my layouts. – sdmtr Apr 24 '17 at 17:55
• @Trevor Yeah. It starts out kind of bright then just follows a long decay curve until it no longer works. (And that cap needs a way to be discharged, later.) I don't think the OP meant it to be a practical circuit. I think the OP meant it as a test of their ability to "think about things." – jonk Apr 24 '17 at 18:11

Capacitors "blocks" dc voltage flow. So it would be difficult to turn "on" the transitor with a resistor capacitor series network to the base. Look at one half of a monostable multivibrator cct. The capacitor on the base charges as rc time charge ratio. A soon as the base voltage reaches above the "required base on" voltge, the capacitor discharges via the base to emitter. The transistor oes to off state. The practical value required for your project has it's limitations in component value and physical size. Led current rquired is a major factor. Look at circuits using NE555 ic. You'll enjoy those. Read up on the pn junction depletion region of diodes Nand transistors. Transistor is like a component that "transfer resistance" from one stage to another. With ohms law at play, the whole switching, analogue amplification sort of becomes abvious including the phase changes during amplification. I could write an article on it I suppose. For curious minds...

• Thank you, there's plenty of great information here which will help me learn, and I appreciate you taking the time to respond! – sdmtr Apr 27 '17 at 2:27

ALL

The original cct will work (its a simple emitter follower for who don'nt know) BUT as the cap cannot discharge for another cycle the LED will stay off until the power is removed and the cap self discharges due to leakage.

i suggest we look at the low impedances. the impedance Zm is function of the current. the current is equal to v/Zm. alternatively, the current i = 3000sinwt. therefore i=3000<0. a capacitor is a two terminal device. the initial conditions for a capacitor is looking at the exponential network for the device. the transistor amplifies currents and the voltage between the two devices can be determined by the thevenin equivalent.

• 1) There is no Zm in the original circuit 2) Impedance is a function of frequency, not current 3) There is no sinusoidal stimulus, this is not a steady state ac situation, so no sin$\omega$t 4) i=3000<0 makes no sense mathematically – Elliot Alderson Dec 30 '19 at 18:08