Sumo 3K - Post 05 - Software
This post discusses WiFi vs Bluetooth decision, how the ESP32 web server works, GPIO logic table, and the GitHub link.
Two connectivity options were evaluated for remote control: Bluetooth and WiFi. Both are supported natively by the ESP32, so the hardware decision didn't constrain the choice. This was purely a software and operational decision.
Bluetooth: Simple pairing, no network infrastructure needed, slightly lower latency for short-range communication. But: can suffer interference in competition environments where multiple devices are broadcasting, and requires a dedicated app or BLE serial terminal on the controller device.
WiFi (selected): The ESP32 creates its own WiFi access point — no router needed. The controller connects to this network and opens a browser to the robot's IP address. The web interface runs in the browser itself. No app installation required, works on any smartphone, and the connection is point-to-point (no other devices on the network).
A browser-based controller requires zero setup on the phone side beyond connecting to a WiFi network. This is critical in a competition environment where you don't want to be debugging Bluetooth pairing between matches.
The firmware is written in C++ using the Arduino IDE. At startup, the ESP32:
Creates a WiFi access point with a fixed SSID and password.
Starts an HTTP server on port 80.
Serves a single HTML page containing the D-pad control interface to any connected client.
Listens for HTTP GET requests on control endpoints (/forward, /backward, /left, /right, /stop).
When a button is tapped on the phone, the browser sends an HTTP GET request to the corresponding endpoint. The ESP32 receives the request, parses it, and sets the appropriate GPIO pins high or low to command the L298N motor driver.
GPIO logic for motor direction
Command IN1 (G26) IN2 (G27) IN3 (G32) IN4 (G33)
Forward HIGH LOW HIGH LOW
Backward LOW HIGH LOW HIGH
Left turn LOW HIGH HIGH LOW
Right turn HIGH LOW LOW HIGH
Stop LOW LOW LOW LOW
The control interface
The web UI served by the ESP32 shows a D-pad layout — four directional arrows and a central stop button — labelled "ESP32 CAR". Tapping any button sends the command; releasing returns to stop. The interface is responsive and works in any smartphone browser without needing mobile data (since you're connected to the robot's own WiFi network).
The full source code is available on GitHub:
github.com/AvyuktChhabra/Sumo-3KG
Comments
Post a Comment