Professional Documents
Culture Documents
• Introduction
• Components
• Methodology
• Code
• Conclusion
• References
Introduction
• Traffic light simulators are an essential tool for understanding and analyzing traffic flow
in different scenarios.
• These simulators are commonly used in the transportation industry, urban planning, and
traffic engineering.
• In the presentation, I will show an Arduino-based traffic light simulator and its
implementation.
3
Components
• Arduino Uno Board - used as the main controller of the traffic light simulator.
The methodology used for building the Arduino-based traffic light simulator is
as follows:
• Connect the three LEDs to the digital pins of the Arduino board using the breadboard.
• Write the program code for the traffic light sequence using the Arduino IDE.
• Test the traffic light sequence and adjust the duration of each signal as needed.
4
II Methodology
2. CODE USED
22. // Turn on the red light for 10 seconds
1. // Define the traffic light pins
23. digitalWrite(GREEN_PIN, LOW);
2. #define RED_PIN 2 24. digitalWrite(YELLOW_PIN, LOW);
11. void loop() {
3. #define YELLOW_PIN 3 12. // Turn on the green light for 10 25. digitalWrite(RED_PIN, HIGH);
seconds 26. delay(10000);
4. #define GREEN_PIN 4
13. digitalWrite(GREEN_PIN,
HIGH); 27. // Turn on the yellow light for 3 seconds
5. void setup() { 14. digitalWrite(YELLOW_PIN, 28. digitalWrite(GREEN_PIN, LOW);
LOW); 29. digitalWrite(YELLOW_PIN, HIGH);
6. // Set the traffic light pins to output mode 15. digitalWrite(RED_PIN, LOW); 30. digitalWrite(RED_PIN, LOW);
7. pinMode(RED_PIN, OUTPUT); 16. delay(10000);
31. delay(3000);
8. pinMode(YELLOW_PIN, OUTPUT); 17. // Turn on the yellow light for 3 32. }
9. pinMode(GREEN_PIN, OUTPUT); seconds
18. digitalWrite(GREEN_PIN,
10. } LOW);
19. digitalWrite(YELLOW_PIN,
HIGH);
20. digitalWrite(RED_PIN, LOW);
21. delay(3000);
7
II Methodology
3. Steps Involved
6
II Methodology
Fig 3-Connecting the cathode (short leg) of the red LED to pin 2 of the
Arduino, the cathode of the yellow LED to pin 3, and the cathode of the green
LED to pin 4.
6
II Methodology
Fig 4-Upload the sketch to the Arduino board and observe the simulated
traffic light sequence.
6
II Methodology
6
IV Conclusion
• The simulator is easy to build and customize, making it an ideal tool for educational and
research purposes.
• Furthermore, the simulator's low cost and simplicity make it an attractive alternative to
7
V References
[1] https://www.arduino.cc/
[2] https://en.wikipedia.org/wiki/Arduino
[3] https://learn.sparkfun.com/tutorials/what-is-an-arduino/all
[4] "Arduino Based Traffic Light Controller System." International Journal of Scientific Research in Computer Science, Engineering and
Information Technology. Volume 3, Issue 2, 2018.
8
V
Thank You!