LED PROJECTS

Arduino Single Traffic Light Project

The Arduino Traffic Light Project is an engaging and educational hands-on project for beginners in electronics and programming.

This project simulates a basic traffic light system with red, yellow, and green LEDs. It provides a clear demonstration of how an Arduino microcontroller can be used to control and sequence lights, similar to real traffic lights.

Component List:

NameQuantityComponent
U11Arduino Uno R3
D11Green LED
D21Yellow LED
D31Red LED
R1
R2
R3
31 kΩ Resistor

Circuit Diagram:
The circuit consists of three LEDs connected to digital pins on the Arduino board. The red LED is connected to pin 11, the yellow LED to pin 12, and the green LED to pin 13. Each LED has a current-limiting resistor in series to prevent excessive current flow.

A momentary push-button switch is connected to digital pin 12 to trigger the light sequence. When the button is pressed, it changes the LED state from red to red and yellow for a brief transition, then to green, and finally to yellow before repeating the cycle.

Arduino code

const int redPin = 11;
const int yellowPin = 12;
const int greenPin = 13;
void setup() {
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop() {
// Red light
digitalWrite(redPin, HIGH);
digitalWrite(yellowPin, LOW);
digitalWrite(greenPin, LOW);
delay(2000);
// Red and yellow lights for transition
digitalWrite(redPin, HIGH);
digitalWrite(yellowPin, HIGH);
digitalWrite(greenPin, LOW);
delay(1000);
// Green light
digitalWrite(redPin, LOW);
digitalWrite(yellowPin, LOW);
digitalWrite(greenPin, HIGH);
delay(2000);
// Yellow light
digitalWrite(redPin, LOW);
digitalWrite(yellowPin, HIGH);
digitalWrite(greenPin, LOW);
delay(1000);

The Arduino Traffic Light Project is a fun and educational way to learn about basic circuitry, programming logic, and input/output control with an Arduino. By creating a simple traffic light system, you gain hands-on experience that can be extended to more complex projects.

This project can serve as a foundation for learning and experimenting with Arduino-based automation and control systems. It’s a great starting point for those looking to delve into the exciting world of electronics and microcontroller programming.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button