• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » DIY Arduino Traffic Light Pedestrian Light Push Button Control

By Abhishek Ghosh June 9, 2016 8:14 am Updated on June 18, 2024

DIY Arduino Traffic Light Pedestrian Light Push Button Control

Advertisement

Here is How to Create LED DIY Arduino Traffic Light – Pedestrian Light Push Button Control. When Pedestrians Will WALK, Cars Will Stop Logic.There is actually two parts – one is building the LED DIY Traffic Lights and Second Part is the Coding. We are using push button, but it can be a sensor in real. Most commonly many websites write about Arduino Traffic Light which automatically goes OFF and ON. That is not practical, it is more towards toy. It is example of basic implementation of Finite State Machines modeling in embedded.

 

Creating DIY Arduino Traffic Light Pedestrian Light

 

This should be a separate chapter. Raspberry has great pre-built traffic light add-ons like PI-TRAFFIC, PI-STOP, Traffic HAT and so on. But they cost minimum $10 for a set of two. Additionally we are not getting the desired realistic Pedestrian Light. For total 5 LEDs, it is meaningless to pay $10. We are taking about this stuff :

Arduino Traffic Light

You can mount the LED on PCB to get such thing or just put them over simple corrugated board or 3D Print or use LEGO blocks. WALK/GO LED can be created by adding those shaped cover.

Advertisement

---

 

DIY Arduino Traffic Light Pedestrian Light : Logic

 

When push button is pressed :

  1. the green LED of Traffic Light will turn off
  2. and yellow LED of Traffic Light will turn on for 2 seconds
  3. then the red LED of Traffic Light will go to ON
  4. by that time the green LED of Pedestrian Light will turn on
  5. After 4 seconds the green LED of Pedestrian Light will be flashing for 5 seconds and turn off
  6. Red LED of Pedestrian Light will be on, red LED of Traffic Light will off, green LED of Traffic Light will be on.

 

Creating DIY Arduino Traffic Light Pedestrian Light : Circuit Diagram and Code

 

DIY-Arduino-Traffic-Light-Pedestrian-Light-Push-Button-Control

We have the whole project on FritZing and you can download from this link. Download the .fzz and .ino file from there. Here is also the code:

 

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
int TrafficRed = 3;  
int TrafficYellow = 4;
int TrafficGreen = 5;
int PedestrianRed = 8;  
int PedestrianGreen = 9;
int button = 13;
int crossTime = 4000;  
unsigned long buttonGap ;
void setup () {
  pinMode(TrafficRed, OUTPUT);
  pinMode(TrafficYellow, OUTPUT);
  pinMode(TrafficGreen, OUTPUT);
  pinMode(PedestrianRed, OUTPUT);
  pinMode(PedestrianGreen, OUTPUT);
  pinMode(button, INPUT);
  digitalWrite(TrafficGreen,HIGH);
  digitalWrite(PedestrianRed, HIGH);
}
 
void loop(){
  int state = digitalRead(button);
  if(state==HIGH && (millis() - buttonGap) > 5000) {
    switchLights();  
  }
}
 
void switchLights() {
  digitalWrite(TrafficGreen,LOW);
  digitalWrite(TrafficYellow,HIGH);
  delay(2000);
 
  digitalWrite(TrafficYellow,LOW);
  digitalWrite(TrafficRed,HIGH);
  delay(1000);
 
  digitalWrite(PedestrianRed,LOW);
  digitalWrite(PedestrianGreen,HIGH);
  delay(crossTime);
 
  for (int x=0; x<10; x++){
    digitalWrite(PedestrianGreen,HIGH);
    delay(250);
    digitalWrite(PedestrianGreen,LOW);
    delay(250);
  }
  digitalWrite(PedestrianRed, HIGH);
  delay(100);
  digitalWrite(TrafficRoadGreen,HIGH);
  digitalWrite(TrafficRoadRed,LOW);
  buttonGap = millis();
}

The code is modified from http://osoyoo.com/?p=239 and is distributed under GNU GPL 3.0 License.

Please note: This project is intended for the children. This code does not utilize interrupt and debounce to avoid complicated code. You can read this Read a Pushbutton with Arduino with Interrupts and Debounce to understand their importance. In real life, traffic lights are controlled with PLC. This project was written a decade back, there was no PLC module for Arduino, visual programming for Arduino was just starting.

Tagged With https://thecustomizewindows com/2016/06/diy-arduino-traffic-light-pae-push-button/ , arduino traffic light with pedestrian button , arduino traffic lights with button , arduino traffic light with button , simple stop light arduino , arduino traffic light push button , arduinotwo traffic lights and nutton coding , arduino uno traffic lights with led and buttons sketch and coding , arduino stoplight with button code , arduino pedestrian traffic light
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to DIY Arduino Traffic Light Pedestrian Light Push Button Control

  • Arduino and LED Bar Display : Circuit Diagram, Code

    Here is a Guide Explaining the Basics, Circuit Diagram, Code on Arduino and LED Bar Display. LED Bar Display is Actually Like Multiple LED.

  • LED Chaser Effect With PWM Using Arduino

    In our earlier article, We have discussed PWM and informed you that this PWD technology is used in particular for light-emitting diodes (LEDs), as they are often used as backlights on mobile phones or brake lights in newer motor vehicles. Our older article on Breathing LED also uses PWM. This was the sketch, LED is […]

  • Arduino Traffic Light With LED Display Timer With Push Button Switch

    Circuit Diagram To Create Arduino Traffic Light With LED Display Timer With Push Button Switch. This logical system used for many things.

  • Arduino : Light ON One By One Following Foot Steps on Hallway

    This idea is good for automatic turning on and off multiple lights one by one while a person is walking staircase or walking through a passage or hallway. As IR Obstacle Sensors has physical limits, we can not use if the passage is wide like a road – it will fail for physical reasons. Human […]

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

vpsdime

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Cloud-Powered Play: How Streaming Tech is Reshaping Online GamesSeptember 3, 2025
  • How to Use Transcribed Texts for MarketingAugust 14, 2025
  • nRF7002 DK vs ESP32 – A Technical Comparison for Wireless IoT DesignJune 18, 2025
  • Principles of Non-Invasive Blood Glucose Measurement By Near Infrared (NIR)June 11, 2025
  • Continuous Non-Invasive Blood Glucose Measurements: Present Situation (May 2025)May 23, 2025
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2026 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy