Introduction: Smart Traffic Light System

About: I am a Internet Of Things Enthusiast,who likes building projects and learning new exciting things.

So,Here I am publishing my first ever instructable.It is Quite Exciting I must say.You might be wondering why Traffic Light System...duhh!!Even a rookie could make it.But just wait we have a twist (^_^)...In India we basically have a problem with people here...The PATIENCE problem...i have usually noticed that people usually run out traffic lights there by breaking the rules...although i understand they think that why should we wait even when there's no traffic in other lane?right.So i have built a Smart Traffic Light System which could actually save a lot of accidents and save people from tickets due to over running lights(Traffic Police here is really Strict about this :P).

What this does is it performs the basic functioning of a traffic light.But it keeps on checking for traffic in both the lanes,if a situation arrives that there is no traffic in lane1,the lights for lane 2 do not go red,but stay green and as soon as traffic is sensed on lane 1,light for lane 2 turns back to yellow and then red.

So in this way any of the traffic in lane 1 does not have to wait unnecessarily.

Step 1: Hardware Required

  • Arduino Uno R3
  • Servo Motor
  • Ultrasonic Sensor(HC-SR04)
  • Breadboard
  • Red,Yellow,Green LEDs (X2)
  • Jumper wires: 4 female to male,rest male to male.

Step 2: Connections

Make the Connections as stated Below:

Lane 1:

RED LED==============>7(Digital pin)

YELLOW LED===========>6(Digital pin)

GREEN LED============>5(Digital pin)

Lane 2:
RED LED==============>13(Digital pin)

YELLOW LED===========>12(Digital pin)

GREEN LED============>11(Digital pin)

Servo Motor:

SERVOPIN===========>3

VCC================>5V

GND================>GND

Ultrasonic Sensor:

VCC================>5V

GND================>GND

TRIG PIN============>9(Digital Pin)

ECHO PIN===========>10(Digital Pin)

Step 3: Coding

Download this code mentioned below.

Open the Arduino Software and upload this sketch to your arduino after you have made the connections.

and Tada!!you have your smart traffic light system for two lanes.

TRY IT OUT and do tell me in comments if you have any queries.

Thank you.

Step 4: Videos

Sorry for the short videos,but i think you can understand the functionality by this.

the orange cover signifies the traffic.Look for the Lights on Breadboard.

Lights Contest 2017

Participated in the
Lights Contest 2017