Your Business
Your Business
  • Home
  • Arduino Projects
    • List of projects
    • Traffic lights
    • Ir Car
    • LCD
    • Led remote control
    • Ultrasonic Detector
  • ESP 32 Projects
    • ESP32 & 1.28 display
  • More
    • Home
    • Arduino Projects
      • List of projects
      • Traffic lights
      • Ir Car
      • LCD
      • Led remote control
      • Ultrasonic Detector
    • ESP 32 Projects
      • ESP32 & 1.28 display
  • Home
  • Arduino Projects
    • List of projects
    • Traffic lights
    • Ir Car
    • LCD
    • Led remote control
    • Ultrasonic Detector
  • ESP 32 Projects
    • ESP32 & 1.28 display

Arduino Uno Brings Traffic CLights to Life

 Take your DIY skills to the next level with this amazing Arduino Uno project! In this video, we'll show you how to bring traffic lights to life using the popular microcontroller board. From setting up the circuit to writing the code, we'll guide you through every step of the process. Whether you're a beginner or an experienced maker, you'll love this project that combines electronics, programming, and creativity. So, let's get started and make those traffic lights shine! 

Description

Objective:

Create a traffic light system using an Arduino Uno and LEDs, simulating a real-world traffic signal with Red, Yellow, and Green LEDs.


Materials Needed:

  • Arduino Uno
  • 1 Red LED
  • 1 Yellow LED
  • 1 Green LED
  • 3x 330Ω Resistors
  • Breadboard
  • Jumper Wires
  • USB Cable (to power and program the Arduino)


How It Works:

  1. The Red LED lights up for 5 seconds (Stop).
  2. The Yellow LED lights up for 2 seconds (Prepare to Stop/Go).
  3. The Green LED lights up for 5 seconds (Go).
  4. The cycle repeats infinitely.

Circuit Setup:

1. Red LED:

  • Connect the long leg (anode) to digital pin 13 via a 330Ω resistor.
  • Connect the short leg (cathode) to GND.

2. Yellow LED:

  • Connect the long leg (anode) to digital pin 12 via a 330Ω resistor.
  • Connect the short leg (cathode) to GND.

3. Green LED:

  • Connect the long leg (anode) to digital pin 11 via a 330Ω resistor.
  • Connect the short leg (cathode) to GND.

Code:

 

// Define LED pins
const int redLED = 13;
const int yellowLED = 12;
const int greenLED = 11;

void setup() {
  // Set LED pins as outputs
pinMode(redLED, OUTPUT);
pinMode(yellowLED, OUTPUT);
pinMode(greenLED, OUTPUT);
}

void loop() {
  // Red light ON for 5 seconds
digitalWrite(redLED, HIGH);
digitalWrite(yellowLED, LOW);
digitalWrite(greenLED, LOW);
delay(5000);

  // Yellow light ON for 2 seconds
digitalWrite(redLED, LOW);
digitalWrite(yellowLED, HIGH);
digitalWrite(greenLED, LOW);
delay(2000);

  // Green light ON for 5 seconds
digitalWrite(redLED, LOW);
digitalWrite(yellowLED, LOW);
digitalWrite(greenLED, HIGH);
delay(5000);
}

Demonstration Steps

Upload the Code:

  • Connect the Arduino to your computer and upload the provided code via the Arduino IDE.

Power the Circuit:

  • Power the Arduino through the USB cable or an external power source.

Observe the Traffic Light Sequence:

  • The LEDs will light up in the following pattern:
    1. Red LED: ON for 5 seconds.
    2. Yellow LED: ON for 2 seconds.
    3. Green LED: ON for 5 seconds.


Copyright © 2025 Alex3dworks - All rights reserved

Powered by

  • Politica sulla privacy

This website uses cookies.

We use cookies to analyze website traffic and optimize your website experience. By accepting our use of cookies, your data will be aggregated with all other user data.

DeclineAccept