GenxiTechSolutions
iot

Arduino Nano Traffic Signal Controller

Status Completed
Year 2025
Team GenxiTechSolutions

Project Overview

Firmware Architecture, Controller Logic & Hardware Interconnections

The complete toll signaling system is built around a dual-controller architecture utilizing an ESP32 Ethernet Controller and an Arduino Nano Output Controller. The ESP32 manages all network communication, web-server functionality, relay switching commands, and remote traffic signal requests, while the Arduino Nano acts as a dedicated low-level controller responsible for LED driver activation and traffic light state enforcement.

System Design Philosophy
Separating networking functions from power-switching logic increases system stability, improves fault tolerance, simplifies troubleshooting, and ensures that high-current LED driver operations remain isolated from Ethernet communication processes.

ESP32 Ethernet Controller

The ESP32 hosts an embedded HTTP server using the UIPEthernet library and the ENC28J60 Ethernet interface. Through simple URL commands, an operator can remotely switch between STOP and GO traffic states over a wired LAN connection.

ESP32 GPIO Relay Channel Purpose
GPIO14Relay 1Traffic Control Output
GPIO27Relay 2Traffic Control Output
GPIO26Relay 3Traffic Control Output
GPIO13Relay 4Traffic Control Output
GPIO32Relay 5Traffic Control Output
GPIO33Relay 6Traffic Control Output
GPIO25Relay 7Traffic Control Output
GPIO21Relay 8Traffic Control Output

ENC28J60 Ethernet Module Connections

ENC28J60 Pin ESP32 Pin Function
VCC3.3VPower Supply
GNDGNDCommon Ground
SCKGPIO18SPI Clock
SO (MISO)GPIO19SPI Data Receive
SI (MOSI)GPIO23SPI Data Transmit
CSGPIO5Chip Select

ESP32 Firmware Features

  • Embedded HTTP server running on Port 80.
  • Remote URL-based traffic control.
  • Static IP configuration using Ethernet.
  • Persistent configuration storage using Preferences library.
  • Automatic relay state management.
  • Remote traffic light switching through browser requests.
  • LAN deployment without Wi-Fi dependency.
  • Industrial-grade wired communication for toll environments.
HTTP Command Endpoints
GET http://device-ip/go
→ Green Traffic Signal Activated

GET http://device-ip/stop
→ Red Traffic Signal Activated

GET http://device-ip/status
→ Current System Status
        

Arduino Nano Traffic Signal Controller

The Arduino Nano receives the relay state generated by the ESP32 system and translates that state into actual LED driver commands. MOSFET outputs are used because the LED arrays require significantly higher current than a microcontroller GPIO can safely provide.

Arduino Pin Connected Device Function
D2 Relay Output from ESP32 Traffic State Input
D3 Green MOSFET Gate Green LED Driver Enable
D4 Red MOSFET Gate Red LED Driver Enable

Firmware Decision Logic

GO Command Sequence
  1. Operator accesses /go URL.
  2. ESP32 processes HTTP request.
  3. Relay output becomes HIGH.
  4. Arduino reads HIGH on D2.
  5. D3 MOSFET enabled.
  6. Green LED Driver activated.
  7. 354 Green LEDs illuminate.
  8. Vehicles proceed through toll lane.
STOP Command Sequence
  1. Operator accesses /stop URL.
  2. ESP32 processes HTTP request.
  3. Relay output becomes LOW.
  4. Arduino reads LOW on D2.
  5. D4 MOSFET enabled.
  6. Red LED Driver activated.
  7. 354 Red LEDs illuminate.
  8. Vehicles remain stopped for payment.

Controller Source Code Summary

ESP32 Firmware

Uses UIPEthernet, Preferences, EthernetServer, static IP configuration, relay GPIO mapping, HTTP route parsing and persistent storage. The controller listens for browser requests and immediately updates relay outputs connected to the traffic signaling subsystem.

Arduino Nano Firmware

Continuously monitors the relay signal on D2. When HIGH, D3 activates the Green MOSFET while D4 remains disabled. When LOW, D4 activates the Red MOSFET while D3 remains disabled. This guarantees mutually exclusive traffic states.

Safety Mechanism
The firmware architecture ensures that red and green LED arrays can never be energized simultaneously. This interlocked design eliminates conflicting traffic indications and guarantees safe toll booth operation even during repeated network requests or rapid state changes.

Tech Stack

ESP32 Arduino Nano C++ Arduino IDE Relay Module MOSFET Drivers IR Sensors

Tags

#IoT #Embedded Systems #Smart Toll System #Traffic Automation #ESP32 #Arduino
Technical Specs
ControllerESP32 Wi-Fi Microcontroller
Secondary ControllerArduino Nano
Programming LanguageC/C++ (Arduino IDE)
Communication InterfaceDigital GPIO Signaling
Traffic IndicatorsHigh-Power Red & Green LED Arrays
Switching DeviceN-Channel MOSFET Drivers
Relay Module5V SPDT Relay Interface
Vehicle DetectionIR Sensor Module
Network ConnectivityWi-Fi (ESP32)
Response Time< 100 ms
Input Voltage5V DC
Logic Voltage3.3V / 5V Compatible
Automation LogicSensor-Based Vehicle Detection
Display StatusRed (STOP) / Green (GO)
Embedded PlatformArduino Nano + ESP32
Development EnvironmentArduino IDE
Safety FeatureInterlocked Traffic Signal Control
Power ManagementRelay-Isolated LED Driver Switching
Application DomainSmart Toll Collection & Traffic Automation
🤖

GenxiTech Assistant

Online · AI Powered · Always Ready