ELEN2016A · ELECTRONICS I

Crypto-Box Timer

Dr Dangor · Press to charge C1. Release to start the timer.

Timer → transistor → relay

Box powered

Circuit reference · Open schematic in CircuitLab

Moving markers show conventional current direction. Blue supply markers include illustrative U1 and R2 currents; those currents are not quantified. No current enters the ideal comparator inputs.

Flyback replay ready. The slowed replay follows the actual diode-current decay.

Waiting for a press
Simulated timer seconds remaining

Configured duration 60 seconds

R1 current
IB
Coil current
Box current
Flyback
2.51 V · 27.90% VCC

Drag or use arrow keys. R1 and C1 stay fixed. R2 recalculates the full theoretical trace; adjustment transients are not modelled.

Timer scope

0.00 s
Timer readings and component values
QuantityValueQuantityValue
VCVref
VBBVBOX
Time constant τExpiry
VCC (V1) supplyR1
C1R2 reference
VBB HIGHRB
Active gain βBox load
Coil resistancePickup current
Release currentInductance

The scope extends to at least 10τ: C1 approaches 0 V while V1 continues powering U1.

Workbench

Changing settings clears the simulation. Press and release SW1 to begin another attempt.

Scope controls and relay status

Drag the white cursor or use the slider to pause at a chosen time. Arrow keys move the cursor; Home and End select the time limits.

The scope shows the discharge after SW1 is released. Holding SW1 keeps C1 at VCC and the elapsed time at zero.

Relay and load settings

How the power rail switches

SW1 charges C1 directly from VCC while the button is pressed. Releasing SW1 disconnects the charging source, so C1 discharges through R1 to ground. Pressing SW1 again recharges C1 and restarts the timer when the button is released.

U1 compares the capacitor voltage at the non-inverting input with the reference at the inverting input. While VC exceeds Vref, U1 drives Q1 ON and K1 supplies the box. When VC falls to the reference, U1 drives Q1 OFF. The relay opens after the coil current falls below the release threshold.

The timer and relay coil use the unswitched supply. K1 switches only the positive box rail; the ground connection remains common. Powering U1 from the switched rail would remove the timer’s own supply. Another powered connection can also keep the box energised after the relay opens.

RC timing relationships

τ = R1C1

VC(t) = VCC exp(−t/τ)

tswitch = τ ln(VCC/Vref)

R1 is in ohms and C1 is in farads. The default 100 kΩ and 470 µF give τ = 47 s. R2 sets Vref to approximately 27.90% of VCC, or 2.51 V at a 9 V supply, for a nominal 60 s discharge interval. Component tolerances and comparator behaviour affect the physical delay.

From the model to a physical circuit

U1 is an ideal push-pull comparator in this model. Check the chosen device’s input range, HIGH voltage and output-current capability. An open-collector comparator requires a pull-up resistor; the pull-up and base resistor must provide enough base current. The LM358 is an operational amplifier and does not provide an ideal rail-to-rail output. Use the actual datasheet when choosing R2 and RB. The comparator must accept the full initial C1 voltage; an LM358 input cannot be assumed to operate correctly at the positive supply rail.

Q1 must supply the relay coil current without exceeding the transistor ratings. D1 is reverse-biased while Q1 conducts and carries the coil current after Q1 switches off. K1’s coil voltage, pickup current and contact ratings must match the supply and box load. Obtain the actual relay specifications before selecting a driver.

The model uses VBE = 0.7 V, VCE(sat) = 0.2 V and active-region gain β. The coil uses resistance and an adjustable inductance. Flyback follows the RL decay with a 0.7 V diode drop; the relay releases at the selected current threshold. Coil energisation and mechanical delays are omitted. Holding SW1 establishes the fully charged C1 voltage and the steady coil current. The ideal source and switch charge C1 immediately; real charging is limited by source impedance and takes a short interval. The box is represented by an equivalent resistive load. Load energy storage, comparator noise and contact bounce are omitted. Clear simulation restores the initial discharged state; the circuit’s reset action is another press and release of SW1.

References: Texas Instruments: comparator output types · Texas Instruments: LM358 datasheet · Omron: transistor relay drive