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

Arduino UNO Controlled Traffic Light System

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

Traffic Light Control Circuit Documentation

Summary

This document describes a simple traffic light control circuit that is designed to operate a three-light traffic signal with standard green, yellow, and red lights. The circuit is controlled by an Arduino UNO microcontroller, which cycles through the lights in a predetermined sequence: green light on for 5 seconds, yellow light on for 2 seconds, and red light on for 5 seconds. This sequence repeats indefinitely to simulate a traffic light system.

Component List

Arduino UNO

Traffic Light

Wiring Details

Arduino UNO

Traffic Light

Documented Code

/*
 * This Arduino sketch controls a traffic light system.
 * The traffic light has three LEDs: Green, Yellow, and Red.
 * The sequence is as follows:
 * - Green LED is on for 5 seconds
 * - Yellow LED is on for 2 seconds
 * - Red LED is on for 5 seconds
 * This sequence repeats indefinitely.
 */

// Pin definitions
const int greenLEDPin = 3; // Arduino pin connected to the green light of the traffic light
const int yellowLEDPin = 2; // Arduino pin connected to the yellow light of the traffic light
const int redLEDPin = 1; // Arduino pin connected to the red light of the traffic light

void setup() {
  // Initialize the LED pins as outputs
  pinMode(greenLEDPin, OUTPUT);
  pinMode(yellowLEDPin, OUTPUT);
  pinMode(redLEDPin, OUTPUT);
}

void loop() {
  // Turn on the Green LED
  digitalWrite(greenLEDPin, HIGH);
  delay(5000); // Wait for 5 seconds
  digitalWrite(greenLEDPin, LOW);

  // Turn on the Yellow LED
  digitalWrite(yellowLEDPin, HIGH);
  delay(2000); // Wait for 2 seconds
  digitalWrite(yellowLEDPin, LOW);

  // Turn on the Red LED
  digitalWrite(redLEDPin, HIGH);
  delay(5000); // Wait for 5 seconds
  digitalWrite(redLEDPin, LOW);
}

Filename: sketch.ino

This code is responsible for controlling the traffic light sequence. It initializes the pins connected to the LEDs as outputs and then enters an infinite loop where it turns each LED on and off in sequence with appropriate delays to simulate a traffic light.