Sensor fusion guide: IMU, GNSS and Kalman filter

Sensor Fusion Guide: IMU, GNSS, Barometer and Kalman Filter for RC Positioning

A drone holding steady in the air, an autonomous vehicle following its route and a plane returning home all depend not on one sensor but on several working together. Every sensor has a weakness. Sensor fusion combines their data to produce position, attitude and altitude estimates more accurate than any single sensor could provide. This guide covers the sensors used in RC systems, their strengths and weaknesses, and how their data is combined.

5 min read
In this article 7
  1. Sensors used in RC systems
  2. How sensor fusion works
  3. Real-time processing
  4. Safety and redundancy
  5. Practical setup tips
  6. Frequently asked questions
  7. Related guides

Sensors used in RC systems

SensorMeasuresStrengthWeakness
GyroscopeAngular rateVery fast, very precise short termDrifts over time
AccelerometerLinear acceleration and gravity directionLong-term tilt referenceVery sensitive to vibration
Magnetometer (compass)Heading relative to magnetic northAbsolute headingDisturbed by motors and wiring; needs calibration
BarometerAltitude from air pressureFast, sensitive altitude changesAffected by airflow and temperature
GNSS (GPS, Galileo, GLONASS)Global position and velocityDoesn’t drift long termSlow updates, metre-level error, no indoor coverage
LiDAR / sonar / optical flowDistance or motion relative to the groundPrecise at low altitudeRange- and surface-dependent

IMU: gyroscope and accelerometer

An IMU (inertial measurement unit) combines a gyroscope and accelerometer on one chip; some also include a magnetometer. Chips such as the MPU6000 and ICM-42688 are common in flight controllers. Gyro data is read in the kilohertz range and measures rotation very precisely, but as readings are integrated, small errors accumulate and the attitude estimate drifts. The accelerometer helps correct that drift by showing the direction of gravity.

Isolating the IMU from vibration directly affects fusion quality. Unbalanced props and loose mounts are the most common sources of trouble. If you want to experiment yourself, our guide to angle measurement with the MPU6050 shows a complementary filter in action.

Barometer and magnetometer

A barometer (such as the BMP280 or MS5611) is the basis of altitude-hold modes. Covering it with a thin piece of foam to shield it from propeller wash is common practice.

The magnetometer tells the vehicle which way it is facing. It is mounted away from power cables and motors, usually on a mast together with the GPS module. Software often calculates local magnetic declination automatically, but the compass must be calibrated on every new build.

GNSS modules

Modules such as the u-blox M8/M10 series use several satellite systems at once and output a position fix a few to ten times per second. Under open sky, typical error is a few metres. RTK systems use corrections from a reference station to reach centimetre level and are used for mapping, agriculture and precise autonomous missions. See our guide to RTK GPS.

How sensor fusion works

The core idea is simple: correct the fast-but-drifting sensor with the slow-but-stable one.

  • Attitude: The gyro provides short-term change; the accelerometer and magnetometer provide the long-term reference.
  • Altitude: The barometer provides fast changes and GNSS the long-term reference; the accelerometer speeds up vertical response.
  • Position: GNSS provides absolute position and the IMU estimates motion between GNSS updates.

Filters

MethodHow it worksWhere it’s used
Complementary filterBlends gyro (trusted at high frequency) and accelerometer (trusted at low frequency)Simple stabilisation, Arduino projects
Madgwick / MahonyLightweight quaternion-based attitude algorithmsSmall flight controllers, robotics
Kalman filterModels each sensor’s uncertainty and optimally combines prediction and measurementPosition and altitude estimation
EKF (extended Kalman filter)Kalman adapted for non-linear systemsArduPilot (EKF3), PX4 (EKF2)

Autopilots such as ArduPilot and PX4 do fusion automatically with an EKF. Your job is to mount and calibrate the sensors correctly and watch the logs for inconsistencies. INAV also combines GPS, barometer and IMU data for modes such as position hold and return-to-home.

Real-time processing

Sensor data is only useful if it is processed on time. Flight controllers therefore run fixed-rate loops: read the gyro, filter it, compute PID and update motor commands. On drones these loops run in the kilohertz range. Slower sensors (GNSS, barometer) are read at their own rate and fed into the fusion algorithm. DMA and interrupt-driven reads help the processor carry this load without delay.

The output of fusion feeds the control loop directly, so sensor quality also determines how well your PID tune works.

Safety and redundancy

  • Sensor consistency checks: EKF-based systems warn you, or refuse to arm, when sensors disagree.
  • Dual sensors: Professional systems use two IMUs or two GNSS receivers and switch if one fails.
  • Geofence: If the vehicle leaves a defined boundary, it returns or lands automatically.
  • Failsafe: Define safe behaviour for loss of signal or GNSS. See failsafe explained.

Practical setup tips

  • Soft-mount the flight controller on vibration dampers.
  • Keep the GNSS and compass module away from power wires and ESCs.
  • Repeat accelerometer and compass calibration on every build.
  • Log the first flights and check vibration levels and sensor consistency.
  • In open areas, wait for GNSS to acquire enough satellites before take-off.

Frequently asked questions

Why isn’t GPS enough on its own?

GPS gives only a few updates per second, and position wanders by metres. A drone needs attitude updates thousands of times per second to stay stable, and that comes from the IMU.

Do I need to write my own Kalman filter?

Not if you use an off-the-shelf autopilot (ArduPilot, PX4, INAV); fusion is built in. For your own robot or Arduino project, a complementary filter or Madgwick is a good place to start.

Which projects benefit from sensor fusion?

Drones, fixed-wing autopilots, autonomous boats and rovers, self-balancing robots and mapping projects. For choosing distance sensors on autonomous vehicles, see choosing LiDAR for autonomous RC, and for the full picture of autonomous flight, read autonomous flight control for drones.

Found this useful?Share it with a friend or follow us on Instagram for new projects.

Similar Posts