The Most Reliable Traffic Lights
We began thinking of something sophisticated to create using the Arduino and the breadboard. We thought of various systems that use coloured lights in a complex nature, which we could program and replicate using the LED’s. The traffic light system in the UK runs a constant loop to ensure the consistent flow of traffic on the roads, making it safe to drive, and cross for pedestrians.
We identified unique features of the traffic light system, such as:
· Sounds and Lights to inform a pedestrian when to cross, and when not to.
We created sudo code of the process the traffic lights take to inform drivers of what to do. Taking into detail that when going on the green light, both amber and red show. Whereas when the lights turn to red, only the amber light shows. A lot of people think that once one light goes on red, the other will go straight to green. This is incorrect, as all lights display red for a couple of seconds. This is in place in case anyone skipped the red light, or somebody was unable to safely stop at the junction.
We took all of these details into consideration and created a sudo code plan of the process the lights would take.
When writing the looped code in the Arduino IDE, we used our Sudo Code, reducing the chances of any errors occurring. This helped speed up and improve the process dramatically. We also ensured we implemented the use of variables within our code, giving us the ability to adjust the code as and when needed by changing one value, rather than several values within the code.
After doing this, we implemented a pedestrian crossing to our Arduino setup, by adding an RGB LED, which changed from the colour red, to green to inform the pedestrian when to cross. We also added a buzzer which buzzed to allow partially sighted people know when to cross. We added an extra feature to the pedestrian light that traffic lights don’t currently have in the UK. We coded the green light to also dim to represent how much time was left in order to cross. Traffic lights in the UK don’t currently do this, so a person may begin to cross as the green man turns to the red man.
We tested the code as we went along, to ensure errors were reduced, and adapted the code accordingly if mistakes had been made.