How Are Traffic Lights Programmed? Timers to AI

Traffic lights are programmed using a combination of preset timing plans and real-time sensor data, all managed by a controller unit housed in a metal cabinet near the intersection. The simplest intersections run on fixed schedules that cycle through green, yellow, and red at set intervals. Busier or more complex intersections use sensors to detect vehicles and pedestrians, adjusting green time on the fly based on actual demand.

Fixed-Time vs. Actuated Control

Traffic signals fall into two broad categories. Fixed-time (or pre-timed) signals repeat the same cycle regardless of traffic conditions. Each direction gets a green light for a predetermined number of seconds, then yellow, then red, in a loop that never changes. These are common in dense downtown grids where traffic is relatively predictable and intersections are closely spaced. Even when these intersections use modern controller hardware, the phases are simply locked to their maximum time so they behave like a clock.

Actuated signals are more flexible. They use vehicle detectors to decide which direction gets a green light and for how long. If no cars are waiting on a side street, the main road keeps its green. When a vehicle pulls up on the side street, the controller registers the demand and works that phase into the cycle. Most suburban and arterial intersections in the U.S. run some form of actuated control, because traffic volumes swing dramatically between rush hour and late night.

A hybrid approach is also common: the main road phases run on a fixed schedule while the side streets and left-turn arrows are actuated. This lets engineers guarantee a minimum green for the busiest direction while still responding to lighter movements only when vehicles are present.

How Sensors Detect Vehicles

The most widely used detection technology is the inductive loop detector, those rectangular or circular wire loops cut into the pavement that you can sometimes see as dark lines in the road surface. When a vehicle’s metal mass passes over the loop, it changes the loop’s electromagnetic field, and the controller registers a vehicle. Inductive loops remain popular because they’re cheap, reliable, and invisible once installed.

Video image processors are increasingly common. Cameras mounted on signal mast arms or poles adjacent to the roadway use machine vision to identify vehicles in specific lanes. Unlike loops, video detection doesn’t require cutting into pavement, making it easier to maintain and reconfigure. Microwave radar sensors, mounted over lanes or beside the road, detect vehicles by measuring reflected radio waves. Some intersections also use ultrasonic sensors, passive infrared detectors, or laser radar, though these are less common for routine signal control.

The choice of sensor depends on budget, climate, and maintenance preferences. Loops can fail when pavement cracks or is repaved. Cameras can struggle in heavy rain, snow, or direct glare. Many newer installations use a combination of technologies for redundancy.

What’s Inside the Control Cabinet

That gray or beige metal box you see on the corner of a signalized intersection holds all the electronics that run the light. The core component is the controller unit, a specialized computer that takes input from vehicle and pedestrian detectors and translates it into output commands for each signal head. Engineers program the controller with timing parameters: minimum and maximum green times for each phase, yellow intervals, all-red clearance periods, and the rules governing the sequence of phases. A standard controller handles up to eight phases, covering movements in all directions including protected left turns.

Load switches sit inside the cabinet and act as intermediaries between the low-voltage controller (which runs on 12 or 24 volts DC) and the 120-volt AC power that actually illuminates the signal heads. Each vehicle phase, pedestrian phase, and overlap movement gets its own load switch.

The most critical safety component is the conflict monitor, a device that operates completely independently from the controller. It continuously watches for dangerous conditions: conflicting green signals that would send two streams of traffic into each other, burned-out red lamps, improper sequencing, or incorrect timing. If it detects a fault, the intersection immediately goes to flashing red (all-way stop) and stays there until a technician resets it. The monitor logs the type of fault, which signal faces were active, and historical data for troubleshooting.

Pedestrian Timing Calculations

Pedestrian signals aren’t arbitrary. Federal guidelines specify that the walk and clearance intervals must give a person enough time to cross the full width of the street at a walking speed of 3.5 feet per second. For a crosswalk that spans 50 feet of pavement, that means roughly 14 seconds of clearance time after the flashing hand appears.

At intersections where slower pedestrians or wheelchair users regularly cross, engineers can lower the assumed walking speed below 3.5 feet per second, which extends the clearance time. Some intersections offer an extended pushbutton press: holding the button for a few seconds longer triggers a slower crossing speed calculation, giving people who need more time a longer signal without slowing down every single cycle. The total of the initial walk phase plus the flashing clearance phase must be enough for someone starting 6 feet from the curb to reach the far side at 3 feet per second.

Coordinating Multiple Intersections

On major corridors, individual intersections don’t operate in isolation. Traffic engineers synchronize signals along a stretch of road so that a driver traveling at the target speed hits green after green, a pattern often called a “green wave.” This coordination relies on three key parameters: cycle length (how long the entire red-green-yellow sequence takes), split (how the cycle is divided among competing phases), and offset (how many seconds after the master clock each intersection starts its green).

Getting the offset right is the whole game. If two signals are 1,500 feet apart and the target speed is 30 mph (44 feet per second), the downstream light needs to turn green about 34 seconds after the upstream one. Engineers typically create separate timing plans for peak hours, off-peak periods, and weekends, since the ideal progression changes with traffic volume and direction. Cycle lengths of 60 seconds work well on transit routes because shorter cycles mean less waiting for buses and side-street traffic. During peak hours, cycle lengths can stretch to 90 or 120 seconds to move larger volumes on the main road, though longer cycles mean longer waits for everyone on the cross streets.

Progression speeds are deliberately set at or below the posted speed limit rather than matching the speed most drivers actually travel. This discourages speeding: if you drive 40 in a 30 zone, you’ll hit red lights instead of being rewarded with greens.

Emergency Preemption and Transit Priority

Emergency vehicles can override normal signal timing through preemption systems. The most common technology uses optical emitters, devices mounted on fire trucks and ambulances that send coded pulses of infrared or visible light toward a receiver on the signal mast arm. When the receiver picks up the signal, it tells the controller to clear conflicting phases and give the approaching emergency vehicle a green light as quickly as safely possible. The system works at a distance of several hundred feet, giving the intersection enough time to cycle through yellow and all-red clearance before the vehicle arrives.

Transit vehicles use a similar but lower-priority version. Instead of forcing an immediate green, transit priority either extends a green that’s already active or shortens the red phase slightly. The bus gets through a little faster without completely disrupting the cycle for everyone else. Both systems require matched hardware: an emitter on the vehicle and a compatible detector at the intersection.

Adaptive and AI-Based Systems

Traditional signal timing relies on engineers studying traffic counts and programming plans in advance. Adaptive signal control takes this a step further by adjusting timing in real time based on current conditions. These systems continuously collect data from detectors across a network of intersections and recalculate optimal splits, offsets, and cycle lengths every few minutes.

More recently, researchers have been testing AI models that use reinforcement learning, where the system essentially experiments with different timing strategies and learns which ones reduce delay. In controlled experiments, these approaches have increased intersection throughput by about 17.5%, reduced average vehicle delay by roughly 19%, and cut queue lengths by over 22% compared to conventional timing. Real-world deployment is still limited, but several cities are running pilot programs on high-volume corridors where even small efficiency gains translate to meaningful reductions in congestion and emissions.