This is the official Arduino C++ library for ESP32 Control Studio, a high-performance Flutter app used to seamlessly control DIY hardware and robotics.
It completely abstracts away all WiFi UDP sockets, bit-shifting, checksum parsing, and connection timeouts into a single clean class.
You can install this directly via the Arduino IDE Library Manager:
- Open Arduino IDE.
- Go to Sketch -> Include Library -> Manage Libraries....
- Search for
ESP32ControlStudio. - Click Install.
The library comes with built-in examples that demonstrate usage in real scenarios. Check out File -> Examples -> ESP32ControlStudio:
BasicControlMotorControl
- Works on ESP32 and ESP8266 cores.
ESP32 Control Studio is a mobile app + Arduino library combo that lets you control your ESP32-based robot or drone from your phone — in real time.
Think of it like a PS4 controller, but running over your home WiFi, with:
- Two analog joysticks (smooth 0–255 range)
- 8 action buttons (A, B, X, Y + extras)
- 4 toggle switches (for modes, lights, etc.)
- Live sensor data back to your phone (battery, telemetry)
Most beginner projects use Bluetooth or HTTP. Here's why those fall short for robotics:
| Method | Latency | Problem |
|---|---|---|
| Bluetooth Classic | 30–100ms | Unstable, drops packets |
| HTTP (REST) | 50–200ms | Too slow, request/response overhead |
| WebSockets (TCP) | 15–40ms | Head-of-line blocking |
| UDP (this project) | < 15ms | ✅ Fast, fire-and-forget |
UDP doesn't wait for acknowledgment — it just sends. For a robot, a dropped frame is better than a delayed one.
Flutter App ──── 8-byte UDP packet ────▶ WiFi Router ──▶ ESP32
(Phone) Port 4210 (Robot)
ESP32 ──── Telemetry packet ──────▶ WiFi Router ──▶ Flutter App
(Robot) Port 4211 (Phone)
- Your phone and ESP32 connect to the same WiFi network
- The app sends an 8-byte control packet 50 times per second
- The ESP32 receives it, drives motors/servos, and sends sensor data back
- The app displays live telemetry on screen
Every control packet is exactly 8 bytes. No wasted space, no parsing complexity.
| Byte | Field | What it does | Range |
|---|---|---|---|
| 0 | Header | Sync byte — always 0xAA |
Fixed |
| 1 | Joy1 X | Left stick horizontal | 0–255 |
| 2 | Joy1 Y | Left stick vertical | 0–255 |
| 3 | Joy2 X | Right stick horizontal | 0–255 |
| 4 | Joy2 Y | Right stick vertical | 0–255 |
| 5 | Buttons | A/B/X/Y packed in 4 bits | 0–15 |
| 6 | Toggles | T1/T2/T3/T4 packed in 4 bits | 0–15 |
| 7 | Checksum | XOR of bytes 0–6 (error check) | 0–255 |
Checksum formula:
checksum = Byte0 ^ Byte1 ^ Byte2 ^ Byte3 ^ Byte4 ^ Byte5 ^ Byte6
If the ESP32 calculates a different checksum, the packet is discarded — protecting against corrupted data.
Download and add ESP32ControlStudio to your Arduino libraries folder.
#include <ESP32ControlStudio.h>
ESP32ControlStudio controlApp;
void setup() {
Serial.begin(115200);
controlApp.begin("YOUR_WIFI_SSID", "YOUR_WIFI_PASSWORD");
// Listens on UDP port 8888 automatically
pinMode(2, OUTPUT); // Onboard LED
}
void loop() {
controlApp.update(); // Must be called every loop — processes incoming packets
if (controlApp.isConnected()) {
// Toggle 1 controls the onboard LED
digitalWrite(2, controlApp.sw1 ? HIGH : LOW);
// Map left joystick Y to motor throttle (-255 to +255)
int throttle = map(controlApp.leftY, 0, 255, -255, 255);
// Add your motor/servo code here...
}
}| Variable | Description |
|---|---|
controlApp.leftX / leftY |
Left joystick axes (0–255) |
controlApp.rightX / rightY |
Right joystick axes (0–255) |
controlApp.btnA / btnB / btnX / btnY |
Button states (true/false) |
controlApp.sw1 / sw2 / sw3 / sw4 |
Toggle switch states (true/false) |
controlApp.isConnected() |
Returns true when app is connected |
Steps:
- Connect to WiFi — Make sure your phone and ESP32 are on the same network
- Find the IP — Open the Serial Monitor in Arduino IDE; it will print something like
ESP32 IP: 192.168.1.50 - Open the App — Enter that IP address and tap Connect
- Start controlling!
- Left joystick → Throttle / Yaw
- Right joystick → Pitch / Roll
- Buttons → Custom actions
- Toggles → Persistent mode switches
The project started with a simple frustration: Bluetooth-based phone controllers lag too much for fast robots.
- Alpha — Proof of concept with raw Python scripts talking to ESP32 via UDP
- Beta — Rebuilt the app in Flutter using the
Providerpattern for 60fps UI with no jank - Release — Finalized the 8-byte protocol with XOR checksum for reliable communication
The biggest insight: for real-time control, losing a packet is fine — but waiting for one is not. UDP was the obvious choice.
| Version | Link |
|---|---|
| Standard Build | ⬇ Download APK |
| Spider-Man Special Edition | ⬇ Download Special Edition |



