Sitting in silent frustration is something that all drivers have experienced. Especially when you're in a rush and sitting at a red light with no other cars in sight. You cannot break the traffic laws so you can do nothing except sit there and wait for the light to turn green for what feels like an eternity.
The idea behind this traffic light motion sensor project is to use infrared motion sensors to trigger traffic lights at intersections as opposed to the inductance loops that are currently being used. This will reduce the amount of time that the car has to wait before getting a green light if there are no cars at the opposing lights. The intersection will function based on car densities at each light and will act accordingly.
This project also incorporates a crosswalk that will override the signal that the motion sensor sends to the traffic light once a pedestrian clicks the button. The pedestrian is given the right of way and ample time to safely cross the street before the cars trigger the motion sensor, activating the traffic light again. There is also a streetlight that automatically turns on when it becomes dark outside to help improve visibility.
Components and Communication
The motion sensor used in this project is an infrared motion sensor that detects any changes in infrared light when an object passes it. It is connected to Particle Argon 1 and is being supplied with 3.3V and connected to ground.
The LED traffic lights are attached to Particle Argon 3, where each LED is connected to a different digital pin in order to be able to write them to high or low, depending on the signal from the motion sensor.
The push button, photoresistor, and simple LED light are connected to Argon 3. The photoresistor and push button are supplied with 3.3V and grounded.
Argon 1 runs the motion sensor code and directly communicates with Argon 3 which runs the code for the traffic light responses. Argon 2 runs the code for the push button crosswalk which also communicates with Argon 3. This communication occurs via the Particle IDE's publish and subscribe functions.
Argon 2 also runs the code for the streetlight. However, that code operates independently and requires no communication with the other Argons in order to operate appropriately.Functions
We wanted the traffic lights to turn green when motion was detected by the motion sensor to reduce any unnecessary time spent at the stop light. This was accomplished by having the signal generated by the motion sensor publish the event "vehicle_detected" to the Particle Cloud.
Crosswalks are found at most intersections on busy streets to avoid accidents with pedestrians. Some streets use a looped timer to determine when pedestrians may cross. This system's push-button crosswalk allows pedestrians to make themselves known to the traffic light, which benefits both human and vehicular travelers.
We wanted to give pedestrians priority in our system. This was accomplished by using a photoresistor, resistors, a simple LED light, and a push button. Once the button is pushed, the code publishes the event "button-pushed," which turns the traffic light red in order to allow pedestrians to cross safely.
At night, a new danger presents itself to drivers and pedestrians in the form of driver visibility. As darkness approaches, driver visibility decreases drastically. To prevent accidents, our system implements an LED streetlight, which provides much-needed visibility to drivers approaching the traffic light.
Once the environment darkens, the photoresistor will trigger the LED light, improving visibility for both drivers and pedestrians.
Long waits at traffic lights were the inspiration behind this IOT project. The wait times were reduced by using the motion sensor.
Using the published events from Argons 1 and 2, Argon 3 was able to react to them accordingly with the subscribe function. In full, when motion is detected and the subsequent event is published by Argon 1, that event is detected by Argon 3. Argon 3 then turns the light green, enabling cars to go. When the crosswalk button is pushed, an event published by Argon 2 is detected by Argon 3. However, this event overrides the motion sensor which turns the light yellow, then red, allowing the pedestrians to cross safely.
Figure 5 shows the complete setup with the components. In the Figure you can see the use of the motion sensor, push button, photoresistor, traffic light, LED light, and resistors.
The graphs in Figures 6 & 7 display data collected from the motion sensor and sent via an HTTP Request to external software Beebotte. The graph on the left side of the dashboard shows when a car approaches the motion sensor and triggers the traffic light system. The graph on the right measures the amount of traffic flowing through the system at each triggering of the motion sensor. The higher the peak, the more traffic going through the light. Lastly, the gauges on the bottom detect which LED on the traffic light is on at any given time.