Total Pageviews

Friday, 29 November 2013

Automatic Arduino based Traffic Signal Controller


In its simplest form, an Arduino is a tiny computer that you can program to process inputs and outputs going to and from the chip.

The Arduino is what is known as a Physical or Embedded Computing platform, which means that it is an interactive system, that through the use of hardware and software can interact with itʼs environment.

The Arduino hardware and software are both Open Source, which means the code, the schematics, design, etc. are all open for anyone to take freely and do what they like with it.



Project - Automatically Controlled Traffic Signal Lights

We are now going to create a set of traffic lights that will change from green to red, via amber, and back again, after a set length of time using the 4-state system. This project could be used on a model railway to make a set of working traffic lights or for a childʼs toy town.

What you will need:
·        Breadboard
·        Red Diffused LED
·        Yellow Diffused LED
·        Green Diffused LED
·        3 x 220Ω Resistors
·        Jumper Wires

Connect it up

This time we have connected 3 LEDʼs with the Anode of each one going to Digital Pins 8, 9 and 10, via a 220Ω resistor each. We have taken a jumper wire from Ground to the
Ground rail at the top of the breadboard and a ground wire goes from the Cathode leg of each LED to the common ground rail.

Enter the code

int ledDelay = 10000; // delay in between changes
int redPin = 10;
int yellowPin = 9;
int greenPin = 8;
void setup() {
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop() {
// turn the red light on
digitalWrite(redPin, HIGH);
delay(ledDelay); // wait 5 seconds
digitalWrite(yellowPin, HIGH); // turn on yellow
delay(2000); // wait 2 seconds
digitalWrite(greenPin, HIGH); // turn green on
digitalWrite(redPin, LOW); // turn red off
digitalWrite(yellowPin, LOW); // turn yellow off
delay(ledDelay); // wait ledDelay milliseconds
digitalWrite(yellowPin, HIGH); // turn yellow on
digitalWrite(greenPin, LOW); // turn green off
delay(2000); // wait 2 seconds
digitalWrite(yellowPin, LOW); // turn yellow off
// now our loop repeats
}


Enter the following code, check it and upload.






My Project

3 comments:

  1. Congratulation to u Asif Mahmood Abbas(The ABBAS VAI). keep going if u stop u will have to start again from the 0. so take brutally small step but keep it going with no interruption. I know u have the audacity.

    ReplyDelete
  2. ধন্যবাদ, অনেক কিছু জানার ছিল। আমরা অনেকে অনেক কিছুই জানি না। আপনা এই পোস্টটি দ্বারা অনেকে কিছু তথ্য জানতে পারবে।আমি আপনাকে কোন প্রকার অফার করছি না। ছোট একটি তথ্য আপনার উপকারে আসতে পারে Full Building rent

    ReplyDelete

Thanks for the response, I really Appreciate.