Arduino UNO Wi-Fi Controlled Traffic Light System with Camera Integration
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control a traffic light system using an Arduino UNO microcontroller. The system includes a traffic light module, an ESP8266 ESP-01 WiFi module for communication, and a TTL Serial JPEG Camera for capturing images. The Arduino UNO manages the traffic light signals and communicates with the ESP8266 module to send status updates.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
Traffic Light
- Description: A module representing a traffic light with green, yellow, and red LEDs.
- Pins: Green, Yellow, Red, GND
ESP8266 ESP-01 WiFi Module
- Description: A WiFi module used for wireless communication.
- Pins: TXD, CH_PD, RST, VCC, GND, GPIO_2, GPIO_0, RXD
TTL Serial JPEG Camera
- Description: A camera module capable of capturing JPEG images and transmitting them via serial communication.
- Pins: GND, RX, TX, CVBS, 5V
Wiring Details
Arduino UNO
- 5V connected to TTL Serial JPEG Camera 5V
- GND connected to ESP8266 ESP-01 WiFi Module GND
- GND connected to Traffic Light GND
- Vin connected to ESP8266 ESP-01 WiFi Module VCC
- GND connected to TTL Serial JPEG Camera GND
- D9 connected to ESP8266 ESP-01 WiFi Module TXD
- D8 connected to ESP8266 ESP-01 WiFi Module RXD
- D6 connected to TTL Serial JPEG Camera TX
- D5 connected to TTL Serial JPEG Camera RX
- D4 connected to Traffic Light Green
- D3 connected to Traffic Light Yellow
- D2 connected to Traffic Light Red
Traffic Light
- Green connected to Arduino UNO D4
- Yellow connected to Arduino UNO D3
- Red connected to Arduino UNO D2
- GND connected to Arduino UNO GND
ESP8266 ESP-01 WiFi Module
- TXD connected to Arduino UNO D9
- GND connected to Arduino UNO GND
- VCC connected to Arduino UNO Vin
- RXD connected to Arduino UNO D8
TTL Serial JPEG Camera
- 5V connected to Arduino UNO 5V
- GND connected to Arduino UNO GND
- TX connected to Arduino UNO D6
- RX connected to Arduino UNO D5
Code Documentation
Arduino UNO Code
// Pin definitions
const int redPin = 2;
const int yellowPin = 3;
const int greenPin = 4;
const int esp8266RxPin = 8;
const int esp8266TxPin = 9;
void setup() {
// Initialize the traffic light pins as outputs
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
// Initialize serial communication with ESP8266
Serial.begin(9600);
Serial.println("Traffic Light Controller Initialized");
}
void loop() {
// Red light on
digitalWrite(redPin, HIGH);
delay(5000); // Red light for 5 seconds
digitalWrite(redPin, LOW);
// Green light on
digitalWrite(greenPin, HIGH);
delay(5000); // Green light for 5 seconds
digitalWrite(greenPin, LOW);
// Yellow light on
digitalWrite(yellowPin, HIGH);
delay(2000); // Yellow light for 2 seconds
digitalWrite(yellowPin, LOW);
// Send status to ESP8266
Serial.println("Traffic Light Cycle Complete");
}
This code initializes the traffic light pins as outputs and sets up serial communication with the ESP8266 module. The loop function cycles through the red, green, and yellow lights, each for a specified duration, and sends a status message to the ESP8266 module after each cycle.