Skip to content
LearnTronics menu

LearnTronics

Variable RC Timer — Build It in Steps

Tutorial Index

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.

Breadboard at low voltage. These examples use a 9 V battery or regulated 9 V supply. Observe electrolytic-capacitor polarity. The camera-flash comparison below is only an analogy: real flash units may contain capacitors charged to hazardous voltages even after the unit is switched off.

Parts to have on the breadboard

PartSuggested value / partUse on this page
Supply9 V battery or regulated 9 V supplyLow-voltage experiment supply
C1100 µF electrolytic, 16 V or higherMain timing capacitor
R1100 kΩFirst charging/discharging resistor
RARM10 kΩCharges C1 quickly when the timer is armed
RTIME10 kΩ fixedMinimum resistance in the adjustable timing path
P1500 kΩ linear potentiometerAdjustable delay
LED1Ordinary indicator LEDVisible indication
RLED1 kΩLimits LED current
Q12N7000 N-channel enhancement MOSFETLets C1 control the LED without heavily loading C1
U1LM393P dual comparator, 8-pin DIPProvides a sharper, repeatable switching threshold
R2, R3100 kΩ eachMake a 4.5 V comparator reference
RPU10 kΩPull-up for the LM393 open-collector output
C20.1 µF ceramicSupply bypass at U1
C31 µF ceramic or non-polarTurns an output edge into a short pulse
R7100 kΩReturns the pulse output to its normal level
D11N4148Clamps the unwanted opposite-polarity pulse
S1SPST pushbuttonStarts the first charging experiment
S2SPDT toggle or slide switchSelects ARM or DISCHARGE/TIME
MeterDigital multimeterMeasure 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.

STEP 1 — CHARGE C1 AND WATCH THE VOLTAGE +9 V S1 R1 100 kΩ VC C1 100 µF + terminal at VC V DC volts Press S1: VC rises gradually from 0 V toward 9 V.

The math behind Step 1 — charging

The time constant is simply resistance multiplied by capacitance:

τ = RC
τ = (100,000 Ω)(100 µF) = 10 s

The capacitor voltage while charging from 0 V is:

VC(t) = VS(1 − e−t/RC)
Elapsed timeIdeal VC from a 9 V supplyWhat to notice
00.00 VJust started
1τ = 10 s5.69 VAbout 63% charged
2τ = 20 s7.78 VAbout 86% charged
3τ = 30 s8.55 VAbout 95% charged
5τ = 50 s8.94 VFor 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.

STEP 2 — ARM, THEN DISCHARGE +9 V RARM 10 kΩ ARM TIME S2 VC C1 100 µF R1 100 kΩ V DC volts ARM fills C1. TIME removes the supply and lets C1 empty through R1.

The math behind Step 2 — discharging

When a charged capacitor is allowed to discharge through R, its voltage is:

VC(t) = V0e−t/RC

With V0 = 9 V, R = 100 kΩ, C = 100 µF, and τ = 10 s:

Elapsed timeIdeal VCCharge remaining
09.00 V100%
1τ = 10 s3.31 VAbout 37%
2τ = 20 s1.22 VAbout 14%
3τ = 30 s0.45 VAbout 5%
5τ = 50 s0.06 VLess 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 3 — THE INDICATOR ITSELF CAN DRAIN C1 CHARGED C1 C1 100 µF RLED 1 kΩ LED1 fades This is a real load, so it is no longer the simple 100 kΩ × 100 µF timer.
Important experiment: compare the discharge time with only the voltmeter connected, and then with the LED connected. A good voltmeter has high input resistance and disturbs the timer comparatively little. The LED branch draws real current and empties C1 much faster.

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.

STEP 4 — Q1 WATCHES VC; THE SUPPLY POWERS THE LED VC C1 almost no steady gate current G D S Q1 2N7000 G = pin 2 S = pin 1 D = pin 3 +9 V RLED 1 kΩ LED1 C1 controls Q1's gate; C1 no longer has to furnish the LED current.

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:

I ≈ (9 V − 2 V) / 1,000 Ω ≈ 7 mA

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.

STEP 5 — VARIABLE TIMING RESISTANCE C1 / VC 10 kΩ fixed P1 500 kΩ LINEAR DISCHARGE

The math behind the adjustable delay

RTOTAL = 10 kΩ + P1
τ = RTOTAL × C1

With C1 = 100 µF, the adjustable range is approximately:

P1 settingTotal Rτ = RCTime to half-voltage
0 Ω10 kΩ1.0 s0.69 s
100 kΩ110 kΩ11 s7.6 s
250 kΩ260 kΩ26 s18.0 s
500 kΩ510 kΩ51 s35.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.

STEP 6 — LM393: CHANGE A SLOW VOLTAGE INTO A CLEAN DECISION VC FROM C1 slowly rising or falling − pin 2 + pin 3 U1A LM393P +9 V R2 100 kΩ R3 100 kΩ 4.5 V reference pin 1 OUT +9 V RPU 10 kΩ +9 V RLED 1 kΩ LED1 U1 pin 8 = +9 V; pin 4 = ground C2 0.1 µF directly between pins 8 and 4 LM393 output is open collector, so RPU provides the HIGH state Unused U1B: do not leave both inputs floating As drawn: VC above 4.5 V makes U1 pull LOW, turning LED1 ON.

The comparator lets us calculate a real threshold time

For charging toward VS and switching when VC reaches VT:

t = −RC ln(1 − VT/VS)

For discharging from V0 and switching when VC falls to VT:

t = RC ln(V0/VT)

With a 9 V supply, V0 = VS = 9 V, and VT = 4.5 V:

t = RC ln(2) ≈ 0.693RC

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.

STEP 7 — TURN THE EDGE INTO A SHORT PULSE RISING EDGE → BRIEF HIGH PULSE FALLING EDGE → BRIEF LOW PULSE U1 OUT C3 1 µF PULSE OUT R7 100 kΩ D1 1N4148 clamp diode U1 OUT PULSE OUT brief HIGH pulse U1 OUT C3 1 µF PULSE OUT +9 V R7 100 kΩ +9 V D1 1N4148 clamp diode U1 OUT PULSE OUT brief LOW pulse

Pulse width starts with another RC time constant

τPULSE = R7C3 = (100 kΩ)(1 µF) = 0.10 s

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.

The whole page in seven baby steps:
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

Try these yourself

Why do we begin with only R1, C1, and a voltmeter?
The first experiment isolates the RC behavior. Later additions can then be understood as loads, switches, or threshold detectors acting on that timing voltage.
Why does directly connecting LED1 change the discharge time?
The LED and its resistor provide another discharge path. They are therefore part of the circuit being timed, not a perfectly invisible observer.
What is the main reason for adding the 2N7000?
The insulated MOSFET gate has very high DC input resistance, so C1 can control Q1 without having to furnish the LED current.
Why is the LM393 more precise than using the MOSFET threshold as the timer threshold?
The comparator changes state when its two input voltages cross, so the chosen 4.5 V reference defines the switching point rather than relying on a broad transistor threshold specification.