Traffic Light Controller Design: Phases, Timing and Safety Interlocks

Many junctions in Nepal's growing cities still run on hand signals or no control at all. A signal controller looks simple: red, amber, green, repeat. The hard parts are the timing between phases and the rule that two conflicting directions must never see green together, whatever goes wrong inside the controller.
Phases: who moves when
A phase is a set of movements that can run at the same time without crossing each other. At a plain 4-way junction there are two common plans:
- Opposing phases. North and south go together, then east and west. Fewer phases and shorter waits, but right-turning vehicles must give way to oncoming traffic.
- Split phases. Each approach gets its own green in turn. Slower overall, but much safer where right turns are heavy or the junction is awkward.
The right plan depends on traffic counts. A busy approach with many right turns usually justifies its own phase.
Amber time: long enough to stop safely
When a light turns amber, a driver must either stop comfortably or clear the stop line. The standard way to calculate amber duration is:
Y = t + v / (2a)
where t is the driver's reaction time (about 1 s), v is the approach speed in m/s and a is a comfortable deceleration (about 3 m/s²).
For a 40 km/h approach (11.1 m/s):
Y = 1 + 11.1 / 6 ≈ 2.9 s, which rounds up to 3 s.
Faster roads need longer ambers. 3 to 5 s covers most urban junctions.
All-red: clearing the junction
After amber, every approach shows red for a short all-red interval so that a vehicle that entered on the last of the amber can get across before the next phase starts:
R = (W + L) / v
with W the width of the junction and L a vehicle length. For a 20 m junction, a 6 m vehicle and 11.1 m/s:
R = 26 / 11.1 ≈ 2.3 s
Skipping or shortening all-red is one of the most common causes of right-angle crashes at signals.
Pedestrian phases
Pedestrians need a walk signal and enough time to cross. Design guides typically assume a walking speed of 1.0 to 1.2 m/s. A 14 m road at 1.0 m/s needs at least 14 s of clearance after the walk signal ends, more where many elderly people or children cross. A push button lets the controller add the pedestrian phase only when someone is waiting, so traffic is not held up for an empty crossing.
The conflict monitor: the most important part
Software has bugs and relays fail. A safe controller does not just trust its own sequence. It checks the outputs it is actually driving and refuses to show conflicting greens.
A conflict monitor:
- Defines which signal pairs conflict, for example north green and east green.
- Reads back the real state of every output, ideally from the lamp circuit and not just the command.
- If a conflict appears for even a moment, forces the junction into flashing amber (or all-red) and latches the fault until a technician resets it.
Dedicated hardware conflict monitors exist for exactly this reason. Even in a small microcontroller design, the check should be independent of the sequencing code.
Other modes worth having
- Night flashing. At low traffic, flashing amber on the main road and flashing red on the side road keeps traffic moving with fewer pointless stops.
- Emergency pre-emption. A switch or signal that gives green to the approach an ambulance is coming from, after a proper amber and all-red on the others.
- Manual control. For traffic police during events or faults.
- Power-up sequence. Start with a period of flashing or all-red, never straight into green.
From simulation to a real junction
My traffic light controller project implements a 4-way junction with a conflict monitor, pedestrian, night and emergency modes. An automated test checks that two crossing greens never light together. The same firmware is adapted to real junctions with layout drawings, timing plans and commissioning checklists.
A real installation also needs proper lamp drivers, surge protection, an earthing system and a cabinet that survives monsoon rain. If you are planning signalisation for a junction, contact me.