Weighted Sensor Fusion: Combining Two Estimates

How inverse variance weights combine two noisy sensor readings, with a worked example and the link to a simple Kalman update.

Reference
RE-4117
Published
Read
8 min

About the author · Editorial & verification standards

Mobile robot chassis with a lidar, IMU and encoders on a workbench

Weighted sensor fusion combines two noisy estimates of the same quantity by giving more weight to the one with the smaller variance. The weights are the inverse variances divided by their sum, and the fused result always has a smaller variance than either input.

Key takeaways

  • Inverse variance weighting gives each sensor a weight equal to its inverse variance divided by the sum of both inverse variances.
  • The fused variance equals 1 / (1/v1 + 1/v2), which is always smaller than the smaller input variance.
  • A scalar Kalman measurement update gives the same result as this weighted average.
  • Weighting reduces random noise only; it does not remove bias, outliers or shared error sources.

Two Noisy Estimates

Sensor fusion means combining readings from more than one source into a single better estimate. Suppose a robot needs one number, say the distance to a wall or the heading angle, and it has two ways to get it. Each reading is the true value plus some error. If you simply pick one, you throw away information. If you average them equally, you treat a good sensor and a poor sensor as if they were the same. A sensor fusion weighted average sits between those two choices: it trusts each source in proportion to how reliable it is.

IMU / Wheel OdometryHigh-Rate u_k (200 Hz)LiDAR / GPS / ArUcoLow-Rate Obs z_k1. PREDICT (Time Update)x_k|k-1 = F*x + B*u2. UPDATE (Measurement)K_k = P*H^T*(H*P*H^T+R)^-1Fused Pose x_kx, y, theta & Cov P_kNav2 / ControlDrift-Free StateCovariance P_k|k Feedback Loop
Figure: Extended Kalman Filter (EKF) predict-update cycle fusing high-rate IMU/odometry with drift-correcting pose observations.

Two assumptions keep the maths simple. First, each sensor has zero average error (no constant bias). Second, the errors of the two sensors are independent, so one sensor being wrong tells you nothing about the other. Real sensors often break both assumptions, and the last section covers what that costs you.

The quantity that measures how unreliable a sensor is, in this context, is its variance, written σ². It is the square of the standard deviation. If a range sensor scatters by about 2 cm around the true distance, its variance is 4 cm squared.

Inverse Variance Weights

Let the two readings be x1 and x2 with variances v1 and v2. The fused estimate is a weighted sum x = w1·x1 + w2·x2, with the weights adding up to 1. Choosing the weights that minimise the variance of the result gives:

  • w1 = (1/v1) / (1/v1 + 1/v2)
  • w2 = (1/v2) / (1/v1 + 1/v2)

In words: take the inverse of each variance, then divide each by the total. A sensor with a quarter of the variance gets four times the weight. If the two variances are equal, both weights are 0.5 and you are back to the plain average.

An equivalent form is easier to code and to reason about. Write x = x2 + w1·(x1 - x2). You start from one sensor and correct it by a fraction of the disagreement. That “start, then correct by a fraction of the difference” shape returns later when we reach filters.

Worked Example with Two Sensors

Take two distance estimates to a wall. Source A is a range sensor, for example an HC-SR04 ultrasonic sensor, and source B is a distance predicted from wheel odometry. The noise values below are placeholders chosen to make the arithmetic clear. Check your own part’s datasheet and log real data before using numbers like these.

SourceReadingVarianceInverse variance
A (range sensor)102 cm4 cm²0.25
B (odometry)99 cm1 cm²1.00

Step 1: add the inverse variances. 0.25 + 1.00 = 1.25.

Step 2: compute the weights. wA = 0.25 / 1.25 = 0.2 and wB = 1.00 / 1.25 = 0.8. They add to 1, as they must.

Step 3: fuse. x = 0.2 × 102 + 0.8 × 99 = 20.4 + 79.2 = 99.6 cm.

Check with the correction form: start from B and add 0.2 of the disagreement. 99 + 0.2 × (102 - 99) = 99 + 0.6 = 99.6 cm. Both routes agree. The result sits much closer to B because B is four times less noisy.

Variance of the Result

The variance of the fused estimate is v = 1 / (1/v1 + 1/v2). This is the inverse of the sum you already computed.

For the example: v = 1 / 1.25 = 0.8 cm². The standard deviation is the square root, √0.8 ≈ 0.894 cm. Compare that with the inputs: A had a standard deviation of 2 cm and B had 1 cm. The fused value, at about 0.89 cm, is better than the better sensor. Even a poor sensor adds a little information when its errors are independent.

Two equal sensors show the effect in its simplest form. With v1 = v2 = 4, the fused variance is 1 / (0.25 + 0.25) = 2, half of the original. The standard deviation falls by a factor of √2, about 1.41, not by a factor of 2. Averaging more copies of the same sensor helps, but with diminishing returns.

From Weights to a Filter

A single fusion step is a snapshot. A robot repeats it every cycle, and that is where filters appear. Treat the previous estimate as source A, with its own variance P, and treat the new measurement as source B, with variance R. The weight on the measurement is called the gain, K = P / (P + R).

Run the same numbers. Prior estimate 102 cm with P = 4, measurement 99 cm with R = 1:

  • K = 4 / (4 + 1) = 0.8
  • x = 102 + 0.8 × (99 - 102) = 102 - 2.4 = 99.6 cm
  • P_new = (1 - K) × P = 0.2 × 4 = 0.8 cm²

Same answer, 99.6 cm and 0.8 cm². This is the scalar measurement update of a Kalman filter. For the full version with a motion model and a covariance matrix, read the guide on Kalman filter robot localization. If you want the cheaper cousin used on small boards, the complementary filter for an IMU on Arduino uses a fixed weight, commonly written as alpha, instead of recomputing it from variances.

In a hands-on build, the same idea appears when you blend gyro and accelerometer angles in the self-balancing robot with an MPU6050, using an MPU6050 IMU. The gyro is smooth but drifts, the accelerometer is noisy but does not drift, so a fixed blend of the two is a practical form of weighted fusion.

Limits of Simple Fusion

The formulas above are tidy, and that is exactly why you should know where they stop working.

  • Bias. Weighting reduces random noise only. If a sensor reads 3 cm too high every time, fusion will carry part of that error into the result.
  • Correlated errors. If both sensors share a cause of error, such as a vibrating mount or a common supply ripple, the real variance of the result is larger than the formula says.
  • Wrong variances. The weights are only as good as the variances you supply. If you guess them badly, the result is still a weighted average, but it is no longer the minimum-variance one.
  • Outliers. An ultrasonic echo that bounces off a side wall can be far off. A weighted average will drag the estimate toward it. Gate readings that disagree wildly with the prediction before fusing.
  • Different timing. Sensors sample at different rates and with different delays. Fusing a reading from 80 ms ago as if it were current adds error.

For robots that fuse wheel odometry, IMU and other sources over time, the practical next step is the framework described in ROS 2 sensor fusion for robot localisation, which handles the covariances and timing for you. To practise the odometry side of the example, build the differential drive odometry project.

How to check this yourself

  1. Hold each sensor still and log at least 100 readings to a serial monitor or a file.
  2. Compute the mean and the variance of each log. Variance is the average of the squared differences from the mean.
  3. Fuse one pair of simultaneous readings using the weights above, and confirm by hand that the weights add to 1.
  4. Fuse every pair in the logs, compute the variance of the fused series, and compare it with 1 / (1/v1 + 1/v2). If it is larger, your sensors probably share an error source.

Common mistakes

  • Using standard deviations in the weight formula instead of variances.
  • Guessing variances instead of measuring them from logged data.
  • Fusing readings taken at different times as if they were simultaneous.
  • Expecting fusion to fix a constant offset, which needs calibration instead.

Frequently asked questions

What is the formula for weighted sensor fusion?

The fused value is w1·x1 + w2·x2, where each weight is that sensor’s inverse variance divided by the sum of both inverse variances. The weights add up to 1. The sensor with the smaller variance gets the larger weight, and the fused variance is 1 / (1/v1 + 1/v2).

Is a weighted average the same as a Kalman filter?

For one measurement update of a single value, yes. The Kalman gain P / (P + R) is the same weight as the inverse variance rule. A full Kalman filter adds a motion model and tracks how uncertainty grows between measurements, so it is more than a single weighted average.

Can I average two identical sensors on Arduino?

Yes, if their errors are independent. Two equal sensors halve the variance, which cuts the standard deviation by about 1.41 times, not 2 times. If both share the same supply noise or mounting vibration, the gain will be smaller, so measure it on your own board.

Quick checklist

  • Write down the variance of each sensor from the datasheet or from logged, stationary readings.
  • Compute weights as inverse variance divided by the sum, and check they add to 1.
  • Re-derive one fused value by hand using the correction form as a sanity check.
  • Confirm the fused variance is smaller than the smallest input variance.
  • Reject outliers and align timestamps before fusing.

About the author and how this is kept accurate

Written, checked and maintained by Jignesh Panchal of Jaadu Digital. Figures in worked examples come from the stated assumptions, not from a bench test of our own. Read the editorial standard, follow the author on LinkedIn, or send a correction. Last reviewed: November 2026.

Pass it onWhatsAppLinkedIn

Keep reading

Continue learning

Tutorials

VL53L0X vs VL53L1X vs HC-SR04 for robots

Compare the HC-SR04 ultrasonic sensor with the VL53L0X and VL53L1X time-of-flight sensors, and learn how to wire several time-of-flight sensors on one…

  • Published4 Nov 2026
  • Read4 min

Tutorials

Arduino sensor filtering: average vs median

Compare moving average, exponential and median filters on the same readings, with the arithmetic worked by hand, and learn which one suits…

  • Published4 Nov 2026
  • Read4 min

Free: the final-year project pack

A shortlist with BOMs, a report outline that matches the usual chapter scheme, a costing sheet and 40 viva questions. Built for the February–April submission season.

The Build Note

One short email when something is worth your bench time.

A new build sheet, a part price that moved, or a mistake worth avoiding. No daily drip, no recycled news.

One short email when a build or a price is worth your time. Unsubscribe in one click.