ESP32-Drone - Wi‑Fi quadcopter flight stack with browser UI
Welcome to ESP32-Drone, an open-source flight controller firmware for ESP32-based mini quads. It pairs MPU6050 attitude sensing with a Madgwick filter, attitude PID stabilization at 250 Hz, and a dark-themed web control panel served over Wi‑Fi. Joystick input, tuning, motor checks, and configuration all run in the browser via HTTP and WebSockets.
⚠️ Safety: Flying multirotors can cause injury or property damage. Use only where permitted, with propellers removed during bench testing when appropriate, and never arm unless you understand the controls. This project is for education and hobby use — you are responsible for compliance with local laws and safe operation.
Replace factory Wi‑Fi credentials in
Firmware.ino(or save new ones in Settings) before deploying.
- Virtual sticks — Roll, pitch, yaw, throttle over WebSocket (
JOY:) - ARM / DISARM — Props enabled only when armed; instant ESTOP
- IMU calibrate —
CALIBRATEover WebSocket (drone still on a level surface) - Angle mode — Sticks command target tilt (within configurable max tilt); optional direct mix when PID is off
- MPU6050 on I2C (default SDA 21, SCL 22; NVS configurable)
- Madgwick AHRS with adjustable beta
- PID loop — Live Kp / Ki / Kd from the PID tab; enable/disable stabilization without reflash
- Idle throttle % — Optional minimum throttle at zero stick when armed (0–40%)
- Wi‑Fi STA — Connects using SSID/password from NVS or sketch defaults
- Web UI (
/) — Single-page app: Flight, Telemetry, PID, Motor Test, Settings - Telemetry — ~20 Hz JSON: attitude, motor PWM, arm state, PID gains, loop rate, link packet stats
- Motor test — Per-motor PWM sliders when disarmed (with short hold after release)
- Wi‑Fi SSID and password (optional clear password)
- Motor GPIO pins, PWM frequency and resolution
- I2C pins, Madgwick beta, max tilt degrees
/restartPOST for reboot after pin changes
⚠️ PCB / hardware risk: This board is a custom, experimental PCB — it may have layout or wiring issues and is not guaranteed for any use case. Check polarity, power, and grounds before applying voltage or flying. Firmware cannot fix bad hardware. No warranty — use at your own risk.
Typical build:
| Block | Notes |
|---|---|
| MCU | ESP32 (Arduino-ESP32 core) |
| IMU | MPU6050 @ 0x68, I2C |
| Motors | Four brushed (or ESC) outputs — X quad mix: FL, FR, BL, BR |
| Wi‑Fi | Antenna as per your module; set credentials for your network |
Default GPIO pins in firmware (change in sketch or Settings + restart):
| Motor | Default pin |
|---|---|
| Front left | 33 |
| Front right | 4 |
| Back left | 25 |
| Back right | 32 |
-
Arduino IDE or Arduino CLI with esp32 board support
-
Libraries (install via Library Manager where possible):
- WiFi, WebServer, WebSocketsServer (by Markus Sattler / links2004), Wire, Preferences — as used in
Drone.ino
- WiFi, WebServer, WebSocketsServer (by Markus Sattler / links2004), Wire, Preferences — as used in
- Open
Drone.inoin Arduino IDE (or add this folder as a sketch). - Select your ESP32 board and correct COM port.
- Set
DEF_WIFI_SSID/DEF_WIFI_PASS(or configure later in the web Settings tab). - Upload the sketch.
- Open Serial Monitor @ 115200 — note the IP address after Wi‑Fi connects.
- On your phone or PC browser:
http://<IP>/— use Flight to connect WebSocket (port 81); the page handles this when served from the device.
Motor / I2C / PWM changes from Settings require Save then Restart when prompted.
Distributed under the MIT License. See LICENSE.txt for more information.
▶ Support me on Patreon patreon.com/cifertech
CiferTech - @twitter - CiferTech@gmali.com
Project Link: https://github.com/cifertech/ESP32-DIV
- 💬 Found a bug or have a feature request? Open an Issue
- ⭐ Like the project? Star the repo!
- 🛠 Want to contribute? Fork it and submit a pull request.
