Back to Projects

ESP32 Quadcopter (Custom Control Board + Wi-Fi UI)

Built a quadcopter control stack around an ESP32 with gyro feedback and on-device PID tuning via a Wi-Fi-hosted control page + camera feed.

ESP32PID controlGyroscope/IMUPWM motor controlMOSFET driversPower integrityWi-Fi web UIEmbedded C

Gallery

Problem

Quadcopters are an archetypal control-systems application: stable flight requires closed-loop stabilization. The goal was to avoid a purpose-built flight controller and instead implement the sensing and PID stabilization logic on a general-purpose microcontroller that could also host a camera + web-based interface.

System Overview

An ESP32 development board reads angular data from an external gyroscope board. Deviations from level flight are fed into a PID controller that adjusts motor speeds via PWM. The ESP32 also hosts a local Wi-Fi server: clients connect to a web page that displays a live camera feed and exposes fields to adjust PID constants without reflashing firmware.

Hardware

The controller and sensors were soldered onto perfboard and integrated into a lightweight frame with four coreless DC motors. Because each motor can draw >1 A, motor power is sourced directly from the Li-Po battery while control is done using ESP32 GPIO driving MOSFET switches. Each motor corner uses a MOSFET + gate resistor + discharge resistor and a Schottky diode for back-EMF protection. A low-dropout 3.3 V regulator provides stable logic power for the ESP32 and gyroscope.

Firmware / Software

Firmware reads gyro angles, computes PID correction, and applies PWM outputs to the motors. A Wi-Fi-hosted page provides: (1) a camera feed, (2) takeoff control, and (3) runtime PID constant updates to speed up tuning iterations.

Results

The drone can generate sufficient lift to fly. However, stable flight could not be maintained for more than a few seconds even after extensive PID tuning. The electronics package weight pushes the build below common recommended thrust-to-weight margins for stable control.

Failures & Lessons

High-current PWM switching introduced electrical noise that degraded camera quality. Adding capacitors at the regulator did not resolve it; isolating sensitive ESP32 power on a second 1S battery did. The bigger lesson: performance is constrained by system-level tradeoffs (mass, thrust margin, power distribution), not just control algorithm tuning.

Next Steps

Migrate to a 2S battery + efficient brushless motors + commercial ESCs to improve thrust-to-weight and control authority. This requires rewriting ESP32 motor control logic and building a new frame sized for larger motors, propellers, and battery.