Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Controlled Traffic Light Simulation

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Traffic Light Simulation

Circuit Documentation

Summary

The circuit consists of an Arduino UNO microcontroller used to control three LEDs (red, yellow, and green) through digital pins D8, D10, and D12, respectively. Each LED is connected in series with a 100 Ohm resistor to limit the current. The cathodes of the LEDs are connected to the ground (GND) through the resistors, and the anodes are connected to their respective control pins on the Arduino. The microcontroller runs a program that sequentially turns on the red LED for 3 seconds, the yellow LED for 1 second, and then blinks the green LED with a specific pattern.

Component List

Resistor

LED: Two Pin (red)

LED: Two Pin (green)

LED: Two Pin (yellow)

Arduino UNO

Wiring Details

Resistor (100 Ohms)

LED: Two Pin (red)

LED: Two Pin (green)

LED: Two Pin (yellow)

Arduino UNO

Documented Code

void setup() 
{
  // Initialize digital pins as outputs
  pinMode(8, OUTPUT); // Red LED
  pinMode(10, OUTPUT); // Yellow LED
  pinMode(12, OUTPUT); // Green LED
}

void loop() 
{
  // Red LED sequence
  digitalWrite(8, HIGH); // Turn on red LED for 3 seconds
  delay(3000);
  digitalWrite(8, LOW); // Turn off red LED

  // Yellow LED sequence
  digitalWrite(10, HIGH); // Turn on yellow LED for 1 second
  delay(1000);
  digitalWrite(10, LOW); // Turn off yellow LED

  // Green LED sequence
  digitalWrite(12, HIGH); // Turn on green LED for 3 seconds
  delay(3000);
  digitalWrite(12, LOW); // Turn off green LED
  delay(500);

  // Green LED blinking pattern
  for (int i = 0; i < 3; i++) {
    digitalWrite(12, HIGH); // Blink green LED on
    delay(500);
    digitalWrite(12, LOW); // Blink green LED off
    delay(500);
  }

  delay(1000); // Wait for 1 second before restarting the loop
}

This code is designed to run on the Arduino UNO and controls the sequence of LED illumination. The red LED is turned on for 3 seconds, followed by the yellow LED for 1 second. The green LED is then turned on for 3 seconds and blinks three times with a 500ms on-off cycle. The loop then restarts after a 1-second pause.