How Traffic Lights Work
Traffic lights (or traffic signals) are one of the oldest technologies of the modern world. The first traffic light appeared in 1868 in London, an adaptation of the railroad semaphore which had come into existence only a few years before. Back then, of course, it was powered by burning gas. An unfortunate explosion ended the experiment and the idea was not revived until it was adapted for electricity in the 1912.
Since then, the traffic light has undergone numerous technological advances as transportation engineers work to reduce congestion in cities and make provision for emergency vehicles and situations.
A traffic light consists of three key components:
the lights which signal traffic and pedestrians
sensors which detect traffic (inductive loops in the road or cameras mounted overhead)
a controller which controls the lights based on pre-determined timings and signals from the sensors
As a traffic signal systems engineer in the public sector for several years, I've heard countless questions about the confusing nature of traffic lights. So, I've designed this article as a sort of FAQ about the operation of traffic lights based on the most common questions and misconceptions I have encountered in my professional experience.
How does the traffic light make sure it won't give green lights in the wrong directions?
Many people probably never think about this, but it's a pretty critical part of the operation of a traffic light. The controller (housed inside the cabinet near the intersection) is programmed to ensure each direction gets a green light in the proper order. As a safeguard, sitting right next to the controller is a box called a conflict monitor. The conflict monitor directly monitors the electricity in the wires powering the lights. If it sees two wires get energized that would cause a conflicting signal, it puts the intersection in a condition called "red flash". The conflict monitor also checks for other possible failures that could cause an accident and overrides the controller as necessary.
What do I do when the lights flash red? Or yellow?
These are less-common conditions known as red flash or flashing yellow. In the U.S., a flashing yellow light means to proceed carefully and yield to traffic that may be in the intersection. A light flashing red is to be obeyed as if it were a stop sign. If all directions of an intersection are flashing red, U.S. traffic laws require the intersection is to be treated as if it had stop signs in every direction, even if there are no stop signs present.
How does the traffic light know I’m here?
The traffic light is triggered most often by sensors called inductive loops. An inductive loop is simply a wire buried about 4-8 inches in the pavement, usually in front or behind the stop bar. One lane of traffic may have several loops cut into the pavement. Very often you can see the loop outline in the road surface. In the U.S. it's typically shaped like a large rectangle, though circular shapes have been used.
The technology behind inductive loops is hardly new. It’s based on electromagnetism, a theory put forth by James Maxwell in 1873. Maxwell gave us the idea that magnetism and electricity go hand-in-hand. You can’t have one without the other when a conductive material (like metal) is present.
The inductive loop takes advantage of this principle when a small electric current passes through it and a magnetic field is generated, extending two or three feet upward. If you park your car (with a big, heavy, metal frame) over that loop, the loop’s magnetic field will try to generate an electrical current (albeit a *very* small one) in your car’s frame. To explain it simply, there's only so much electricity to go around, so if the magnetic field generates electricity in your car frame, it has to take electricity from the loop to do it. The controller sees that drop in the electric current and gets “actuated” or triggered, which gives you a green light.
What about those cameras? Don't they create privacy issues?
Have you noticed the cameras mounted near the traffic lights? Yes, they are real cameras, but they serve only as vehicle detectors (replacing or augmenting inductive loops). Video detection is a relatively new technology, but it has a few advantages over inductive loops. For example, they can be reprogrammed very easily for new lane configurations (say, as a result of a construction project), whereas new loops would have to be individually cut into the pavement itself. Further, one camera can serve the function of many loops for a direction of travel.
Of course, in an age where controllers can be networked and accessed over the internet (some even run the Linux OS these days!), the video cameras can provide a live video feed of the intersection for the owning agency. But if you’re concerned about privacy issues with video vehicle detectors, there’s not really much to get concerned about. Owning agencies typically use the video feed from their cameras to verify that the cameras are working properly and really little else.
The reason for that is simple: video detection cameras don't need to be high resolution to do their jobs well. Because they aren't high-resolution, it's impossible to identify any real (perosnal) details about vehicles or their drivers as they pass through an intersection. Even if the cameras were of sufficiently high-quality, few agencies have the budgets to afford he staff and equipment to monitor those video feeds. In other words, it's just not a useful or valuable thing to do.
To make my case, I point to the recent trends abandoning real-time highway surveillance. Take, for example, red-light running cameras, which are installed in advance of the intersections to catch people who disobey a red light. Ten years ago (in the early 2000's), they were seen as a great way to reduce / eliminate accidents from cars running red lights and generate additional income from the tickets issued to violators. However, it has not proven to be the “cash cow” that many thought it might be and it's effectiveness in reducing or eliminating red light violations is questionable. 
Why does the light take so long to change?
Traffic lights are driven by a controller which has a set of timings for each "phase" or type of movement. They are intended to keep traffic moving efficiently and prevent accidents.
For example, when the light for a direction goes to yellow, it stays yellow for maybe 2 or 3 seconds to give cars who can’t stop in time a chance to get out of the way. Then, when it goes red, it waits another one or two seconds. Again, this gives cars which may have entered the intersection as the light turned red a second or two to clear it.
Providing these clearance timings helps control driver behavior. If signals didn't give this extra time, it would encourage drivers to "race" the lights, encouraging erratic and dangerous driving habitss.
You may also notice that a light stays green even if there's no cars present. Chances are, you're seeing the “minimum green” timing working. This timing gives any other cars that may be close a chance to get through the intersection. Of course, a failing inductive loop could also cause this behavior. So, if the light is green for 20 or 30 seconds after traffic has cleared, it's a good clue that there's something wrong with the inductive loop. In this case, the controller is compensating with a fixed time to ensure a green light is given.
How do traffic lights stay synchronized?
Synchronization is really called “coordination”. In cities where several intersections are closely spaced, coordination plans are used to help move large volumes of traffic efficiently. You'll know coordination is working if they all tend to go red and green at the same times. Coordination is a double-edged sword, though. Optimizing for one direction automatically hurts it in the other. Finding the balance can be tricky, especially if traffic patterns change frequently.
More recent technological advances have given controllers the ability to sense traffic changes and adjust their timings immediately. Advanced sensing systems like infrared camera detectors are constantly supplying traffic volumes to the controller. The controller then takes those numbers and determines the best way to time the signals.
How Do Walk / Don't Walk Lights Work?
Walk - This light is typically short in duration (5 to 10 seconds). It signals pedestrians waiting to cross that they can safely enter the intersection - the controller has made sure traffic that could harm them has a red light.
Don't Walk (flashing) - This light can last 20 seconds or more, depending on the size of the intersection. It signals pedestrians waiting to cross to stay where they are - there isn't enough time for them to cross safely. It also serves as a warning for pedestrians in the crosswalk that their time to get across safely is running out.
Don't Walk (solid) - The controller has now given green lights to traffic that could harm pedestrians in the roadway. No pedestrians should be in the road.
I don’t like LED traffic lights. Why did they get rid of incandescent bulbs?
As the technology improved, later generation bulbs have fewer, more powerful LEDs so they last longer and burn brighter.
What’s especially interesting is that while LEDs suffer in the heat (their highest recommended operating temperature is around 90 degrees Fahrenheit), they thrive in the cold. They’ll actually burn more brightly (and last longer) in the winter than they do the summer!
The obvious benefit of LED technology is the cost savings. In my experience, one midwest city saved over $150,000 per year in energy savings by switching to LED (that’s because a typical LED bulb uses maybe 10% - 20% of the energy it’s incandescent cousin requires). The maintenance supervisor for that city told me that they used to be replacing bulbs throughout the city several times a week. With LED bulbs, that number dropped drastically and he now spends very little time each month dealing with burned out bulbs.
How do the lights know to change for ambulances and fire trucks?
If you live in a city, it’s possible you have seen this happen. It’s called Emergency Vehicle Preemption (EVP). It works with a special sensor mounted near the lights overhead, one facing each direction. An emergency vehicle approaching the intersection signals the sensor facing it causing the controller to override it’s programming to give the emergency vehicle the green light.
EVP is a great idea and works well, but in my opinion, it’s a bit unsafe, because it could cause a light to turn red too quickly. Drivers could easily miss the light change (and have) and find themselves in an accident with a speeding ambulance or fire truck. This sort of override is designed to be as safe as possible, but it still creates an element of danger. Thus, the use of EVP is limited strictly to emergencies.
What else is there to know?
Plenty, if you're really interested.
The traffic light really is a highly-engineered device designed around the habits and behaviors of drivers and pedestrians. Despite the simple nature of it's operation, traffic engineers are constantly applying the latest technologies in an effort to make them smarter and better at anticipating the needs of the traveling public while protecting them, if only from themselves.