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.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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:




Ultrasonic Sensor:



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

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    10 Discussions


    10 months ago

    Did u connect any external voltage sources, i can see a black thing in the photo is it a battery ?

    2 replies

    Reply 10 months ago

    No I didn't connect any external voltage sources. The black box was just to give servo motor a heavy base, so that it doesn't fall back.


    Reply 10 months ago

    well, i tried to do it
    but it have two problems
    first the sensor wasn't reading, i tested it alone and it didn't work as well so i will change it and try again
    but the other problem is that my servo is not rotating ?


    Answer 1 year ago

    Servo Motor is used to rotate the Ultrasonic Sensor to both the sides (left and right).

    Please refer to the video.


    2 years ago

    Can you please help me with the schematics of the board

    1 reply

    Reply 1 year ago

    I have stated them in the post above.Please refer to that.

    Great Arduino system. I am thinking about making a simplified version of this for my son's model car toys.

    1 reply