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
- Description: A microcontroller board based on the ATmega328P. It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.
- Purpose: Acts as the central controller for the traffic light system, driving the LEDs in the correct sequence.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13
Traffic Light
- Description: A simple traffic light module with three LEDs representing the Red, Yellow, and Green lights.
- Purpose: To display the traffic light sequence as controlled by the Arduino UNO.
- Pins: Green, Yellow, Red, GND
Wiring Details
Arduino UNO
- GND: Connected to the GND pin of the Traffic Light to establish a common ground.
- 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 pin D3 on the Arduino UNO.
- Yellow: Connected to pin D2 on the Arduino UNO.
- Red: Connected to pin 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; // 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.
