Adaptive Data Rate (ADR) is a mechanism for optimizing data rates, airtime and energy consumption in the network.
This reference documents how ADR is implemented in The Things Stack.
How ADR Works
The ADR mechanism controls the following transmission parameters of an end device:
- Spreading factor
- Transmission power
See The Things Network Learn for a general description of ADR.
The Things Stack ADR Algorithm
This section describes The Things Stack ADR implementation in plain english, with links to the relevant lines of source code in our open source LoRaWAN Stack Repository.
The Things Stack ADR implementation looks at the signal-to-noise ratio (SNR) to determine the Data Rate and Tx Power, and looks at frame counters to determine packet loss, and set the number of re-transmissions accordingly.
The implementation is based on Semtech’s recommended algorithm described in this document:
- Determine the maximum SNR over recent transmissions
- Determine the minimum SNR to demodulate an uplink given the current parameters
- Calculate the margin to further optimize the data rate
- Part of this is configurable per device (if you use the CLI)
- If less measurements (uplinks) are available than necessary, include a safety margin
- Increase the data rate as long as there’s enough margin
- If there’s still margin after reaching the maximum data rate, decrease the transmit power
- Depending on packet loss, increase the number of retransmissions