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 Red, Yellow, and Green LEDs. The circuit is controlled by an Arduino UNO microcontroller, which cycles through the lights in a standard traffic light sequence. The sequence starts with the Red light for 5 seconds, followed by the Yellow light for 2 seconds, and then the Green light for 5 seconds. This cycle 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: Red, Yellow, and Green.
 * The sequence is as follows:
 * - Red LED on for 5 seconds
 * - Yellow LED on for 2 seconds
 * - Green LED on for 5 seconds
 * This sequence repeats indefinitely.
 */

// Pin definitions
const int redPin = 1;    // Connect to the Red LED of the Traffic Light
const int yellowPin = 2; // Connect to the Yellow LED of the Traffic Light
const int greenPin = 3;  // Connect to the Green LED of the Traffic Light

void setup() {
  // Initialize the digital pins as outputs
  pinMode(redPin, OUTPUT);
  pinMode(yellowPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
}

void loop() {
  // Red LED on for 5 seconds
  digitalWrite(redPin, HIGH);
  delay(5000);
  digitalWrite(redPin, LOW);
  
  // Yellow LED on for 2 seconds
  digitalWrite(yellowPin, HIGH);
  delay(2000);
  digitalWrite(yellowPin, LOW);
  
  // Green LED on for 5 seconds
  digitalWrite(greenPin, HIGH);
  delay(5000);
  digitalWrite(greenPin, LOW);
}

Filename: sketch.ino

Note: The pin numbers in the code correspond to the digital pins on the Arduino UNO. Ensure that the traffic light module is connected to the correct pins as specified in the wiring details.