Traffic Lights

This website will tell you everything you need to know about traffic lights from how they work to how they keep drivers safe.


How They Work


Arduino Code for Traffic Lights

This is the code Jaeho and I have made to create a very simple arduino version of traffic lights. The only change we have made is to have green lights on for 10 seconds instead of 35 seconds to speed up the process.

/* Traffic Lights
Cory and Jaeho
2017-05-04
*/

int ledR = 8; //NS red light 
int ledY = 9; //NS yellow ligh
int ledG = 10; //NS green light
int ledR2 = 11; //EW red light
int ledY2 = 12; //EW yellow light
int ledG2 = 13; //EW green light

void setup() {
 pinMode (ledR, OUTPUT);
 pinMode (ledY, OUTPUT);
 pinMode (ledG, OUTPUT);
 pinMode (ledR2, OUTPUT);
 pinMode (ledY2, OUTPUT);
 pinMode (ledG2, OUTPUT);    
}

void loop() {  
  digitalWrite(ledR2, HIGH); //turns EW red light on
  digitalWrite(ledG, HIGH); //turns NS green light on
  delay(10000); //keep NS green light and EW red light on for 10 seconds
  digitalWrite(ledG, LOW); //turns NS green light off
  digitalWrite(ledY, HIGH); //turns NS yellow light on
  delay(3000); //keep NS yellow light and EW red light on for 3 seconds
  digitalWrite(ledY, LOW); //turn off NS yellow light
  digitalWrite(ledR, HIGH); //turn on NS red light
  delay(2000);//keep NS red light and EW red light on for 3 seconds
  digitalWrite(ledR2, LOW); //turn off EW red light
  digitalWrite(ledG2, HIGH); //turn EW green light on
  delay(10000);//keep NS red light and EW green light on for 10 seconds
  digitalWrite(ledG2, LOW); //turn EW green light off
  digitalWrite(ledY2, HIGH); //turn EW yellow light on
  delay(3000);//keep NS red light and EW yellow light on for 3 seconds
  digitalWrite(ledY2, LOW); //turn EW yellow light off 
  digitalWrite(ledR2, HIGH); //turns EW red light on
  delay(2000);//keep NS red light and EW red light on for 3 seconds
  digitalWrite(ledR, LOW); //turns NS red light off
} 

Animation

Here is an animation I have created to show how traffic lights work

Essay

Traffic lights are essential to keeping drivers and pedestrians safe by conducting traffic on busy roads. Traffic lights keep people safe and save cities and people money. They also have other properties like left turn lights and walking signals which are key safety features. Traffic lights also vary from province to province and from country to country.

Traffic lights are essential for keeping busy intersections safe. Without traffic lights, there would be nobody to direct traffic which would lead to many collisions and injuries. Pedestrian traffic lights safely tell pedestrians when to go so they do not have to randomly guess when to run across the street trying to not get hit. The yellow lights give drivers a warning to slow down if they are approaching a light that will soon turn red. Without this safety feature, drivers would not know when to expect a red light, which could lead to drivers slamming the break at an unexpected red light and the driver behind them to crash right into them.

Traffic lights save cities and people tons of money. If there were no traffic lights, cities would have to spend a lot of money on police officers to direct traffic at busy intersections like they do when traffic lights stop working. They also save people money as they prevent a lot of car crashes which could end up with people paying large amounts of money to repair damaged cars.

Traffic lights also have other features besides red, yellow, and green lights. Most traffic lights include left turn lights and pedestrian walking signals. The left turn feature lets one side (either the north south or east west) turn left while stopping people going straight. This allows people turning left to be able to turn without having to worry about driving through the strait lane which has oncoming cars. The pedestrian walking symbol allows pedestrians to walk through the road by stopping cars from entering the lanes which the pedestrians are passing through. They can also click a button which allows the traffic lights to know they are there and lets the pedestrians safely cross the road. This button saves time as it does not go through the loop with the pedestrian light if there is no need for it

Traffic lights also vary from province to province and country to country. All provinces, excluding Quebec, New Brunswick, and Prince Edward Island, have the vertical traffic light with 3 lights unless there is a left turn signal which would add a fourth light. In Quebec, New Brunswick, and Prince Edward Island, they have horizontal lights with different shapes for each the green light, red light, and yellow light to aid colour blind drivers. The green light is in a circle shape, the yellow light is in a diamond shape, and the red light is in a square shape. In British Columbia, a flashing green light means you should look at for pedestrians as they have the right of way. In most countries in Europe, if the red and yellow lights are on at the same time it means the light is about to turn green. In Sweden, a white ‘S’ means only public transit vehicles can go. This is similar to Oregon, Ontario, Quebec, British Columbia, Nova Scotia, Manitoba and Alberta where a white rectangle above the red light means public transit can go while all other traffic is stopped. In Australia, New Zealand, United States, and Canada a red flashing light means the same thing as a stop sign. In the United States, they have light bulbs on the traffic lights which flash according to the colour of the emergency services in that region to show drivers an emergency vehicle is coming and needs to cross the intersection. In Tianjin, China, they have ‘bar lights’ which show a bar with the colour of the light (red, green or yellow) and the size of the bar changes to indicate how much time is left with that colour.

Traffic lights keep people safe, save money, have special features, and can vary in different regions of the world. They keep people safe by directing traffic and warning drivers when to stop. They save money by directing traffic without police and prevent crashes. They have special features like left turn lights and pedestrian walking signals which keep people safe and save time. Traffic lights also vary in different regions of the world to fit specific areas needs.