← Back to Projects
UAV & Flight Controller
Tech: C++, i.MX RT1062 (ARM Cortex-M7), SPI, I2C, UART, DShot, Gazebo
Overview
I built a custom quadcopter from scratch and wrote the bare-metal C++ flight firmware on a 600 MHz NXP i.MX RT1062 (ARM Cortex-M7) microcontroller. Rather than relying on Betaflight or PX4, I wrote the sensor drivers, quaternion attitude estimator, Kalman altitude filter, PID mixer, and DShot ESC protocol directly to control learn and control every part of the stack.
Hardware & Firmware Breakdown
- 1 kHz Hardware-Timed Flight Loop: Triggered the main loop via hardware interval timers on the i.MX RT1062 so IMU reads, state estimation, PID math, and motor writes execute within a deterministic 1,000 µs budget.
- Sensor Bus Drivers & Filtering: Wrote low-level drivers for the BMI323 6-axis IMU (SPI), MS5611 barometer (I2C), and TFmini Plus LiDAR rangefinder (UART), configuring on-chip digital low-pass filters to reject frame vibration and motor harmonics.
- Mahony Quaternion & 2-State Kalman Fusion: Fused gyroscope rates with accelerometer gravity vectors in a Mahony complementary quaternion filter to avoid gimbal lock, and combined vertical earth-frame acceleration with barometer and UART LiDAR altitude in a 2-state Kalman filter for smooth hover hold.
- Digital DShot ESC Signaling: Generated bit-banged/DMA DShot frames with 4-bit CRC checksums to command the four brushless ESCs without analog PWM jitter.
- GTest & Gazebo Verification: Unit-tested PID anti-windup and filter math with GoogleTest and validated step responses in Gazebo hardware-in-the-loop simulation before bench-testing props-off.