RP2040 Flight Data Recorder

Flight Tracking (In-Progress)

  • Year

    2026

  • Type of Project

    Personal Project

  • My Role

    Solo Developer

Project Links

Personal Project

Objective

Built a portable flight data recorder using an RP2040 microcontroller to capture IMU, GPS, barometric, and magnetometer data at 100Hz with power-loss-protected SD logging, 200Hz Mahony AHRS sensor fusion, a custom signal processing pipeline, and interactive post-flight visualization. Adopted by a collaborator for AI-powered activity characterization.

Process

Selected sensors for high-frequency sampling: BMP390 altimeter, LSM6DSOX IMU, LIS3MDL magnetometer, and PA1010D GPS. The firmware leverages the RP2040's dual-core architecture: Core 0 handles sensor reads and SD card logging at 100Hz while Core 1 runs Mahony AHRS fusion asynchronously at 200Hz. Built a custom signal processing pipeline including GPS quality rejection, complementary altitude filtering, adaptive Kp gain scheduling, and auto sea-level pressure calibration from first GPS fix. Developed calibration utilities for magnetometer hard/soft iron correction and 6-position accelerometer calibration. Analysis tools were built in MATLAB for detailed plotting and live orientation viewing, and in Python/Streamlit for interactive web visualization. The enclosure went through 2 hardware revisions using 3D-printed PLA with heat-set inserts.

Outcome

The system reliably captures 20-column CSV flight logs with orientation quaternions, acceleration, angular velocity, magnetic field readings, altitude, and GPS position. Deployed an interactive Streamlit flight visualizer with 3D trajectory reconstruction and dead reckoning for GPS dropout recovery (rp2040-fdr-visualizer.streamlit.app). The project has been adopted by a collaborator for AI-powered activity characterization.

Standout Features

  • Dual-core firmware architecture separating sensor I/O from AHRS filtering for deterministic 200Hz orientation updates

  • Adaptive Mahony filter with accelerometer rejection that scales down correction gain during high-g maneuvers

  • GPS quality rejection filtering that gates position updates on satellite fix quality

  • Complementary altitude filter fusing barometric and GPS altitude data

  • Auto sea-level pressure calibration from first GPS fix using the reverse barometric formula

  • Power-loss-protected SD logging ensuring data integrity on unexpected power cuts

  • LSM6DSOX hardware LP2 and LPF1 digital filtering enabled via direct I2C register writes

  • Interactive Streamlit web app with live public demo deployment

  • Dead reckoning in the MATLAB and Streamlit visualizers for continuous path estimation through GPS dropouts

  • Automated magnetometer and 6-position accelerometer calibration utilities

Future Enhancements

  • ESP32 migration with EKF sensor fusion (in progress)

  • Custom PCB design integrating all sensors for reduced size and cost

  • BNO085 IMU upgrade for hardware-accelerated sensor fusion

  • Bluetooth wireless data streaming

  • AI-enhanced dead reckoning to reduce position drift during GPS dropouts

  • Altitude fusion model to correct for local pressure variations

  • Battery life prediction and thermal monitoring

  • Anomaly detection for unusual vibration or flight patterns

  • Automated flight phase detection (takeoff, cruise, landing)

craigdukesmith@gmail.com