Iris Classon
Iris Classon - In Love with Code

Bluetooth Log Distance Path Loss Calculation

I realize I didn’t show the calculation in the previous blog post. That was partly intentional as it’s not a good idea. Even more so indoors, where you have more surfaces and obstacles.

But, here it is, the C# implementation:

public double? EstimateDistanceMeters(double txPowerAt1Meter = -59, double pathLossExponent = 2.4)
{
    // _ema is the smoothed RSSI discussed in the previous blog post
    if (!_emaRssi.HasValue)
        return null;

    return Math.Pow(10.0, (txPowerAt1Meter - _emaRssi.Value) / (10.0 * pathLossExponent));
}

The path loss exponent describes how fast signal drops — approximately 2 in open space, and 2.2–2.4 indoors.

The value -59 for txPowerAt1Meter is a convention, not a law of physics. It comes from BLE beacon practice, especially Apple’s iBeacon spec, where manufacturers often define RSSI at 1 meter as approximately -59 dBm. So developers started using -59 as a default when they don’t have a calibrated value, and many devices ship with that as their default.

Calibration, which I talked about in the previous post, would be a better way to get a more accurate value for the txPowerAt1Meter parameter.

Comments

Leave a comment below, or by email.

Last modified on 2026-03-03

comments powered by Disqus