Arduino Pedestrian Cross Walk Project
by 801784 in Circuits > Arduino
17 Views, 0 Favorites, 0 Comments
Arduino Pedestrian Cross Walk Project
This project has shown you how to make a simple pedestrian crossing traffic light. LEDs, a push button, a piezo buzzer and Arduino board will be replicated to a pedestrian crossing traffic light. This project works by pressing the button in order to start the whole project. When the button is pressed, the Green LED stays on for 2 seconds, then the Yellow for 2 seconds, and followed by the Red LED as well as the buzzer beeping for 8 seconds and back to yellow and then green. I used resaerch from different websites to help me figure out what I needed to do for this project and I found this project on the arduino website and it helped guide me through the steps of this project. This can be found at this link (https://projecthub.arduino.cc/jdai1986/simple-project-for-beginner-df0862).
Supplies
The first supply you will need for this project is the Arduino Uno board which you can get on Amazon for $16.99 at this link (Amazon). The next supply you will need is a breadboard which you can get for $11.99 for four at this link (Amazon). The next supply you will need is a handful of leds which you can get for $7.99 at this link (Amazon). You will also need a push button which you can get for $7.50 at this link (Amazon). You will also need a 330 resistor which you can get for $8 at this link (Amazon). You will also finally need a buzzer speaker which you can get for $9.79 at this link (Amazon).
Connect LEDs to Breadboard & Arduino
The first step is to connect the LEDs to the breadboard properly and to connect them to the Arduino Uno Board aswell. You first connect the Red LED to ground using a black jumper wire. You then connect the positive end of the LED to the Arduino where I used pin 10. Next you need to connect the yellow LED to ground using another black jumper wire and then connecting the positve end of the LED to the arduino where I used pin 9 but you can use any pin you would like. Next would be the green led which is pretty much the same set up which is connecting the LED to ground using another jumper wire and connecting the LED to the Arduino board using another wire but to pin 8.
Connecting Button
The next step for this project is to connect the button to the breadboard and the arduino. You must connect the button to the power rail using a 330 ohms resistor. I also connected the button to ground using a jumper wire. Then you must connect the button to the arduino board using another wire and you connect it to the third pin on the arduino.
Connecting Buzzer/Speaker
The next and final step on the Breadboard is connecting the buzzer. In order to do this step, you need to have a jumper wire and connect it to ground and you need to also take another wire and connect it to the arduino. I connected this wire to the arduino board pin 2 but you can use any pin on the arduino board.
The Code
This code is not too advanced and pretty basic doing what it needs to do. The code firsts defines what pins each component of the circuit needs to be connected to. The code then tells the circuit which components arre inputs and outputs. The code then turns on the green led. The code then checks to see if the button is pressed and then the sequence starts. The code has a loop function on it to have the circuit continue to repeat the same function. Once you have completed this final step, the circuit is complete and it is time to test the circuit to see if it works.
The Code:
int green = 8;
int yellow = 9;
int red = 10;
int push = 3;
int buzzer = 2;
void setup() {
pinMode(green, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(red, OUTPUT);
pinMode(push, INPUT_PULLUP);
pinMode(buzzer, OUTPUT);
digitalWrite(green, HIGH);
}
void loop() {
if (digitalRead(push) == LOW) {
delay(200);
while(digitalRead(push) == LOW);
// start sequence
digitalWrite(green, LOW);
digitalWrite(yellow, HIGH);
delay(2000);
digitalWrite(yellow, LOW);
digitalWrite(red, HIGH);
for (int i = 0; i < 8; i++) {
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
delay(500);
}
delay(500);
digitalWrite(red, LOW);
digitalWrite(yellow, HIGH);
delay(2000);
digitalWrite(yellow, LOW);
digitalWrite(green, HIGH);
}
}
Video Explanation
This is the link to the video describing how to build the circuit and showing how the circuit works. Showing The Circuit & How It Works. Describing The Connections & How The Circuit Works.