Anyone can control these IoT-enabled dorm room traffic lights
IoT-raffic Lights
Sometimes you need a project that can really motivate you to go—or in this case, also slow down and stop. Today we've got just such a creation thanks to maker and developer Riley Hutton. With the help of an ESP32 microcontroller, he's managed to modify a decommissioned traffic light so that anyone can control it remotely from a web browser.
According to Hutton, the project began as a decorative light piece for his dorm room at University. The idea was to make it web-controlled so that other students could check it out and activate the lights from a webpage. After it was completed, however, Hutton decided to release the project to the world by posting a link to a livestream video of the traffic light over at Reddit. This was met with great success and thousands of visitors visited the website to interact with the salvaged hardware.
We took the opportunity to reach out to Hutton who shared more details about the project and its creation. Hutton confirmed that at one point, the website had over 12,000 visitors and 100 people trying to change the light at once. This was enough to blow the green light, forcing a rapid repair. The traffic lights will change instantaneously but there is a 3 to 4 second delay in the video feed.
You can view the livestream and control the traffic lights via the embedded content below.
Trying to control a traffic light can be tricky, especially if you haven't tinkered with one before. Hutton explained that he found a transformer behind each bulb that's used to step down the UK mains outlet 230V power to a modest 12V AC. To control these transformers, he's using solid state relays instead of mechanical relays as they silently operate (although we do love the click of a mechanical relay.)
Hutton chose the ESP32 after using the ESP8266 in a myriad of projects. The ESP32 has a faster clock speed, providing extra bandwidth for the many users attempting to DDOS a traffic light. Programming the ESP32 was made possible via the Arduino IDE, Hutton also took the opportunity to add an OLED display for debug purposes.
We know what you are thinking. "Could a Raspberry Pi Pico W do the same job?" The answer is yes, and the Raspberry Pi Pico 2 could also do a great job, you'll just need to hack Wi-Fi onto it... with an ESP32!
The ESP talks to the web app using an MQTT broker with the help of Amazon Lightsail. The webpage uses this MQTT broker to receive the user input. The ESP32 subscribes to the correct MQTT topic, then waits for input. As a user clicks on the web app, it publishes a message via MQTT to the broker, where the subscribing ESP32 is waiting. This provides real-time control of the lights used in the traffic lights, with only a few seconds delay being visible on the YouTube livestream
Stay On the Cutting Edge: Get the Tom's Hardware Newsletter
Get Tom's Hardware's best news and in-depth reviews, straight to your inbox.
If you want to see this project in action, you can check it out over at Riley Hutton's website. Hutton will be a guest on a future episode of our show, The Pi Cast.
We also recommend perusing our list of best Raspberry Pi projects for more cool creations from the maker community.
Ash Hill is a contributing writer for Tom's Hardware with a wealth of experience in the hobby electronics, 3D printing and PCs. She manages the Pi projects of the month and much of our daily Raspberry Pi reporting while also finding the best coupons and deals on all tech.
-
kanewolf Kind of like the lights in season 1 episode 9 of "The Big Bang Theory" -- then "Somewhere in China" ....Reply