Custom-built quadcopter with an STM32 BluePill flight controller implementing GPS-based Return-to-Home (RTH). Features a PID control loop for stable flight, IMU sensor fusion (accelerometer + gyroscope), and autonomous waypoint navigation โ all running on a bare-metal ARM Cortex-M3 at 72 MHz.
The STM32F103C8T6 (BluePill) provides 72 MHz ARM Cortex-M3, multiple timers for PWM generation, hardware I2C/UART for sensors, and DMA โ all at under $2. Enough compute for a 1 kHz PID loop with GPS processing.
Stores home coordinates on arm. On signal loss or RTH trigger, calculates bearing and distance to home using Haversine formula, then commands heading and altitude hold until within landing radius.
Fuses accelerometer and gyroscope data with a complementary filter โ gyro for fast attitude changes, accelerometer for long-term drift correction. Simpler than Kalman with acceptable performance for hobby flight.
Separate PID controllers for roll, pitch, yaw rate, and altitude. Rate PIDs run at 1 kHz using gyro data; angle PIDs at 250 Hz using fused attitude. Manual tuning via serial console.
| Component | Technology | Purpose |
|---|---|---|
| Flight Controller | STM32F103 (BluePill) | 72 MHz ARM Cortex-M3 MCU |
| IMU | MPU6050 | 6-DOF accel + gyro via I2C |
| GPS | NEO-6M UART Module | Position fix for RTH navigation |
| ESC | SimonK / BLHeli | Brushless motor speed control |
| Motors | 2212 920KV Brushless | Quad-rotor propulsion |
| Radio | PPM/SBUS Receiver | Manual control input |
| Framework | Bare-metal C / HAL | Real-time flight firmware |
| Frame | F450 Quadcopter Frame | Airframe structure |