We all have it to some degree and we all know somebody who has it worse than us—road rage! The Traffic Light Controller teaches you street smarts, giving you the knowledge to keep your road rage at bay. If you understand what's going on with the red light, maybe you'll be able to wait more patiently for the green light!
Traffic light setup using an Arduino, LEDs, and 330Ω resistors!
You see, my wife, Debra, and I love taking our Sunday drives but we're sick of sitting at red lights. I figured I could build something to control the traffic lights so we always have green.
I eventually realized that the original project was merely for LEDs and couldn't actually control a real traffic light, but I built the project anyway and thereby gained an understanding of why traffic lights can't switch from red to green solely for our driving convenience. The Traffic Light Controller helps keep Debra and me levelheaded in road-rage situations—ultimately saving our marriage!
Debra, Lazy T, Busy B, and Me!
It's really a pretty simple concept and makes even more sense with the chart below. The code uses For loops and delay statements to implement the on-time for each LED.
The two streets in our example, Busy Bunny Lane and Lazy Tortoise Ave, have different traffic volumes, and thus one has a longer green light (and a shorter red light).
Busy Bunny Lane is pretty . . . well, busy. It has a green light that stays on for 12 seconds. There is much less traffic on Lazy Tortoise, and the city has declared that it needs a green light that stays on for only one-third of the time of Busy Bunny's. So it gets a 4-second green light. Fair is fair.
As Busy Bunny switches from green to yellow to red, Lazy Tortoise briefly maintains its red light in case any stragglers try to make a last-minute dash through the busy intersection. So don't forget about this red-light-overlap interval if your mayor ever asks you to design the traffic light system for your town's newest intersection. When the coast is clear, Lazy Tortoise gets the green light it has been patiently waiting for.
This chart will help you understand the traffic light timing. Taken from the original project.
When Lazy Tortoise reaches its red light, there is another red-light-overlap period, and then the loop restarts! Of course, this is a pretty basic, antiquated traffic light. Modern traffic lights are "smart"—they detect vehicles, adjust their own timing, and make interruptions for crosswalks. There is always room for improvement!
Remember, MIT-i is filmed on set, in front of a live studio audience. The Traffic Light Controller, or any other MIT-i innovation, should not be used in a vehicle or while operating machinery. Road rage is not an excuse to fight with your loved ones.
We think it's great when viewers take our project, modify it, and make it their own. Turn this boring intersection into a "smart" one by adding a crosswalk interruption button! You can even change light patterns based on the time of day! Take this knowledge and run with it, and remember to share your creations!
Give this project a try for yourself! Get the BOM.
Other MIT-i Innovations:
- The Cat-Apult! (an Arduino-controlled servo for makers)
- The Launchpad-Based Laser Tripwire Alarm! (a Launchpad security system)
- The Arduino UNIVERSAL Remote Control! (an IR receiver for your entire house)
- The Crop Duster Buster! (a clap-controlled odor-management system)