Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino UNO Controlled Traffic Light System

Image 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-color traffic light system using an Arduino UNO microcontroller. The circuit controls the green, yellow, and red LEDs of a traffic light, each for a specific duration. The green LED is on for 5 seconds, followed by the yellow LED for 2 seconds, and then the red LED for 5 seconds. This cycle repeats indefinitely.

Component List

Arduino UNO

  • Description: A microcontroller board based on the ATmega328P.
  • Pins Used: GND, D3, D2, D1.
  • Purpose: Acts as the central controller for the traffic light system, driving the LEDs and managing the timing of the light changes.

Traffic Light

  • Description: A simple traffic light module with three LEDs (Green, Yellow, Red).
  • Pins Used: Green, Yellow, Red, GND.
  • Purpose: Represents the traffic light, with each LED corresponding to a light state in the traffic signal.

Wiring Details

Arduino UNO

  • GND: Connected to the GND pin of the Traffic Light.
  • D3: Connected to the Green pin of the Traffic Light.
  • D2: Connected to the Yellow pin of the Traffic Light.
  • D1: Connected to the Red pin of the Traffic Light.

Traffic Light

  • Green: Connected to the D3 pin of the Arduino UNO.
  • Yellow: Connected to the D2 pin of the Arduino UNO.
  • Red: Connected to the D1 pin of the Arduino UNO.
  • GND: Connected to the GND pin of the Arduino UNO.

Documented Code

/*
 * This Arduino sketch controls a traffic light system.
 * The green LED is on for 5 seconds, followed by the yellow LED for 2 seconds,
 * and then the red LED for 5 seconds. This cycle repeats indefinitely.
 */

// Pin definitions
const int greenPin = 3;
const int yellowPin = 2;
const int redPin = 1;

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

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

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

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

Filename: sketch.ino

Description: The code provided is an Arduino sketch that defines the pin connections for the traffic light LEDs and sets up a loop that cycles through the green, yellow, and red lights. Each LED is turned on for a specified duration using the digitalWrite() function and delay() function to manage the timing. The pins are configured as outputs in the setup() function, and the loop() function contains the logic for the traffic light sequence.