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

ESP32-Controlled Multi-Intersection Traffic Light System with IR Sensors

View and Edit Project In Cirkit DesignerImage of ESP32-Controlled Multi-Intersection Traffic Light System with IR Sensors

Circuit Documentation

Summary

The circuit in question is designed to interface multiple IR sensors with an ESP32 microcontroller to control a set of traffic lights. The ESP32 reads inputs from the IR sensors and drives the traffic lights accordingly. Each traffic light has three LEDs (Red, Yellow, Green) and a common ground. The IR sensors are powered by the 3.3V supply from the ESP32 and their outputs are connected to individual GPIO pins on the ESP32 for sensing.

Component List

IR Sensors

ESP32 (30 pin)

Traffic Lights

Wiring Details

IR Sensors

ESP32 (30 pin)

Traffic Lights

Documented Code

// Define traffic light control pins
int redPins[] = {15, 2, 4, 5};
int yellowPins[] = {18, 19, 21, 22};
int greenPins[] = {13, 12, 14, 27};

// Define IR sensor input pins
int irPins[] = {25, 33, 32, 35};

void setup() {
  // Initialize traffic light control pins as outputs
  for (int i = 0; i < 4; i++) {
    pinMode(redPins[i], OUTPUT);
    pinMode(yellowPins[i], OUTPUT);
    pinMode(greenPins[i], OUTPUT);
  }

  // Initialize IR sensor pins as inputs
  for (int i = 0; i < 4; i++) {
    pinMode(irPins[i], INPUT);
  }
}

void loop() {
  // Traffic light and IR sensor logic
  // ...
  // The code here controls the traffic lights based on the IR sensor inputs
  // ...
}

Note: The provided code snippet is a simplified version of the actual code. It initializes the pins and provides a structure for the main loop where the traffic light control logic should be implemented. The actual code would include the logic to read the IR sensor inputs and control the traffic lights accordingly.