Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO and ESP8266 Wi-Fi Controlled Traffic Light System

View and Edit Project In Cirkit DesignerImage of Arduino UNO and ESP8266 Wi-Fi Controlled Traffic Light System

Circuit Documentation

Summary

This circuit is designed to control a traffic light system using an Arduino UNO microcontroller. The system also includes an ESP8266 ESP-01 WiFi module for communication purposes. The traffic light consists of three LEDs (Red, Yellow, and Green) that are controlled by the Arduino. The ESP8266 module is used to send status updates of the traffic light cycle.

Component List

Arduino UNO

Traffic Light

ESP8266 ESP-01 WiFi Module

Wiring Details

Arduino UNO

Traffic Light

ESP8266 ESP-01 WiFi Module

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 traffic light sequence, turning on the red, green, and yellow LEDs for specified durations and then sending a status update to the ESP8266 module.