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

Arduino UNO Traffic Light Controller

Image of Arduino UNO Traffic Light Controller

Traffic Light Controller Circuit Documentation

Summary

This circuit is designed to control a traffic light system using an Arduino UNO microcontroller. The traffic light system consists of three LEDs (Red, Yellow, and Green) that simulate a traffic signal. The Arduino UNO is programmed to switch these LEDs on and off in a specific sequence to mimic the operation of a standard traffic light. The sequence starts with the Red LED on for 5 seconds, followed by the Yellow LED for 2 seconds, and then the Green LED for 5 seconds. This cycle repeats indefinitely.

Component List

Arduino UNO

  • Description: A microcontroller board based on the ATmega328P.
  • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13
  • Purpose: Acts as the central controller for the traffic light system, driving the LEDs and managing the timing sequence.

Traffic Light

  • Description: A simple traffic light module with three LEDs.
  • Pins: Green, Yellow, Red, GND
  • Purpose: Represents the traffic light, with each LED corresponding to a light on a standard traffic signal.

Wiring Details

Arduino UNO

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

Traffic Light

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

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;    // Red LED connected to D1
const int yellowPin = 2; // Yellow LED connected to D2
const int greenPin = 3;  // Green LED connected to D3

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);
}

File Name: sketch.ino

Note: The code is written for the Arduino UNO and assumes that the pins are connected as specified in the wiring details. The pinMode() function is used to initialize the pins as outputs, and the digitalWrite() function is used to turn the LEDs on and off. The delay() function is used to control the timing of the light sequence.