A traffic light is a signaling device that uses colored lights—red, yellow, and green—to control traffic flow at intersections. The red light signals vehicles to stop, the yellow light indicates caution and prepares drivers to stop, and the green light allows vehicles to proceed. Traffic lights are essential for maintaining order and safety on roads and are widely used in urban and suburban areas.
Below are the general technical specifications for a standard traffic light module used in electronics projects:
Parameter | Value |
---|---|
Operating Voltage | 5V DC |
Current Consumption | ~20mA per LED |
LED Colors | Red, Yellow, Green |
LED Type | 5mm or 10mm diffused LEDs |
Control Pins | 3 (one for each LED) |
Module Dimensions | ~30mm x 70mm |
The traffic light module typically has three pins for controlling the LEDs. Below is the pin configuration:
Pin | Name | Description |
---|---|---|
1 | Red LED | Controls the red LED (stop signal) |
2 | Yellow LED | Controls the yellow LED (caution signal) |
3 | Green LED | Controls the green LED (go signal) |
4 | GND | Ground connection for the module |
5 | VCC | Power supply input (5V DC) |
Below is an example Arduino sketch to control a traffic light module:
// Pin definitions for the traffic light module
const int redPin = 2; // Red LED connected to digital pin 2
const int yellowPin = 3; // Yellow LED connected to digital pin 3
const int greenPin = 4; // Green LED connected to digital pin 4
void setup() {
// Set the LED pins as outputs
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
}
void loop() {
// Turn on the green light for 5 seconds
digitalWrite(greenPin, HIGH);
delay(5000); // Wait for 5 seconds
digitalWrite(greenPin, LOW);
// Turn on the yellow light for 2 seconds
digitalWrite(yellowPin, HIGH);
delay(2000); // Wait for 2 seconds
digitalWrite(yellowPin, LOW);
// Turn on the red light for 5 seconds
digitalWrite(redPin, HIGH);
delay(5000); // Wait for 5 seconds
digitalWrite(redPin, LOW);
}
LEDs Not Lighting Up:
Flickering LEDs:
Incorrect LED Behavior:
By following this documentation, you can effectively use a traffic light module in your projects and troubleshoot common issues with ease.