

The Traffic Light is a signaling device designed to control traffic flow at intersections. It uses three colored lights—red, yellow, and green—to indicate stop, caution, and go, respectively. This component is commonly used in educational projects, prototyping, and IoT applications to simulate real-world traffic systems.
Manufactured by Arduino, the Traffic Light (Part ID: UNO) is ideal for integration with microcontrollers like the Arduino UNO, enabling users to create interactive and programmable traffic control systems.








The Traffic Light module typically has four pins for connection. Below is the pin configuration:
| Pin | Name | Description |
|---|---|---|
| 1 | Red LED | Connect to a digital output pin to control the red light. |
| 2 | Yellow LED | Connect to a digital output pin to control the yellow light. |
| 3 | Green LED | Connect to a digital output pin to control the green light. |
| 4 | Ground (GND) | Connect to the ground pin of the Arduino UNO or power supply. |
Connect the Pins:
Add Resistors (if required):
Power the Circuit:
Write and Upload Code:
Below is an example code to simulate a basic traffic light sequence:
// Pin assignments for the Traffic Light module
const int redPin = 8; // Red LED connected to digital pin 8
const int yellowPin = 9; // Yellow LED connected to digital pin 9
const int greenPin = 10; // Green LED connected to digital pin 10
void setup() {
// Set the LED pins as outputs
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop() {
// Turn on the red light and wait for 5 seconds
digitalWrite(redPin, HIGH);
delay(5000); // 5000ms = 5 seconds
digitalWrite(redPin, LOW);
// Turn on the yellow light and wait for 2 seconds
digitalWrite(yellowPin, HIGH);
delay(2000); // 2000ms = 2 seconds
digitalWrite(yellowPin, LOW);
// Turn on the green light and wait for 5 seconds
digitalWrite(greenPin, HIGH);
delay(5000); // 5000ms = 5 seconds
digitalWrite(greenPin, LOW);
}
setup() function initializes the LED pins as outputs.loop() function cycles through the red, yellow, and green lights with appropriate delays to simulate a traffic light sequence.LEDs Not Lighting Up:
LEDs Too Dim or Not Working:
Incorrect Light Sequence:
Arduino Not Responding:
Q1: Can I use this Traffic Light module with other microcontrollers?
A1: Yes, the module can be used with other 5V-compatible microcontrollers, but you may need to adjust the code accordingly.
Q2: How can I add a pedestrian crossing signal?
A2: You can add additional LEDs and control them using extra digital pins on the Arduino UNO. Modify the code to include the pedestrian signal logic.
Q3: Can I power the Traffic Light module with a battery?
A3: Yes, you can use a 5V battery pack, but ensure the total current draw does not exceed the battery's capacity.
Q4: How do I simulate a blinking yellow light?
A4: Use the digitalWrite() and delay() functions in a loop to toggle the yellow LED on and off at regular intervals.
By following this documentation, you can effectively use the Traffic Light module in your projects and troubleshoot common issues with ease.