Smart Traffic Light System

3,539

17

10

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.

Share

    Recommendations

    • Epilog X Contest

      Epilog X Contest
    • Warm and Fuzzy Contest

      Warm and Fuzzy Contest
    • PCB Contest

      PCB Contest

    10 Discussions

    0
    None
    RokayahF

    4 weeks ago

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

    2 replies
    0
    None
    HardikM20RokayahF

    Reply 4 weeks 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.

    0
    None
    RokayahFHardikM20

    Reply 4 weeks 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 ?

    0
    None
    HardikM20Gghaky

    Answer 4 months ago

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

    Please refer to the video.

    0
    None
    mona_05l

    1 year ago

    Can you please help me with the schematics of the board

    2 replies
    0
    None
    HardikM20mona_05l

    Reply 5 months ago

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

    0
    None
    HardikM20

    Reply 1 year ago

    Thank you :)

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

    1 reply