Arduino traffic light controller

Here we will see how easily we can made simple project Arduino traffic light controller. We use two traffic light board to control traffic in a one way junction. Let suppose in our junction car can only go in one direction that means east to west or south to north. That is why we place two traffic light board. Now we have to understand the logic. Very simple logic implemented here when red light of traffic1 board is glow that time green light of traffic2 board should glow. Next sequence both board are yellow and then traffic1 board green and traffic2 board should red. In bellow see the block represent of our propose system.

Arduino traffic light controller

So for making our project Arduino traffic light controller we used one Arduino Uno board and two red, two green and two yellow LED. If you have any doubt in what is arduino uno and how it work then please go through my previous post on what is Arduino UNO? As we know Arduino Uno has 13 digital input/output pin so traffic1 red connect with 13 number, yellow connect with 12 number, green connect with 11 number pin. Similarly traffic2 red connect with 10 number, yellow connect with 09 number, green connect with 08 number pin.

Now come to programming section, as we know Arduino Uno has 14 digital input and output pin. We have to tell microcontroller that which is input and output pin? By using “pinMode” command. As we know in our project Arduino traffic light controller, we required 6 LED’s connected with pin number 08 to 13. For decleare those pin as a output pin, we have write instruction in bellow format.

 void setup() {

  pinMode(13, OUTPUT);

  pinMode(12, OUTPUT);

  pinMode(11, OUTPUT);

  pinMode(10, OUTPUT);

  pinMode(9, OUTPUT);

  pinMode(8, OUTPUT);

}

Now you see the complete coding of our program Arduino traffic light controller

Embedded C Code
// Name : Arduino traffic light controller
// Author : Subham Dutta
// Date : 11-01-16
// Website : www.nbcafe.in
void setup() {
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
}void loop() {
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(13, HIGH);
digitalWrite(8, HIGH);
delay(3000);
digitalWrite(13, LOW);
digitalWrite(8, LOW);
digitalWrite(12, HIGH);
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(12, LOW);
digitalWrite(9, LOW);
digitalWrite(11, HIGH);
digitalWrite(10, HIGH);
delay(3000);}

Hope above discussion on project Arduino traffic light controller clear your idea and you can easily build that project at home.

Here you will see the complete stimulation video of our project  Arduino traffic light controller .