Embedded systems · Class project · 2026
Smart traffic light (ESP32)
A traffic light controller that responds to cars, pedestrian button presses, movement at the crossing and daylight, instead of cycling on a fixed timer.
- Role
- Firmware, as part of a class team
- Year
- 2026
- Type
- Embedded systems
- Built with
- ESP32, C++, Arduino IDE, Sensors, State machines
The context
An IoT class project for Spring 2026. The brief was a traffic light that reacts to what is happening at the junction. The difficult part is responsiveness: the controller can't freeze inside long delays while sensors are changing.
What I built
- A car sensor that can extend the green phase.
- A pedestrian button whose request is queued until the next red phase.
- A PIR motion sensor that extends crossing time while someone is still crossing.
- A light sensor that switches the junction to blinking amber when it is dark and quiet.
- A buzzer, a countdown display, and a web dashboard served from the ESP32's own Wi-Fi access point showing the current phase, mode, countdown and latest event.
Try it
green phase
DON'T WALK
Green: traffic flowing
A sped-up browser simulation of the firmware's rules.
Decisions
millis() instead of delay()
The firmware is a state machine driven by millis(), so it keeps reading every sensor while the lights change. A delay()-based loop would miss button presses and cars.
Keep the history
The repository keeps the first prototype, the final sketch, the hardware wiring notes and the test notes, so you can see how the design changed.
Next project
Text and image from one prompt
Or say hello at shaadssem@gmail.com