Development of flight controller for UAV using multi-sensor fusion
Description
An open-source, low-cost UAV flight controller built from scratch on Arduino Mega 2560 and ESP32. Integrates five sensors — MPU-6050 (gyroscope + accelerometer), BMP280 (barometer), dual VL53L1X LiDAR modules, and NEO-6M GPS — for GPS-independent stable flight. Features a Complementary Filter at 250 Hz for real-time attitude estimation, X-frame motor mixing, and a 5-state Finite State Machine for safe autonomous operation.
Objectives
The objective of this project is to design and develop a transparent, open-source UAV flight controller as a low-cost alternative to expensive proprietary systems. The controller integrates five sensors — a gyroscope, accelerometer, barometer, dual LiDAR modules, and GPS — enabling robust GPS-independent navigation. A Complementary Filter running at 250 Hz eliminates gyroscope drift and provides stable real-time roll, pitch, and yaw estimation. An ESP32 handles dedicated ESC PWM control for four 1400KV BLDC motors on an F450 quadcopter frame, communicating with the Arduino Mega 2560 over UART. A 5-state Finite State Machine governs safe flight operations from arming through autonomous landing, with emergency tilt cut-off safety interlocks. Live telemetry is broadcast at 250,000 baud for real-time monitoring and debugging.
Socio-economic benefit
This project delivers significant socio-economic value across multiple domains. By building an open-source flight controller on accessible hardware costing a fraction of commercial alternatives, it democratizes UAV technology for students, researchers, and startups in developing countries like Pakistan. In agriculture, the drone enables precision crop monitoring and surveying, directly supporting food security and reducing farming costs for smallholders. In disaster management, GPS-independent navigation allows the UAV to operate in forests, urban canyons, and tunnels where conventional drones fail — enabling faster emergency response and reducing human risk. The open-source nature of the project allows future researchers and engineers to build upon it freely, accelerating innovation in autonomous systems domestically. It aligns with Pakistan's vision of indigenous technology development and reduces reliance on imported closed-source systems. The project supports SDG 2 (Zero Hunger), SDG 9 (Industry, Innovation and Infrastructure), SDG 11 (Sustainable Cities), SDG 13 (Climate Action), and SDG 15 (Life on Land).
Methodologies
The project follows a modular hardware-software co-design methodology. In the first phase, each sensor was individually interfaced with the Arduino Mega 2560 and validated — MPU-6050 over I2C at 400kHz, BMP280 over I2C, dual VL53L1X LiDAR modules with XSHUT re-addressing, and NEO-6M GPS over UART Serial2 using the TinyGPS++ library. In the second phase, all five sensors were integrated simultaneously and validated through live serial telemetry at 250,000 baud. A Complementary Filter with alpha 0.98 was implemented for real-time attitude estimation at 250 Hz, fusing gyroscope and accelerometer data to eliminate drift. In parallel, an ESP32 was programmed to control four 40A ESCs using PWM signals between 1000 and 2000 microseconds, with X-frame motor mixing logic for roll, pitch, and yaw authority. A 5-state Finite State Machine was designed covering DISARMED, ARMED, FLYING, ALT_HOLD, and LAND states with emergency safety interlocks. The final phase involves UART integration of the Arduino Mega and ESP32 for closed-loop flight testing on the F450 quadcopter frame.
Outcome
The project successfully achieved simultaneous integration and validation of all five sensors on the Arduino Mega 2560, with live telemetry confirming stable real-time data from each sensor. The Complementary Filter delivers stable roll, pitch, and yaw estimation at 250 Hz with less than 0.5 degrees of drift during bench testing. The ESP32 motor control unit has been independently verified with four 40A ESCs and 1400KV BLDC motors. The 5-state FSM, X-frame motor mixing algorithm, and tilt safety cut-off have been fully designed, implemented, and bench tested. UART integration of the two processors, the project will demonstrate a fully functional, low-cost, open-source UAV flight controller capable of stable GPS-independent flight — providing a replicable academic platform for future UAV research at COMSATS University Wah Campus.
Gallery
More from Mechanical Engineering
Development of Sustainable Thermal Insulation Material for Green Buildings Using Waste Hem…
The present research aims to develop an eco-friendly and cost-effective thermal insulation composite material…
Supervisor: Dr. Atta ur Rehman Shah
Controller based intelligent conveyer system with AI integrated vision for bottle caps sor…
The AI Based Conveyor Belt System for Bottle Cap Sorting is an intelligent, automatic, and highly accurate qua…
Supervisor: Engr Awais Hamza
Experimental evaluation of desiccant materials for air water generation applications
"Experimental Evaluation of Desiccant Materials for Air-Water Generation Applications” is a research-based pro…
Supervisor: Dr Arsalan Ahmed
DESIGN AND DEVELOPMENT OF THERMOSIPHON HEAT EXCHANGER .
Project Description : The Design and Development of Thermosiphon Heat Exchanger project focuses on recovering…
Supervisor: DR .ABUZAR JAMIL