Traffic Signal With Barricade and Crosswalk Timer
by 816162 in Circuits > Arduino
457 Views, 4 Favorites, 0 Comments
Traffic Signal With Barricade and Crosswalk Timer
This is a traffic light and crosswalk circuit. The idea is that there is a normal traffic signal for cars with a PIR motion sensor, a piezo, and a light for a "camera". it is coded so if someone runs a red light it will detect the car, take a picture of their car and make a sound to alert any pedestrians. For the pedestrians, there is a crosswalk timer that lets them know how long they have to cross the road and a barricade so if they start crossing the road a car doesn't hit them rather it hits the barricade and stops.
To make this circuit I had to do some research and I also used some other class projects I made to make this circuit. The research I did was for the I2c bridge as this circuit requires more than 13 pins for all the components, and the class projects I used were about 7 segment display, servo motor, and class lessons.
There is also a Schematic attached if you are making the circuit on hand.
Supplies
Here is a list of components you will need to make this circuit and where to buy them along with the price. (prices are without tax and shipping).
2 Arduinos UNOs ($27.81 CAD) per 1
2 Breadboard Small ($2.46 CAD) per 1
4 LEDs, (Red, Yellow, Green, and White) ($37.51 CAD) Pack
7 seg display ($8.13USD)
Servo Motor ($5.77 CAD)
PIR MotionSensor ($5.12 CAD)
1 Piezo ($9.65 CAD)
6 Resistors (5 560 ohms and 1 330ohms) ($18.65 CAD) Pack
Polarised Capacitor ($15.00 CAD)
Wires ($2.50 CAD)
Collecting All the Components.
Using the Supplies list you want to collect all of the components stated. You also want to lay them out in an organized manner so you know where everything is and they don't get lost.
Putting Everything in Its Place
After you have gathered all of the components you want to put everything where it belongs on the breadboard, Use the Image attached as a reference, and lay everything out in a similar manner.
Connecting the 2 Arduinos Together
Next, since 2 Arduinos are being used you want to connect both of them together. You want to run a wire from the ground pin from the first arduino to the second Arduino's ground pin, you also have to connect a wire from the along pins 4 and 5 from the first Arduino to the second one as shown in the image.
Connecting the LED's
When both of the Arduino are connected, you want to start connecting everything on the first breadboard. first, you want to connect the power and ground pins to the power and ground rails on the breadboard and connect them to the other side of the breadboard as well. next, you are going to connect all the LEDs, Take 3 560 Ohms resistors and connect them to the cathode side of the led and the breadboard ground rail and for the white led take the 330 Ohm resistor and connect it to the cathode and breadboard ground rail. Now you want to start connecting the pins you can connect pin 3 to the anode of the green LED, connect pin 4 to the anode of the yellow LED, connect pin 5 to the anode of the red LED, and connect pin 6 to the white LEDs anode. You can use the image for reference, make sure to colour-code your wires, it keeps the circuit neat and tidy.
Connecting Motion Sensor Servo and Piezo
After you have all of the LEDs wired up you want to connect all the other components on the first breadboard. First, you are going to connect pin 2 to the positive side of the piezo and connect a wire from the ground rail of the breadboard to the negative side of the piezo. After you are done that we will connect the PIR motion sensor, firstly you are going to connect a wire from pin 7 to the signal pin pf the motion sensor and take a positive and negative connecting from the breadboard and connect that to the power and grounds pins of the motion sensor. Finally, you have the servo left and the servo needs a polarised capacitor so the first thing you are going to do is connect power and ground to the capacitor and connect wires going from the capacitor to the servos power and ground pins. You are also going to connect pin 9 to the signal pin on the servo. There you go, all the connections for your first breadboard are done.
Connecting the 7 Segment Display
Going over to your 2nd breadboard you are going to wire up your 7 segment display. First, you want to connect the power and ground pins to the breadboard and make a connection jumping the power and ground to the other side. Now at the bottom side, you are going to connect pin 2 to E on the 7 segment display, connect in 3 to D and connect 4 to C. For the top, you are going to connect pin 10 to G, pin 11 to f, pin 12 to A and finally pin 13 to B. Now, all of your wiring is done, and we can start on the code.
The Code.
Here is a text file with a code along with an interactable Tinkercad panel where you can run the circuit and see how it works. If you would like to see what parts of the code do you can click at the "code" tab at the top middle for a small explanation of what each part does.
Downloads
Circuit Making Video
here is a video of me making the circuit if it makes it easier for you to make the circuit.