F450 Drone ESP32 Flight Controller for ESP32-WROOM-32
An ESP32 networking project for ESP32-WROOM-32.
Parts and sourceBefore you start
Confirm board compatibility and supported firmware targets in the upstream documentation.
Upstream README
π F450 Drone β ESP32 Flight Controller (ESP-FC)
A high-performance, open-source DIY flight controller for F450 quadcopters built from scratch on the ESP32 microcontroller running patched ESP-FC firmware with full Multi-Sensor diagnostic suites and Betaflight Configurator compatibility.
π Related Repositories (The F450 DIY Drone Series)
This repository is Part 1 of 3 in a modular, open-source F450 drone project ecosystem created by @Arkadip2007. All three projects share identical airframes, ESCs, motors, and sensory payloads, but offer different microcontroller targets and flight firmware architectures:
| # | Repository | Target MCU | Firmware Stack | Ideal Use Case |
|---|---|---|---|---|
| 1 | F450-Drone-ESP32-FlightController (This Repo) | ESP32-WROOM-32 (240MHz) | ESP-FC (v0.2.1 Patched) | Learning FC internals, Wi-Fi telemetry, dual-core DIY architecture |
| 2 | F450-Drone-STM32F411-Betaflight | STM32F411CEU6 Black Pill | Betaflight 4.3.2 / 4.5.1 | Acrobatic freestyle tuning, ultra-fast PID loop, racing dynamics |
| 3 | F450-Drone-STM32F411-INAV | STM32F411CEU6 Black Pill | INAV 5.1.0 / 6.0 Patched | Autonomous GPS navigation, Return-to-Home (RTH), Altitude/Position hold |
Common Shared Hardware: F450 quadcopter frame, A2212 1000KV brushless motors, 30A SimonK analog PWM ESCs, 1045 propellers, 3S LiPo battery, MPU-6050 (GY-521), BMP280 (HW-611), HMC5883L (GY-271), NEO-6M GPS, and FlySky FS-i6 / FS-iA6B i-BUS radio system.
π Table of Contents
- 1. Executive Summary
- 2. Hardware Architecture & BOM
- 3. System Architecture & High-Level Design
- 4. Low-Level Pin Mapping & Wiring
- 5. πΈ Visual Schematics & Configurator Tour (Screenshots)
- 6. The Fake/Clone MPU-6050 Challenge & Fix
- 7. Multi-Sensor Diagnostic Suite
- 8. Flashing & PlatformIO Build Guide
- 9. π Complete Engineering Q&A Journey
- 10. Repository Directory Structure
- 11. License & Credits
1. Executive Summary
[!TIP] π Phase 1 Milestone Achieved: Full 4-Motor Physical Control Unlocked! Bench-testing on the custom handmade green perfboard has achieved 100% success:
- 100% Software Motor Control: All 4 physical motors spin and respond dynamically via Betaflight Configurator and the RC transmitter, resolving the timer conflict encountered on the STM32 build.
- Smart Perimeter Ground Rail: Continuous double-layer soldered copper ground bus enables modular zero-cost addition of future sensors without messy crossing wires.
- Cleared for Maiden Flight: Tested with a minimal, rock-solid sensor setup (Gyro + Accel on MPU-6050) and ready for real-world test flight!
This repository provides everything needed to build, flash, verify, and fly an F450 quadcopter using an ESP32-WROOM-32 (38-pin DevKit).
Key Highlights:
- Zero-Dependency Diagnostics: 4 standalone Arduino test sketches to verify sensors independently before touching flight firmware.
- Custom Whitelisted Binary: Precompiled ready-to-flash binary (
espfc_v0.2.1_esp32_custom_0x00.bin) resolving the notorious Chinese clone MPU-6050 (WHO_AM_I = 0x98) detection lockup. - Betaflight Configurator Support: Communicates over serial USB or Wi-Fi using MSP (MultiWii Serial Protocol), allowing full graphical PID tuning, receiver channel mapping, and motor testing.
- Benchmark Performance: Realized 691 Hz sensor loop rate and over 323 KB free heap memory with zero I2C bus collision on a shared 400kHz bus.
2. Hardware Architecture & BOM
| Component | Model / Variant | Protocol / Interface | Operating Voltage | Role / Function |
|---|---|---|---|---|
| Microcontroller | ESP32-WROOM-32 (38-Pin DevKit) | Dual-Core Xtensa @ 240MHz | 5V USB / 3.3V Logic | Flight controller core execution & Wi-Fi MSP |
| Airframe | F450 (450mm wheelbase) | Fiberglass & polyamide | N/A | High-stability quadcopter platform |
| Propulsion Motors | 4x A2212 1000KV | 3-Phase Brushless AC | 11.1V β 12.6V (3S) | Generates ~2800g total maximum thrust |
| ESCs | 4x 30A Yellow SimonK | Standard Analog PWM (50β400Hz) | 3S LiPo | Drives motors via hardware PWM signals |
| Propellers | 4x 1045 Slow-Fly (10Γ4.5") | 2x CW + 2x CCW | N/A | High-efficiency 10-inch lift generation |
| Battery | 3S LiPo (2200β3300 mAh) | XT60 / Deans | 11.1V (Nominal) | Main system power source |
| Primary IMU | MPU-6050 (GY-521 Module) | I2C (Address 0x68) |
3.3V | 3-axis gyro + 3-axis accelerometer |
| Barometer | BMP280 (HW-611 Module) | I2C (Address 0x76) |
3.3V | Atmospheric pressure & altitude sensing |
| Compass / Mag | GY-271 (Honeywell HMC5883L) | I2C (Address 0x1E) |
3.3V | True compass heading & yaw correction |
| GPS Telemetry | u-blox NEO-6M / GPS-6M | UART Serial (9600 Baud) | 5V (from BEC) | Satellite positioning & coordinates |
| RC Receiver | FlySky FS-iA6B / FS-A8S | Serial i-BUS | 5V (from BEC) | 14-channel low-latency serial control |
| RC Transmitter | FlySky FS-i6 / FS-i6X | AFHDS 2A 2.4GHz | 4x AA Batteries | Ground radio transmitter (Mode 2) |
3. System Architecture & High-Level Design
High-Level System Architecture
flowchart TD
subgraph Power ["β‘ Power System"]
LiPo["3S LiPo Battery\n(11.1V - 12.6V)"]
PDB["Power Distribution Board\n+ 5V BEC"]
LiPo --> PDB
end
subgraph Sensors ["π‘ Sensor Bus (Shared I2C @ GPIO 21 / 22)"]
MPU["MPU-6050 IMU\nClone ID: 0x98\n(Pitch / Roll / Gyro)"]
BMP["BMP280 Barometer\nAddr: 0x76\n(Altitude / Pressure)"]
HMC["HMC5883L Compass\nAddr: 0x1E\n(Magnetic Heading)"]
end
subgraph RC_GPS ["π» Radio & Positioning"]
RX["FlySky Receiver\n(Serial i-BUS)"]
GPS["NEO-6M GPS\n(NMEA Serial UART)"]
end
subgraph Core ["π§ ESP32 Flight Controller (ESP-FC)"]
CPU1["Core 0: Wi-Fi MSP &\nBackground Tasks"]
CPU2["Core 1: 500Hz-1kHz Flight Loop,\nMahony AHRS & PID"]
end
subgraph Propulsion ["π Quad-X Propulsion"]
M1["Motor 1 (Rear-Right, CCW)\nGPIO 27"]
M2["Motor 2 (Front-Right, CW)\nGPIO 25"]
M3["Motor 3 (Rear-Left, CW)\nGPIO 4"]
M4["Motor 4 (Front-Left, CCW)\nGPIO 12"]
end
PDB -->|"11.1V Main Rails"| M1 & M2 & M3 & M4
PDB -->|"5V Regulated"| RX & GPS
PDB -->|"3.3V / 5V VBUS"| Core
Sensors -->|"I2C Bus (SDA 21 / SCL 22)"| Core
RX -->|"UART2 RX (GPIO 16)"| Core
GPS -.->|"UART2 Optional (GPIO 17)"| Core
Core --> M1 & M2 & M3 & M4
Low-Level Firmware Pipeline (ESP-FC Architecture)
flowchart LR
subgraph InputStage ["1. Input Acquisition"]
I1["i-BUS Parser\n(124 Hz)"]
I2["I2C Sensor Read\n(MPU, BMP, HMC)"]
end
subgraph StateEstimation ["2. Attitude Estimation"]
AHRS["Mahony / Madgwick Filter\nCalculates Roll, Pitch, Yaw"]
BARO_FUSE["Barometric Altitude\nZero-referenced"]
end
subgraph FlightControl ["3. PID Stabilization"]
PID_R["Roll PID"]
PID_P["Pitch PID"]
PID_Y["Yaw PID"]
end
subgraph MotorMixer ["4. Quad-X Mixer"]
MIX["Motor Mixer Algorithm\nOutput range 1000 - 2000 Β΅s"]
end
subgraph HardwareOut ["5. Actuator Output"]
ESC["ESP32 MCPWM / LEDC\nGPIO 27, 25, 4, 12"]
end
I1 & I2 --> StateEstimation
StateEstimation --> FlightControl
FlightControl --> MotorMixer
MotorMixer --> HardwareOut
4. Low-Level Pin Mapping & Wiring
Master Pinout Table
| ESP32 Pin | Connected Peripheral | Peripheral Pin | Protocol / Signal Type | Description & Notes |
|---|---|---|---|---|
| GPIO 22 | MPU-6050, BMP280, HMC5883L | SCL | I2C Clock (400kHz) | Shared bus clock line |
| GPIO 21 | MPU-6050, BMP280, HMC5883L | SDA | I2C Data (400kHz) | Shared bus bidirectional data line |
| GPIO 16 | FlySky Receiver (FS-iA6B) | i-BUS Signal | UART2 RX (Serial) | FlySky serial protocol input |
| GPIO 17 | NEO-6M GPS (Optional) | TX Pin | UART2 TX (Serial) | Transmit commands to GPS |
| GPIO 27 | ESC 1 (Rear-Right) | PWM Signal | Hardware PWM (50-400Hz) | Motor 1 (Quad-X CCW) |
| GPIO 25 | ESC 2 (Front-Right) | PWM Signal | Hardware PWM (50-400Hz) | Motor 2 (Quad-X CW) |
| GPIO 4 | ESC 3 (Rear-Left) | PWM Signal | Hardware PWM (50-400Hz) | Motor 3 (Quad-X CW) |
| GPIO 12 | ESC 4 (Front-Left) | PWM Signal | Hardware PWM (50-400Hz) | Motor 4 (Quad-X CCW) |
| 3.3V | All I2C Sensors | VCC / 3.3V | Power Supply | Sensor power (from onboard LDO) |
| GND | All Components | GND | Common Ground | Mandatory: common ground across all modules |
π οΈ Hardware Assembly & Continuity Verification

Bench Assembly: Point-to-point soldering, lead preparation, and continuity verification using a digital multimeter on the prototype flight controller board.
5. πΈ Visual Schematics, Bench Hardware & Telemetry Tour
Part A: Wiring Schematics & Wi-Fi Configurator (Screenshots)
1. Complete ESP32 I2C Sensor Bus Wiring Schematic

Key Observations in this Schematic:
- Shared I2C Bus: SCL on GPIO 22 and SDA on GPIO 21 with parallel taps for MPU-6050 (
0x68), BMP280 (0x76), and HMC5883L (0x1E).- Clean Power Separation: Sensors run on regulated 3.3V power from the ESP32 LDO; the FlySky receiver and GPS module run on 5V from the ESC BEC.
2. Wireless Betaflight Configurator (Over ESP32 Wi-Fi MSP)

Key Observations in this Screenshot:
- Connects to Betaflight Configurator wirelessly via TCP/IP using MultiWii Serial Protocol (MSP).
- Allows real-time tuning of PID gains, rate profiles, and motor testing directly from a laptop on the flight field.
3. Hardware Resource Allocation & CLI Pin Configuration

Key Observations in this Screenshot:
- Shows hardware resource allocation using the esp-fc CLI terminal.
- Confirms timer channel mapping for Motor PWM outputs on GPIO 27, 25, 4, and 12 without I2C pin conflicts.
4. ESP32 Wi-Fi SoftAP Discovery & Pairing

Key Observations in this Screenshot:
- Onboard SoftAP mode (
esp-fc-xxxx) allows instant wireless connection from any computer or mobile device without requiring a home router.
5. WebSerial Browser Firmware Flasher

Key Observations in this Screenshot:
- Browser-based one-click flashing workflow using the Web Serial API and esptool.js.
Part B: Physical Flight Controller Hardware & Active Bench Motor Testing
6. Handmade Green Perfboard PCB (Top Headers & Perimeter Ground Rail)
| Top View: Component Sockets & ESP32 Pin Headers | Bottom View: Continuous Perimeter Copper Ground Bus |
|---|---|
![]() |
![]() |
| Double-sided green plated perfboard with dual female header sockets for 30-pin ESP32 DevKit, sensor expansion headers, and power rails. | Smart Perimeter Ground Architecture: Continuous soldered double-layer copper ground rail encircling the entire board edge, eliminating tangled insulated jumper wires for ground returns. |
π‘ Smart Prototyping Innovation (Double-Layer Perimeter Ground Rail): Unlike traditional single-layer perfboard builds that require messy, crossing insulated wires for every ground connection, this board features a continuous soldered copper bus surrounding the entire perimeter.
- Zero-Cost Modular Expansion: Any future sensor (barometer, compass, GPS, or telemetry module) can instantly tap into ground from any edge of the board with a short jumper bridge.
- Clean Signal Integrity: The outer ground loop helps shield sensitive I2C analog traces from high-frequency motor switching noise.
7. Circuit Board Optical Inspection & Trace Verification

Hardware Quality Check: Visual inspection of female socket alignment, solder fillets, and perimeter ground isolation prior to airframe mounting.
8. Phase 1 Minimal Sensor Testing & Full 4-Motor Physical Control
| Minimal Reliable Sensor Verification (Betaflight) | Complete F450 Bench Setup with Active Motor Control |
|---|---|
![]() |
![]() |
| Handheld verification in Betaflight Configurator: 3D attitude tracking active with exactly 2 core sensors enabled (Gyro + Accelerometer). | Complete F450 quadcopter assembled with ESP32 flight controller wired to all 4 SimonK ESCs, validating full software motor spin and direction control. |
π Major Milestone β 100% Software Motor Control Achieved: In our STM32F411 build, timer mapping conflicts prevented the physical motors from spinning via software. On this ESP32 flight controller, every single motor is fully and independently controllable via Betaflight Configurator and the RC transmitter!
Phase 1 Status:
- Sensor Configuration: Kept intentionally minimal (Gyro + Accel on MPU-6050) to minimize I2C bus overhead and guarantee maximum loop frequency and flight stability.
- Ready for Maiden Flight: The drone has passed all bench tests (ESC calibration, motor spin direction, stick response) and is cleared for its real-world maiden flight test!
- Phase 2 Roadmap: Following a successful flight test, the remaining sensors (BMP280 barometer, QMC5883L compass, NEO-6M GPS) will be populated using the perimeter ground rails.
6. The Fake/Clone MPU-6050 Challenge & Fix
The Root Problem
When purchasing GY-521 breakout boards, many vendors supply remarked clone chips (counterfeit silicon dies or re-marked MPU-6500s).
- I2C Bus Address: Both authentic and clone modules respond at I2C address
0x68. - Silicon Chip ID (
WHO_AM_IRegister0x75):- Authentic InvenSense MPU-6050 returns:
0x68(Decimal 104) - Clone MPU-6050 returns:
0x98(Decimal 152)
- Authentic InvenSense MPU-6050 returns:
Because official ESP-FC v0.2.1 firmware enforced a strict whitelist (whoami == 0x68 || whoami == 0x72), the flight controller refused to boot, reporting sensor failure.
The Patch
In firmware/esp-fc-source/esp-fc-0.2.1/lib/Espfc/src/Device/GyroMPU6050.h:
// Line 245 in GyroMPU6050.h
bool testConnection() override
{
uint8_t whoami = 0;
uint8_t len = _bus->readByte(_addr, MPU6050_RA_WHO_AM_I, &whoami);
// Patched to include 0x98:
return len == 1 && (whoami == 0x68 || whoami == 0x72 || whoami == 0x98);
}
This single modification unlocks 100% full hardware functionality while preserving all internal math, filters, and attitude fusion algorithms.
7. Multi-Sensor Diagnostic Suite
Located under sensor-tests/, these Arduino sketches require no third-party libraries and allow complete pre-flight validation:
| Test Sketch | Location | What it Tests |
|---|---|---|
all_sensors_live.ino |
sensor-tests/all-sensors-live/ |
Runs MPU-6050, BMP280, HMC5883L, and GPS simultaneously. Computes live pitch, roll, heading, altitude, and ESP32 loop speed. |
mpu6050_scanner.ino |
sensor-tests/mpu6050-scanner/ |
Scans I2C bus, reads register 0x75, detects clone status (0x98), wakes chip, reads raw gyro/accel. |
bmp280_scanner.ino |
sensor-tests/bmp280-scanner/ |
Reads chip ID (0x58), verifies 24-byte factory calibration tables, reads real-time temperature and barometric pressure. |
gy271_scanner.ino |
sensor-tests/gy271-scanner/ |
Detects whether compass is authentic Honeywell HMC5883L (0x1E), QMC5883L (0x0D), or QMC5883P (0x2C). Computes magnetic heading. |
8. Flashing & PlatformIO Build Guide
π» Workstation Flashing & Live Bring-Up

Workstation Bring-Up: Connecting the assembled ESP32 flight controller over USB to flash firmware binaries and verify real-time telemetry orientation.
Option A: Flash Precompiled Custom Binary (Easiest)
Using esptool.py (via Python or PlatformIO):
esptool.py --chip esp32 --port COM_PORT --baud 921600 write_flash -z 0x0 firmware/espfc-v0.2.1-custom-bin/espfc_v0.2.1_esp32_custom_0x00.bin
(Replace COM_PORT with your ESP32's COM port, e.g., COM3 on Windows or /dev/ttyUSB0 on Linux).
Option B: Build from Source Using PlatformIO
- Open
firmware/esp-fc-source/esp-fc-0.2.1in VS Code with the PlatformIO extension installed. - Build the project:
pio run -e esp32 - Flash to the board:
pio run -e esp32 --target upload
9. π Complete Engineering Q&A Journey
For a comprehensive chronological breakdown of every problem faced during the ESP32 flight controller development, root-cause analyses, and solutions applied, see the dedicated engineering log:
10. Repository Directory Structure
F450-Drone-ESP32-FlightController/
βββ README.md # Master project documentation & guide
βββ LICENSE # MIT Open Source License
βββ .gitignore # PlatformIO and build gitignore rules
β
βββ firmware/
β βββ README.md # Firmware flashing & build guide
β βββ espfc-v0.2.1-custom-bin/
β β βββ README.md # Binary offset & flashing notes
β β βββ espfc_v0.2.1_esp32_custom_0x00.bin # Precompiled ready-to-flash image
β βββ esp-fc-source/
β βββ esp-fc-0.2.1/ # Complete patched source code tree
β βββ platformio.ini # PlatformIO build configuration
β βββ lib/Espfc/src/Device/GyroMPU6050.h # Patched gyro driver (0x98 whitelist)
β
βββ sensor-tests/
β βββ README.md # Hardware test suite documentation
β βββ all-sensors-live/
β β βββ README.md
β β βββ all_sensors_live.ino # Comprehensive all-in-one telemetry sketch
β βββ mpu6050-scanner/
β β βββ README.md
β β βββ mpu6050_scanner.ino # WHO_AM_I register & IMU test
β βββ bmp280-scanner/
β β βββ README.md
β β βββ bmp280_scanner.ino # Barometer calibration & altitude test
β βββ gy271-scanner/
β βββ README.md
β βββ gy271_scanner.ino # Compass identification & heading test
β
βββ docs/
βββ README.md # Technical documentation directory
βββ engineering-qa-troubleshooting.md # Complete Q&A engineering journey & fixes
βββ master-project-documentation.md # Full engineering log & diagnostics
βββ wiring-guide.md # Detailed step-by-step physical connections
βββ flashing-guide.md # Detailed esptool and PlatformIO flashing instructions
βββ images/ # Visual documentation & schematics
βββ README.md # Image directory catalog & annotations
βββ esp32-i2c-wiring-schematic.png # Full breadboard & sensor wiring schematic
βββ esp32-betaflight-configurator.png# Betaflight Configurator connected over Wi-Fi
βββ esp32-cli-pin-assignment.png # CLI hardware pin verification
βββ esp32-wifi-ap-connection.png # SoftAP Wi-Fi network pairing
βββ esp32-firmware-flasher.png # Browser-based firmware flashing
11. License & Credits
- Project Author: Arkadip Mahapatra
- Base Flight Firmware: ESP-FC by rtlopez
- License: Licensed under the MIT License.



