What are Traffic Lights?
Traffic signals are very important in life while travelling to some place by vehicle. Traffic signals are given out by devices that are mostly placed at important locations such as busy intersections to regulate the flow of traffic, which includes everything from heavy commercial vehicles and cars to bicycles and pedestrians. However, these signals come with some rules associated with them. Basically, the traffic signal rules form the very backbone of these signs and following them is vital for ensuring smooth and risk-free road travel.
Traffic Signal and its Rules
Red Signal:-
Red is generally the sign of danger or warning and on traffic lights, it signals potential hazard ahead and is an indicator for the motorists to stop. Also, you can turn left in a red signal only if there is a sign to do so. Also, when doing so, you need to give the right of way to pedestrians and vehicles that would be coming from opposite directions. When you are turning left, always gives the left indicator to the vehicles coming from behind.
Yellow Signal:-
A yellow traffic light is a warning signal that lets you know that the red signal is about to be displayed. Hence, when you see the yellow light, you should start slowing down to come to a stop in anticipation of red light. Also, in case, for any reason, you can’t stop, then you should look out for vehicles that might be entering the intersection around the same time. Watch carefully while slowing down the vehicle, as the others vehicles don't collide from behind.
Green Signal:-
Just like a red light corresponds to danger and STOP, the green light signals safety and the word GO. However, just to play it really safe, you should first let any vehicle remaining in the intersection pass before you go ahead.
Follow the Traffic Rules very carefully, as if you don't follow them, Traffic Police will impose fine on you or your vehicle can be seized.
This project is very much used in school science projects or engineering college projects.
So, Let's get started.
Watch the video :
Buy the Project components from below Amazon India Affiliate links:
Parts List:-
Steps to make this Project:
1. Buy components like Arduino Uno, 7 segment display, resistor 330 ohm, breadboard, leds red green and yellow, Jumper wires etc from above links.
2. Take BB place red led, yellow led and green led.
3. Connect all leds anode ( +ve terminal ) with 330 ohm resistance.
4. Connect 7 segment display on breadboard.
5. Connect common pin of 7 segment display with 330 ohm resistance.
6. Do connections from Circuit Diagram.
7. Upload the code and then check its working.
Your project is ready...!!!
Visit my YouTube channel once and see more interesting projects.
"Electronics is Fun"
If you like my channel subscribe it please.
Link: https://studio.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g
// https://www.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g //
// Traffic Lights //
// By MOHD SOHAIL //
int led1=2; // Conncet a resistor of 220 ohms with GND terminal
int led2=3;
int led3=4;
int led4=5;
int led5=6;
int led6=7;
int led7=8;
int green=11; // connect 220 ohm resistor with LEDs
int yellow=12;
int red=13;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
pinMode(led7, OUTPUT);
pinMode(green, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(red, OUTPUT);
}
void loop() {
//9
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,0);
digitalWrite(led6,1);
digitalWrite(led7,1);
digitalWrite(green,0);
digitalWrite(yellow,0);
digitalWrite(red,1);
delay(1000);
//8
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,1);
digitalWrite(led6,1);
digitalWrite(led7,1);
digitalWrite(green,0);
digitalWrite(yellow,0);
digitalWrite(red,1);
delay(1000);
//7
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,0);
digitalWrite(led5,0);
digitalWrite(led6,0);
digitalWrite(led7,0);
digitalWrite(green,0);
digitalWrite(yellow,0);
digitalWrite(red,1);
delay(1000);
//6
digitalWrite(led1,1);
digitalWrite(led2,0);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,1);
digitalWrite(led6,1);
digitalWrite(led7,1);
digitalWrite(green,0);
digitalWrite(yellow,0);
digitalWrite(red,1);
delay(1000);
//5
digitalWrite(led1,1);
digitalWrite(led2,0);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,0);
digitalWrite(led6,1);
digitalWrite(led7,1);
digitalWrite(green,0);
digitalWrite(yellow,0);
digitalWrite(red,1);
delay(1000);
//4
digitalWrite(led1,0);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,0);
digitalWrite(led5,0);
digitalWrite(led6,1);
digitalWrite(led7,1);
digitalWrite(green,0);
digitalWrite(yellow,0);
digitalWrite(red,1);
delay(1000);
//3
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,0);
digitalWrite(led6,0);
digitalWrite(led7,1);
digitalWrite(green,0);
digitalWrite(yellow,0);
digitalWrite(red,1);
delay(1000);
//2
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,0);
digitalWrite(led4,1);
digitalWrite(led5,1);
digitalWrite(led6,0);
digitalWrite(led7,1);
digitalWrite(green,0);
digitalWrite(yellow,0);
digitalWrite(red,1);
delay(1000);
//1
digitalWrite(led1,0);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,0);
digitalWrite(led5,0);
digitalWrite(led6,0);
digitalWrite(led7,0);
digitalWrite(green,0);
digitalWrite(yellow,0);
digitalWrite(red,1);
delay(1000);
//0
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,1);
digitalWrite(led6,1);
digitalWrite(led7,0);
digitalWrite(green,0);
digitalWrite(yellow,0);
digitalWrite(red,1);
delay(1000);
//4
digitalWrite(led1,0);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,0);
digitalWrite(led5,0);
digitalWrite(led6,1);
digitalWrite(led7,1);
digitalWrite(green,0);
digitalWrite(yellow,1);
digitalWrite(red,0);
delay(1000);
//3
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,0);
digitalWrite(led6,0);
digitalWrite(led7,1);
digitalWrite(green,0);
digitalWrite(yellow,1);
digitalWrite(red,0);
delay(1000);
//2
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,0);
digitalWrite(led4,1);
digitalWrite(led5,1);
digitalWrite(led6,0);
digitalWrite(led7,1);
digitalWrite(green,0);
digitalWrite(yellow,1);
digitalWrite(red,0);
delay(1000);
//1
digitalWrite(led1,0);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,0);
digitalWrite(led5,0);
digitalWrite(led6,0);
digitalWrite(led7,0);
digitalWrite(green,0);
digitalWrite(yellow,1);
digitalWrite(red,0);
delay(1000);
//0
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,1);
digitalWrite(led6,1);
digitalWrite(led7,0);
digitalWrite(green,0);
digitalWrite(yellow,1);
digitalWrite(red,0);
delay(1000);
//9
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,0);
digitalWrite(led6,1);
digitalWrite(led7,1);
digitalWrite(green,1);
digitalWrite(yellow,0);
digitalWrite(red,0);
delay(1000);
//8
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,1);
digitalWrite(led6,1);
digitalWrite(led7,1);
digitalWrite(green,1);
digitalWrite(yellow,0);
digitalWrite(red,0);
delay(1000);
//7
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,0);
digitalWrite(led5,0);
digitalWrite(led6,0);
digitalWrite(led7,0);
digitalWrite(green,1);
digitalWrite(yellow,0);
digitalWrite(red,0);
delay(1000);
//6
digitalWrite(led1,1);
digitalWrite(led2,0);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,1);
digitalWrite(led6,1);
digitalWrite(led7,1);
digitalWrite(green,1);
digitalWrite(yellow,0);
digitalWrite(red,0);
delay(1000);
//5
digitalWrite(led1,1);
digitalWrite(led2,0);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,0);
digitalWrite(led6,1);
digitalWrite(led7,1);
digitalWrite(green,1);
digitalWrite(yellow,0);
digitalWrite(red,0);
delay(1000);
//4
digitalWrite(led1,0);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,0);
digitalWrite(led5,0);
digitalWrite(led6,1);
digitalWrite(led7,1);
digitalWrite(green,1);
digitalWrite(yellow,0);
digitalWrite(red,0);
delay(1000);
//3
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,0);
digitalWrite(led6,0);
digitalWrite(led7,1);
digitalWrite(green,1);
digitalWrite(yellow,0);
digitalWrite(red,0);
delay(1000);
//2
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,0);
digitalWrite(led4,1);
digitalWrite(led5,1);
digitalWrite(led6,0);
digitalWrite(led7,1);
digitalWrite(green,1);
digitalWrite(yellow,0);
digitalWrite(red,0);
delay(1000);
//1
digitalWrite(led1,0);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,0);
digitalWrite(led5,0);
digitalWrite(led6,0);
digitalWrite(led7,0);
digitalWrite(green,1);
digitalWrite(yellow,0);
digitalWrite(red,0);
delay(1000);
//0
digitalWrite(led1,1);
digitalWrite(led2,1);
digitalWrite(led3,1);
digitalWrite(led4,1);
digitalWrite(led5,1);
digitalWrite(led6,1);
digitalWrite(led7,0);
digitalWrite(green,1);
digitalWrite(yellow,0);
digitalWrite(red,0);
delay(1000);
}
Contact me if you have any Queries
WhatsApp : +919557024177
Telegram : +919557024177
2 Comments
Please my 7 segment led is not working but red, green and yellow are working fine. What do I do?
ReplyDeletecontact at whtaspp or telegram +919557024177
Delete