Arduino Based 3-Way Traffic Light Controller - Internet of Things

Arduino Based 3-Way Traffic Light Controller

Arduino Based 3-Way Traffic Light Controller
We all know about Arduino. It is one of the most popular open source micro controller board which is highly useful for doing DIY projects. This Arduino based 3-Way Traffic Light Controller is a simple Arduino DIY project which is useful to understand the working of traffic lights which we see around us. We have covered a more simpler version of traffic lights in this traffic light circuit.  Here have demonstrated it for 3 sides or ways. Now lets get into the project

Components Required:
  1. 3*Red LED Lights
  2. 3*Green LED Lights
  3. 3*Yellow LED Lights
  4. 3*220ohm Resistors
  5. Breadboard
  6. Male To Male Connectors
  7. Arduino Uno With Ide Cable

Circuit Explanation:
The circuit Diagram for Arduino Traffic Light Controller project is given below:
Its pretty simple and can be easily built on bread board as explained in below steps:
  1. Connect the LEDs in the order as Red, Green, and Yellow in the breadboard.
  2. Place the negative terminal of the LEDs in common and connect the 220ohm resistor in series.
  3. Connect the connector wires accordingly.
  4. Connect the other end of the wire to the Arduino Uno in the consecutive pins(2,3,410)
  5. Power up the breadboard using the Arduino 5v and GND pin.

Program and Working Explanation:
The code for this Arduino Traffic Light Controller Project is simple and can be easily understood. Here we have demonstrated Traffic lights for the 3 ways road and the code glows LEDs on all the three sides in a particular sequence, in which the actual Traffic Lights works. Like, at a time, there will be two Red signals on any of the two sides and one Green light on the remaining side. And yellow light will also glow, for 1 second each time, in between transition from Red to Green, means first red light glows for 5 second then yellow light glows for 1 second and then finally green light will be turned on.

In the program, first we have declared pins (2,310) as output in void setup() for 9 LEDs (three on each side i.e. forward, right and left side).
void setup() {
  // configure the output pins
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  pinMode(8,OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(10,OUTPUT);
}

Then in void loop() function we have written the code for traffic lights to be turned on and off in sequence as mentioned above.
void loop()
{
  digitalWrite(4,1);
  digitalWrite(5,1);
  digitalWrite(8,1);
  digitalWrite(2,0);
  digitalWrite(6,0)//enables the 1st set of signals
  digitalWrite(3,0);
  digitalWrite(7,0);
  digitalWrite(10,0);
  digitalWrite(9,0);
  delay(5000);
  .... ......
  ..... ......

      Demo & Code





Arduino Based 3-Way Traffic Light Controller Arduino Based 3-Way Traffic Light Controller Reviewed by XXX on สิงหาคม 27, 2560 Rating: 5

ไม่มีความคิดเห็น