Traffic Lights System using 7 Segment Common Anode Display

 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.



 


This Tutorial I have shown is using Proteus v8.11. I will upload a video using components later on my YT channel.


If you don't know How to Install Proteus v8.11, read my blog from below link👇👇

https://www.electronicsisfun08.in/2022/12/how-to-download-and-install-proteus.html

 Since YouTube has removed my video of How to download and install proteus, So you can download it from above link.

 

If you don't have the Arduino Libraries, then watch that separate video from below link👇👇

https://www.electronicsisfun08.in/2022/12/how-to-add-free-libraries-in-proteus.html 

 For more help on this How to add libraries of Proteus v8.11/v8.12 You can watch the video also.





Traffic Lights using 7 Segment Common Anode Display


I have made Traffic Lights previously using Arduino with 7 segment display, that 7 segment display was of Common Cathode. Now, I'm making Traffic Light System using 7 segment Common Anode Display. 

Difference between Common Cathode and Common Anode is that:-


In Common Cathode, the COM pin of 7 segment is connected to Ground (GND) or negative supply.

In Common Anode, the COM pin of 7 segment is connected to Vcc (+5v) or positive supply.


Watch the video:-




Parts List :-


1. Arduino Uno :- https://amzn.to/3VSv8l6

2. 7 segment Common Anode :- https://amzn.to/3y6Ajnq

3. LED :- https://amzn.to/3jO6559

4. Resistance Pack :- https://amzn.to/3XbimPy

5. Jumper Wires :- https://amzn.to/3vPi9WO



WIRING DIAGRAM :-







Arduino Code :-



// https://www.youtube.com/channel/UCaXI2PcsTlH5g0et67kdD6g  //
// Traffic Lights system using Common Anode 7 segment display //
// By MOHD SOHAIL //



int a= 0;
int b= 1;
int c= 2;
int d= 3;
int e= 4;
int f= 5;
int g= 6;

int green= 8;    
int yellow= 9;
int red= 10;


void setup(){
 
 pinMode(a, OUTPUT);
 pinMode(b, OUTPUT);
 pinMode(c, OUTPUT);
 pinMode(d, OUTPUT);
 pinMode(e, OUTPUT);
 pinMode(f, OUTPUT);
 pinMode(g, OUTPUT);
 
 pinMode(green, OUTPUT);
 pinMode(yellow, OUTPUT);
 pinMode(red, OUTPUT);
 
}

void loop() {
 //9 
 digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,1);
 digitalWrite(f,0);
 digitalWrite(g,0);
 
 digitalWrite(green,0);
 digitalWrite(yellow,0);
 digitalWrite(red,1);

 delay(1000);


 //8
 digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,0);
 digitalWrite(f,0);
 digitalWrite(g,0);
 
 digitalWrite(green,0);
 digitalWrite(yellow,0);
 digitalWrite(red,1);

 delay(1000);

 

 //7
 digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,1);
 digitalWrite(e,1);
 digitalWrite(f,1);
 digitalWrite(g,1);
 
 digitalWrite(green,0);
 digitalWrite(yellow,0);
 digitalWrite(red,1);

 delay(1000);

 

 //6
  digitalWrite(a,0);
 digitalWrite(b,1);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,0);
 digitalWrite(f,0);
 digitalWrite(g,0);
 
 digitalWrite(green,0);
 digitalWrite(yellow,0);
 digitalWrite(red,1);
 
 delay(1000);


 //5
  digitalWrite(a,0);
 digitalWrite(b,1);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,1);
 digitalWrite(f,0);
 digitalWrite(g,0);
 
 digitalWrite(green,0);
 digitalWrite(yellow,0);
 digitalWrite(red,1);

 delay(1000);


 //4
  digitalWrite(a,1);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,1);
 digitalWrite(e,1);
 digitalWrite(f,0);
 digitalWrite(g,0);
 
 digitalWrite(green,0);
 digitalWrite(yellow,0);
 digitalWrite(red,1);

 delay(1000);


 //3
 digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,1);
 digitalWrite(f,1);
 digitalWrite(g,0);
 
 digitalWrite(green,0);
 digitalWrite(yellow,0);
 digitalWrite(red,1);

 delay(1000);


 //2
 digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,1);
 digitalWrite(d,0);
 digitalWrite(e,0);
 digitalWrite(f,1);
 digitalWrite(g,0);
 
 digitalWrite(green,0);
 digitalWrite(yellow,0);
 digitalWrite(red,1);

 delay(1000);

 //1
  digitalWrite(a,1);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,1);
 digitalWrite(e,1);
 digitalWrite(f,1);
 digitalWrite(g,1);
 
 digitalWrite(green,0);
 digitalWrite(yellow,0);
 digitalWrite(red,1);

 delay(1000);
 
 //0
  digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,0);
 digitalWrite(f,0);
 digitalWrite(g,1);
 
 digitalWrite(green,0);
 digitalWrite(yellow,0);
 digitalWrite(red,1);

 delay(1000);

 //4 for yellow led
  digitalWrite(a,1);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,1);
 digitalWrite(e,1);
 digitalWrite(f,0);
 digitalWrite(g,0);
 
 digitalWrite(green,0);
 digitalWrite(yellow,1);
 digitalWrite(red,0);

 delay(1000);

 //3
  digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,1);
 digitalWrite(f,1);
 digitalWrite(g,0);
 
 digitalWrite(green,0);
 digitalWrite(yellow,1);
 digitalWrite(red,0);

 delay(1000);

 //2
  digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,1);
 digitalWrite(d,0);
 digitalWrite(e,0);
 digitalWrite(f,1);
 digitalWrite(g,0);
 
 digitalWrite(green,0);
 digitalWrite(yellow,1);
 digitalWrite(red,0);

 delay(1000);

 //1
  digitalWrite(a,1);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,1);
 digitalWrite(e,1);
 digitalWrite(f,1);
 digitalWrite(g,1);
 
 digitalWrite(green,0);
 digitalWrite(yellow,1);
 digitalWrite(red,0);

 delay(1000);
 
 //0
  digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,0);
 digitalWrite(f,0);
 digitalWrite(g,1);
 
 digitalWrite(green,0);
 digitalWrite(yellow,1);
 digitalWrite(red,0);

 delay(1000);

//9 
 digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,1);
 digitalWrite(f,0);
 digitalWrite(g,0);
 
 digitalWrite(green,1);
 digitalWrite(yellow,0);
 digitalWrite(red,0);
 delay(1000);

 //8
 digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,0);
 digitalWrite(f,0);
 digitalWrite(g,0);
 
 digitalWrite(green,1);
 digitalWrite(yellow,0);
 digitalWrite(red,0);

 delay(1000);

 //7      
 digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,1);
 digitalWrite(e,1);
 digitalWrite(f,1);
 digitalWrite(g,1);
 
 digitalWrite(green,1);
 digitalWrite(yellow,0);
 digitalWrite(red,0);

 delay(1000);

 //6
  digitalWrite(a,0);
 digitalWrite(b,1);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,0);
 digitalWrite(f,0);
 digitalWrite(g,0);
 
 digitalWrite(green,1);
 digitalWrite(yellow,0);
 digitalWrite(red,0);

 delay(1000);

 //5
  digitalWrite(a,0);
 digitalWrite(b,1);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,1);
 digitalWrite(f,0);
 digitalWrite(g,0);
 
 digitalWrite(green,1);
 digitalWrite(yellow,0);
 digitalWrite(red,0);

 delay(1000);
 //4
  digitalWrite(a,1);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,1);
 digitalWrite(e,1);
 digitalWrite(f,0);
 digitalWrite(g,0);
 
 digitalWrite(green,1);
 digitalWrite(yellow,0);
 digitalWrite(red,0);

 delay(1000);

 //3
  digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,1);
 digitalWrite(f,1);
 digitalWrite(g,0);
 
 digitalWrite(green,1);
 digitalWrite(yellow,0);
 digitalWrite(red,0);

 delay(1000);

 //2
  digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,1);
 digitalWrite(d,0);
 digitalWrite(e,0);
 digitalWrite(f,1);
 digitalWrite(g,0);
 
 digitalWrite(green,1);
 digitalWrite(yellow,0);
 digitalWrite(red,0);

 delay(1000);

 //1
  digitalWrite(a,1);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,1);
 digitalWrite(e,1);
 digitalWrite(f,1);
 digitalWrite(g,1);
 
 digitalWrite(green,1);
 digitalWrite(yellow,0);
 digitalWrite(red,0);

 delay(1000);
 
 //0
  digitalWrite(a,0);
 digitalWrite(b,0);
 digitalWrite(c,0);
 digitalWrite(d,0);
 digitalWrite(e,0);
 digitalWrite(f,0);
 digitalWrite(g,1);
 
 digitalWrite(green,1);
 digitalWrite(yellow,0);
 digitalWrite(red,0);

 delay(1000);

}



If you want to make your customized project. Message me

Telegram / WhatsApp : +919557024177

Instagram Page : eif.08
 

Post a Comment

0 Comments