LearnTronics
Variable RC Timer — Build It in Steps
Recipe #23 — RC timing: build it one step at a time
This page is meant to be built, not merely read. Begin with only a resistor, capacitor, switch, and voltmeter. Watch the capacitor charge. Then watch it discharge. Only after those two experiments are familiar do we add an LED, a MOSFET, an adjustable resistor, a comparator, and finally a short trigger pulse.
Parts to have on the breadboard
| Part | Suggested value / part | Use on this page |
|---|---|---|
| Supply | 9 V battery or regulated 9 V supply | Low-voltage experiment supply |
| C1 | 100 µF electrolytic, 16 V or higher | Main timing capacitor |
| R1 | 100 kΩ | First charging/discharging resistor |
| RARM | 10 kΩ | Charges C1 quickly when the timer is armed |
| RTIME | 10 kΩ fixed | Minimum resistance in the adjustable timing path |
| P1 | 500 kΩ linear potentiometer | Adjustable delay |
| LED1 | Ordinary indicator LED | Visible indication |
| RLED | 1 kΩ | Limits LED current |
| Q1 | 2N7000 N-channel enhancement MOSFET | Lets C1 control the LED without heavily loading C1 |
| U1 | LM393P dual comparator, 8-pin DIP | Provides a sharper, repeatable switching threshold |
| R2, R3 | 100 kΩ each | Make a 4.5 V comparator reference |
| RPU | 10 kΩ | Pull-up for the LM393 open-collector output |
| C2 | 0.1 µF ceramic | Supply bypass at U1 |
| C3 | 1 µF ceramic or non-polar | Turns an output edge into a short pulse |
| R7 | 100 kΩ | Returns the pulse output to its normal level |
| D1 | 1N4148 | Clamps the unwanted opposite-polarity pulse |
| S1 | SPST pushbutton | Starts the first charging experiment |
| S2 | SPDT toggle or slide switch | Selects ARM or DISCHARGE/TIME |
| Meter | Digital multimeter | Measure VC directly before adding electronic switches |
Step 1 — no transistor yet: charge C1 and measure it
Start with only S1, R1, and C1. Put the voltmeter across C1. Press S1 and watch the voltage at VC rise. This is the timing action itself; everything added later merely decides what to do with this slowly changing voltage.
The math behind Step 1 — charging
The time constant is simply resistance multiplied by capacitance:
The capacitor voltage while charging from 0 V is:
| Elapsed time | Ideal VC from a 9 V supply | What to notice |
|---|---|---|
| 0 | 0.00 V | Just started |
| 1τ = 10 s | 5.69 V | About 63% charged |
| 2τ = 20 s | 7.78 V | About 86% charged |
| 3τ = 30 s | 8.55 V | About 95% charged |
| 5τ = 50 s | 8.94 V | For most practical purposes, nearly charged |
A real electrolytic capacitor and resistor have tolerances, so the meter will not land on every number exactly.
Step 2 — arm it, then discharge it
Now use an SPDT switch. In ARM, C1 charges from +9 V through RARM. Move S2 to TIME and the charging supply is disconnected from VC while C1 discharges through R1. Keep the meter connected and watch VC fall.
The math behind Step 2 — discharging
When a charged capacitor is allowed to discharge through R, its voltage is:
With V0 = 9 V, R = 100 kΩ, C = 100 µF, and τ = 10 s:
| Elapsed time | Ideal VC | Charge remaining |
|---|---|---|
| 0 | 9.00 V | 100% |
| 1τ = 10 s | 3.31 V | About 37% |
| 2τ = 20 s | 1.22 V | About 14% |
| 3τ = 30 s | 0.45 V | About 5% |
| 5τ = 50 s | 0.06 V | Less than 1% |
Notice that charging and discharging are not straight ramps. The voltage changes fastest at first and progressively more slowly afterward.
Arming takes a moment
A camera flash gives a familiar example of a capacitor being charged into a ready state. After a flash fires, its energy-storage capacitor must recharge before another full flash is available. The little 9 V timing capacitor here stores vastly less energy, but the useful idea is the same: ready does not have to mean instantaneous.
Step 3 — deliberately load the charged capacitor with an LED
Charge C1 first. Then connect LED1 and its 1 kΩ resistor across C1. The LED lights from the energy already stored in C1 and fades as C1 discharges. This is useful—but it also demonstrates a problem: the thing we attach to the timing capacitor changes the timing.
Step 4 — now introduce Q1: let the capacitor control instead of power the LED
This is the reason for adding the MOSFET. C1 is connected to the gate of Q1 rather than being asked to supply the LED current. The MOSFET gate has very high DC input resistance, so it watches VC while the 9 V supply provides the LED current through Q1's drain and source.
For this breadboard use a 2N7000. It is now also identified on the LearnTronics MOSFET component page.
A useful bit of MOSFET math — and why this is still not a precision timer
With a 9 V supply and a red LED around 2 V, the 1 kΩ resistor keeps the LED current in the neighborhood of:
That is a very small load for the 2N7000. But the important timing number is not LED current—it is the MOSFET's gate threshold. The 2N7000 datasheet allows a fairly broad threshold range, so the exact VC at which one particular device begins conducting is not a precision reference. That limitation gives us a good reason to add a comparator later.
Step 5 — make the charge or discharge time adjustable
Replace the fixed timing resistor with a 10 kΩ resistor in series with a 500 kΩ linear potentiometer. Wire P1 as a rheostat by tying its wiper to the left end terminal, as shown. The fixed resistor prevents the resistance from being turned all the way to essentially zero.
The math behind the adjustable delay
With C1 = 100 µF, the adjustable range is approximately:
| P1 setting | Total R | τ = RC | Time to half-voltage |
|---|---|---|---|
| 0 Ω | 10 kΩ | 1.0 s | 0.69 s |
| 100 kΩ | 110 kΩ | 11 s | 7.6 s |
| 250 kΩ | 260 kΩ | 26 s | 18.0 s |
| 500 kΩ | 510 kΩ | 51 s | 35.3 s |
The final column becomes especially useful once the comparator switches at one-half of the supply voltage.
Step 6 — add U1, an LM393 comparator, for a definite switching point
The MOSFET showed us how to avoid loading C1, but it also showed us that “begins to turn on” is not a very exact timer threshold. U1 solves that problem. Two equal 100 kΩ resistors make a 4.5 V reference. One half of an LM393P compares VC with that reference and changes its output sharply when the two voltages cross.
The comparator lets us calculate a real threshold time
For charging toward VS and switching when VC reaches VT:
For discharging from V0 and switching when VC falls to VT:
With a 9 V supply, V0 = VS = 9 V, and VT = 4.5 V:
That is why the half-supply reference is so convenient: the same 0.693RC number appears for both charging to halfway and discharging to halfway.
LM393 breadboard notes
For the 8-pin DIP version: pin 1 = output A, pin 2 = A−, pin 3 = A+, pin 4 = ground, and pin 8 = +9 V. The LM393 output is open collector, so a pull-up is required when a definite HIGH level is wanted. Keep C2, 0.1 µF, close to pins 8 and 4.
The second comparator is available for another threshold, an inverter, or later pulse shaping. Do not leave both of its inputs floating.
Step 7 — make the end of the delay a momentary event
A timer does not always need to remain ON after the delay. Sometimes another circuit only needs a brief trigger saying, “the time has expired.” A series capacitor can pass the sudden output edge while blocking the steady DC level. In these drawings D1 is an ordinary 1N4148 signal diode—not an LED; its job is only to clamp the unwanted opposite-polarity excursion.
Pulse width starts with another RC time constant
The pulse itself decays exponentially rather than ending at one perfectly sharp mathematical instant. The threshold of the circuit receiving the pulse determines the effective pulse width. This is exactly the kind of problem that a later 555 one-shot solves more deliberately.
1. charge C1 and measure VC
2. arm C1, then discharge it and measure VC
3. let an LED drain C1 and see that a load changes the timing
4. add the 2N7000 so C1 controls the LED without supplying its current
5. add P1 for an adjustable delay
6. add the LM393 for a repeatable threshold
7. edge-couple the result for a brief HIGH or LOW trigger