Inside a Traffic Light
A state machine with lives depending on it, a wire loop under the road that feels your car, and a guard circuit that refuses to show two greens.
A traffic light seems to change on its own. It is really a controller in a roadside cabinet, running a carefully timed sequence of states, listening to sensors in the road, and watched by a second circuit whose only job is to catch mistakes.
Conceptual only. Do not open real devices: they can hold mains voltage, charged capacitors, sharp edges or springs.
1Explode it
Pull the traffic light apart.
fig. 05 · traffic light, coming apart
Parts of the traffic light, as a list
- Signal head. The housing with red, amber and green lamps, each under a visor that shades it from the sun. Engineering idea: Visibility is the requirement. The visors block sunlight that would make an unlit lamp look lit, and the fixed order (red always on top) means colour-blind drivers can read position, not just colour.
- LED module. Each lamp is a panel of many LEDs behind a lens. Engineering idea: LEDs use a fraction of the power of the old bulbs and last for years. Using many LEDs means one failing does not leave the lamp dark.
- Pedestrian button. Registers a request to cross. Engineering idea: The press is latched: the controller remembers it until the walk phase is served, so pressing again does not make it faster. It is a digital input that sets a flag.
- Controller cabinet. A roadside box with the controller that runs the phases and timings. Engineering idea: A finite state machine with timers. Each state lights a set of signals; transitions fire when a minimum time has passed and a sensor says a phase is waiting.
- Conflict monitor. An independent circuit that checks the outputs. If it ever sees conflicting greens, it forces every signal to flashing red. Engineering idea: Defence in depth: do not trust the controller alone. The monitor is a separate piece of logic with a list of signal combinations that must never happen at the same time.
- Battery backup. Keeps the junction running for a while during a power cut. Engineering idea: An energy budget: battery energy in watt-hours divided by the LEDs' power gives the run time. Low-power LEDs are what make battery backup practical.
- Inductive loop detector. A loop of wire cut into the road surface that senses a vehicle waiting above it. Engineering idea: The loop is part of an oscillating circuit. The metal of a car above it lowers the loop's inductance, which raises the oscillation frequency. The detector notices that shift and reports 'vehicle present'.
2Part by part
What every piece is for.
- 01
Signal head
The housing with red, amber and green lamps, each under a visor that shades it from the sun.
the idea →Visibility is the requirement. The visors block sunlight that would make an unlit lamp look lit, and the fixed order (red always on top) means colour-blind drivers can read position, not just colour.
- 02
LED module
Each lamp is a panel of many LEDs behind a lens.
the idea →LEDs use a fraction of the power of the old bulbs and last for years. Using many LEDs means one failing does not leave the lamp dark.
Voltage, current and Ohm's lawElectrical power and energy budgets
- 03
Pedestrian button
Registers a request to cross.
the idea →The press is latched: the controller remembers it until the walk phase is served, so pressing again does not make it faster. It is a digital input that sets a flag.
- 04
Controller cabinet
A roadside box with the controller that runs the phases and timings.
the idea →A finite state machine with timers. Each state lights a set of signals; transitions fire when a minimum time has passed and a sensor says a phase is waiting.
Super-loops and finite state machinesReal-time computing on robots
- 05
Conflict monitor
An independent circuit that checks the outputs. If it ever sees conflicting greens, it forces every signal to flashing red.
the idea →Defence in depth: do not trust the controller alone. The monitor is a separate piece of logic with a list of signal combinations that must never happen at the same time.
- 06
Battery backup
Keeps the junction running for a while during a power cut.
the idea →An energy budget: battery energy in watt-hours divided by the LEDs' power gives the run time. Low-power LEDs are what make battery backup practical.
- 07
Inductive loop detector
A loop of wire cut into the road surface that senses a vehicle waiting above it.
the idea →The loop is part of an oscillating circuit. The metal of a car above it lowers the loop's inductance, which raises the oscillation frequency. The detector notices that shift and reports 'vehicle present'.
3The system
How the parts talk to each other.
Almost every machine has the same shape: something senses, something decides, something acts on the world, and a measurement feeds back so the decision can improve.
Inputs(sense)
- Road loopsvehicle present
- Push buttons
- Timers and schedule
Controller(think)
- Signal controllerstate machine
- Conflict monitorindependent check
Actuators(act)
- Signal lamps
The physical system(what changes)
- Traffic at the junction
Signals forward
- Road loops to Signal controllerdemand
- Push buttons to Signal controllercrossing request
- Timers and schedule to Signal controllerelapsed time
- Signal controller to Signal lampswhich lamps on
- Conflict monitor to Signal lampsforce flashing red if unsafe
- Signal lamps to Traffic at the junctiongo / stop
Feedback: the loop closes here
- Signal lamps feeds back to Conflict monitoractual outputs
- Traffic at the junction feeds back to Road loopscars arrive and leave
4The maths
How long should amber last?
A driver who sees amber needs reaction time, then time to brake. Amber must last long enough that a driver too close to stop comfortably can instead carry on safely. This is the basic kinematic rule used by traffic engineers on level roads.
the model
y = t + v / (2a)
- Amber time
- 3.2 s
Go deeper: the worked numbers
Symbols
- y
- amber time (s)
- t
- driver reaction time (s)
- v
- approach speed (m/s)
- a
- comfortable braking (m/s²)
Worked example
- 1.v = 13.4 m/s is about 48 km/h (30 mph)
- 2.y = 1.0 + 13.4 / (2 × 3.05) = 1.0 + 2.2
- 3.y ≈ 3.2 s
5 · Your turn · BUILD: Traffic System
Run a junction
In the Traffic System Build, design the states and timers for a crossroads with a pedestrian crossing. Then try to break it: can any input sequence give two conflicting greens?
runs in your browser, nothing to unscrew
Keep going
Concepts in the Atlas
Builds