ESP32 - AirTag Documentation
|
Functions and variables for RSSI averaging and distance estimation. More...
#include <stdint.h>
Go to the source code of this file.
Functions | |
void | updateRssiAvg (int rssi) |
Update the exponential moving average of the RSSI. | |
float | estimateDistanceMeters (float rssi, float txPower, float n) |
Estimate distance from RSSI using the log-distance path loss model. |
Variables | |
bool | hasAvg |
Flag indicating whether an RSSI average has been initialized. | |
float | rssiAvg |
Exponential moving average of the RSSI value. | |
float | txPower |
Reference transmit power (measured RSSI at 1 meter distance). | |
float | nFactor |
Path-loss exponent (environmental factor). |
Functions and variables for RSSI averaging and distance estimation.
Provides global parameters and helper functions for smoothing RSSI values and estimating distance based on the log-distance path loss model.
float estimateDistanceMeters | ( | float | rssi, |
float | txPower, | ||
float | n ) |
Estimate distance from RSSI using the log-distance path loss model.
Calculates the approximate distance to a transmitter based on received signal strength, reference power, and environmental factor.
Formula:
[in] | rssi | Current RSSI reading (dBm). |
[in] | txPower | Reference RSSI at 1 meter (dBm). |
[in] | n | Path-loss exponent. |
Estimate distance from RSSI using the log-distance path loss model.
Computes an approximate distance to the transmitter based on the difference between the measured RSSI and the known transmit power at 1 meter.
[in] | rssi | Received signal strength indicator (in dBm). |
[in] | txPower | Transmitter power at 1 meter (in dBm). |
[in] | n | Path-loss exponent (environmental factor). |
void updateRssiAvg | ( | int | rssi | ) |
Update the exponential moving average of the RSSI.
Uses an exponential smoothing factor to stabilize the RSSI reading against sudden fluctuations.
[in] | rssi | Latest RSSI reading (in dBm). |
Update the exponential moving average of the RSSI.
Applies exponential smoothing with a fixed factor
[in] | rssi | Current measured RSSI value (in dBm). |
|
extern |
Flag indicating whether an RSSI average has been initialized.
Flag indicating whether an RSSI average has been initialized.
|
extern |
Path-loss exponent (environmental factor).
Represents how quickly the signal attenuates with distance. Common values:
Typical values:
Should be tuned experimentally for best accuracy.
|
extern |
Exponential moving average of the RSSI value.
Exponential moving average of the RSSI value.
|
extern |
Reference transmit power (measured RSSI at 1 meter distance).
Typically determined through calibration, defaulting around -59 dBm for many BLE devices.
Reference transmit power (measured RSSI at 1 meter distance).
This value should be tuned based on calibration measurements.