Smart Traffic Light System

6,730

17

10

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

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    10 Discussions

    0
    RokayahF
    RokayahF

    2 years ago

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

    0
    HardikM20
    HardikM20

    Reply 2 years 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
    RokayahF
    RokayahF

    Reply 2 years 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
    Gghaky
    Gghaky

    Question 2 years ago on Step 1

    Why is the servo motor used?

    0
    HardikM20
    HardikM20

    Answer 2 years ago

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

    Please refer to the video.

    0
    mona_05l
    mona_05l

    3 years ago

    Can you please help me with the schematics of the board

    0
    HardikM20
    HardikM20

    Reply 2 years ago

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

    0
    DIY Hacks and How Tos

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

    0
    HardikM20
    HardikM20

    Reply 3 years ago

    Oh Great,best of luck and I believe he's going to love it. :D