ENGINEERING DEMO
BRIDGE OPENING PROJECT
SYSTEM DOC โ€ข v1.0

Bridge Opening Control Overview

Full-stack IoT control chain: Next.js (Edge) โ†’ ESP32 (Gateway) โ†’ Arduino (Actuator)

๐ŸŽ›๏ธLaunch Control PanelView Source Codeโ†—
LINK
ONLINE
MODE
MANUAL INTERLOCK
ACK
READY
SECTION A โ€ข SYSTEM ARCHITECTURE
๐Ÿ—๏ธ

Schematic Data Flow

From user input โ†’ edge โ†’ gateway โ†’ actuation.

Web UINext.js ClientEdge API/api/cmd ProxyESP32HTTP GatewayArduinoHardware Control
๐ŸŒ
Frontend
Next.js App Router
โšก
Edge API
/api/cmd Proxy
๐Ÿ“ก
Gateway
ESP32 HTTP
โš™๏ธ
Driver
Arduino UNO
SECTION B โ€ข COMMAND PROTOCOL
๐ŸŽฎ

Numeric Op-Codes

Firmware state machine receives 0โ€“9 over UART.

0
STOP / IDLE
1
AUTO MODE
2
MANUAL MODE
3
EMERGENCY STOP
4
SYSTEM RESET
5
BRIDGE RAISE
6
BRIDGE LOWER
7
BOOM OPEN
8
BOOM CLOSE
9
SCALE RE-TARE
โš ๏ธ
Manual Interlock
Commands 5โ€“9 are ignored unless system is in MANUAL (2) mode.
SECTION C โ€ข INTERACTION LOOP

๐Ÿ“ก Request โ†’ Actuation โ†’ ACK

01
User Input
Click or Hotkey (0โ€“9) on UI.
02
Edge Proxy
POST /api/cmd validates payload.
03
WiFi Request
Forwarded to ESP32 over HTTP.
04
Serial Bus
ESP32 relays byte to UNO via UART.
05
Actuation
UNO drives motors/relays.
06
Feedback
ACK response bubbles back to UI.
SECTION D โ€ข SIMULATION

๐Ÿงช Mock Mode

No hardware connected? Enable Simulation Mode in the toolbar.

The UI intercepts requests and returns synthetic ACK signals, letting you test interface logic without the physical bridge.

SECTION E โ€ข QUICK LINKS
SECTION F โ€ข DEPLOYMENT GUIDE
๐Ÿš€

Bring-Up Steps

Env โ†’ flash โ†’ wiring โ†’ live control.

01
Environment
Set ESP32_BASE_URL in .env.local to the device static IP.
02
ESP32 Flash
Upload sketch from /Arduino/esp32_gateway. Ensure Wi-Fi creds are correct.
03
UNO Upload
Flash the logic controller. Connect Tx/Rx pins between boards.