Traffic Signal Using Arduino and Ultrasonic Sensor

4,638

2

2

Introduction: Traffic Signal Using Arduino and Ultrasonic Sensor

About: I am an electronic engineer and i have been working on embedded system , Iot and Artificial intelligence.

With the era of smart technologies, everything is getting smarter and smart transport system is one of the fields which is going to put a huge impact on our lives.

Orignally published at: https://highvoltages.co/tutorial/arduino-tutorial/traffic-signal-using-arduino-and-ultrasonic-sensor/

Arduino being one of the easiest microcontrollers to use, easy to program, easily available in local markets is popular among the students and hobbyists.

Knowing all that, I put my knowledge to make this Density-based traffic signal using Arduino with all the components that are easily available.

This project is a prototype of density based controlling of traffic lights which will check the densities on both ways and will decide which light should be on.

Lets get started.

Step 1: Components

Step 2: Make Connections

we will be using two ultrasonic sensors for two ways and 6 LEDs, 3 for each side.

Ultrasonic Sensor 1:

  • trigger >>>>> Arduino pin D10
  • Echo >>>>>> Arduino pin D9
  • GND >>>>>> GND
  • VCC >>>>>> 5V

Ultrasonic Sensor 2:

  • trigger >>>>> Arduino pin D12
  • Echo >>>>>> Arduino pin D11
  • GND>>>>>>> GND
  • VCC>>>>>>> 5V

LEDs:

  • All the cathodes of the LEDs must go to GND and all of the GND must be common.
  • Red1 Anode>>>>>>Arduino D8
  • Yellow1 Anode>>>>>Arduino D7
  • Green1 Anode>>>>>Arduino D6
  • Green2 Anode>>>>>Arduino D5
  • Yellow2 Anode >>>>Arduino D4
  • Red2 Anode >>>>>Arduino D3

Step 3: Upload Code and You Are Done

You can find the code by clicking here .

Upload code and you are good to go .

Check video if you find any trouble.

Step 4: FOLLOW US ON SOCIAL MEDIA

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

    2 Discussions

    0
    rjc3770
    rjc3770

    Question 1 year ago on Step 3

    hey bro i tried the code but its not working ....only the yellow leds are glowing and nothing else is happening!!

    0
    AsimZ
    AsimZ

    Answer 1 year ago

    Try printing the distance values of both sensors and make sure the sensors are working fine and distance are not equal.