Automatic Traffic Light

Creator – Tejal Sonawane  |   Technology – Arduino  |   Category – Beginner

Code your Red, Yellow and Green LED
lights with Timer to build your own traffic signal.

What is a Traffic Light?

A traffic signal, also known as a stoplight, controls vehicle traffic passing through the intersection of two or more roadways by visually indicating to drivers when to proceed, slow down, or stop.

These signals may be controlled by a simple timer that allows traffic to flow on one roadway for a set period of time, then on the other roadway for another set period of time before repeating the cycle.

A modern traffic signal system is made up of three basic subsystems: the signal lights, the supporting arms or poles, and the electric controller. Signals typically consist of three lights: a green light at the bottom indicating that traffic may proceed, a yellow light in the middle indicating that traffic should slow and prepare to stop, and a red light at the top indicating that traffic must stop. The electric controller is typically housed in a weather-proof box on one of the intersection’s corners.

What do we need?

For implementing this project we will need –

  1. Traffic light PCB’s by Science Kidz ( Or, you can use open LEDs if you know the connections. )
Traffic Light Led

2. Arduino Nano Shield by Science Kidz ( Arduino Nano ) 

3. Connector by Science Kidz ( Or use 4 F – F wires. )

Connecting wires

Connections -

The three LED lights must be connected to three pins on the controller board. Connect the wires from the Traffic Light PCB to the slot on the Controller board labelled “Traffic Lights.” Connect these to D12, D18(A4), and D19 digital pins (A5).

Connection of the traffic light

Planning your code -

Algorithm –
  1. Turn ON Red LED, Turn OFF Yellow and Green LED.

  2. Wait 3 seconds.

  3. Turn ON Green LED, Turn OFF Yellow and Red LED.

  4. Wait 3 seconds.

  5. Turn ON Yellow LED, Turn OFF Red and Green LED.

  6. Wait 3 seconds.

  7. Repeat in a loop.
        Flowchart –

Code Implementation -

Code –

Setup -> Define LED pins
Loop -> Logic to control LEDs

Download code as text file

Output -

Video Output –
Model Assembly –

Final Output –

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on whatsapp
WhatsApp

Did you like this project? Share it with your friends.

Leave a Reply