A quick question from one reader after publication of Smartwatch BLE to Trigger IBM Watson IoT Event was “can I measure the distance in meters and broadcast?”. The answer is – it is not reliable with easy formula against a single BLE device. If we were using Raspberry Pi, then we could think of using complex coding.
BLE technology and works with Indoor Location Positioning is not new. RSSI stands for Received Signal Strength Indicator. The strength depends on distance and Broadcasting Power value. dBm and RSSI are different units of measurement. They represent the same thing: signal strength. RSSI is a relative index while dBm is an absolute number expressing power levels in milliwatts. RSSI tends to fluctuate due to the factors influencing radio waves—such as the device itself, the chipset, absorption, interference, diffraction.
Common propagation path-loss models include the free space propagation model, the logarithmic distance path-loss model, etc. Studies have shown that the channel fading characteristic follows a lognormal distribution. RSSI distance measurement generally uses the logarithmic distance path-loss model. It is expressed as:
RSSI = −10n lg(d/d0) + A + Xσ
where d is the distance between the transmitter and the receiver, and n is a path-loss parameter related
to the specific wireless transmission environment. A is the RSSI with distance d0 from the transmitter. Xσ is a Gaussian-distribution random variable with mean 0 and variance σ. For the convenience of calculation, d0 usually takes a value of 1 meter. Since Xσ has a mean of 0, the distance-loss model can be obtained with
RSSI = −10n log(d) + A
where A is the average measured RSSI when the received node is 1 meter away from the transmit
node which is related to the RF circuits of Bluetooth nodes. By gathering the RSSI values for Bluetooth
beacons at different distances and using the least-squares algorithm to fit the parameters, we can obtain
the RSSI distance model.
Measured Power is a factory-calibrated constant of expected RSSI at a distance of 1 meter. BLE devices broadcast in pulse. Advertising Interval is the time between each pulse with a value range between 100 ms and 2000 ms. The shorter the interval, the more stable the signal.
There are different techniques to enhance the precision of a BLE indoor positioning system: channel diversity, Kalman Filtering, weighted trilateration method and so on.
If we blindly use some easy formula to measure distance, such as :
Distance = 10 ^ ((Measured Power – RSSI)/(10 * N))
Where N is constant which depends on the environmental factor with a range 2-4. Then we need to know the “Measured Power” of a bare ESP32. The discussion on ESP32 forum :
…does not show much promise. Reading the analysis :
…proves that effort to calculate exact distance from RSSI value of ESP32 is not a DIY job. I would rather suggest thinking to involve two LEDs for Samsung Smartwatch as Proximity Switch project or use a buzzer. First, make the buzzer or two LEDs to give a signal of entry and exit.
With a buzzer, the effect will become like a chat room sounds.
Thereafter modify the code of Smartwatch BLE to and Trigger IBM Watson IoT Event.