# ADR and gateway distance

**URL:** <https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112>\
**Category:** TTN Network and Services\
**Created:** [June 26, 2020, 2:02pm UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112 "2020-06-26T14:02:55Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![LloydXmas](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/lloydxmas/32/33353_2.png) [@LloydXmas](https://www.thethingsnetwork.org/forum/u/LloydXmas)\
**Post date:** [June 26, 2020, 2:02pm UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/1 "2020-06-26T14:02:55Z")

</div>

Will adaptive data rate help the end device determine the best max data rate if the gateway is a distance away? I.e. if certain data rates are not sufficient for a given range/distance of communication, will the end device + gateway be able to work this out? Thanks for the help.

---

<div class="post-metadata">

**Author:** ![cslorabox](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/cslorabox/32/35697_2.png) [@cslorabox](https://www.thethingsnetwork.org/forum/u/cslorabox)\
**Post date:** [June 26, 2020, 4:53pm UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/2 "2020-06-26T16:53:40Z")

</div>

Yes, that is what it is intended to do.

Worth noting however that the logic is in the network server, not the gateway (gateways have very minimal internal logic). The network server considers the signal reports from any and all gateways receiving each packet, and tells the node to adjust settings for those conditions - on average at least, the propagation path to the best gateway.

That’s in part why it’s problematic if a gateway suddenly vanishes, or receives on less than all of the channels, as those strong signal reports may lead nodes that were close to it to be told to use short-range settings which leave them no longer be able to reach more distant gateways that might still be in operation, and able to receive on all the channels that a proper gateway should.

Nodes also have some of their own fallback logic where they start moving towards longer range settings if they don’t receive any feedback from the network over an extended period of time, on the order of hours to days.

---

<div class="post-metadata">

**Author:** ![LloydXmas](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/lloydxmas/32/33353_2.png) [@LloydXmas](https://www.thethingsnetwork.org/forum/u/LloydXmas)\
**Post date:** [June 27, 2020, 1:19am UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/3 "2020-06-27T01:19:25Z")

</div>

How does a gateway signal to a node that its packets are not reaching that gateway in the first place? I mean, if the node is using a higher data rate than it should and is thus not able to reach the gateway, then obviously the gateway cannot send a downlink message to the node to adjust its data rate since it doesn’t know that node even exists. Do nodes using ADR _start_ with a high data rate and then send recurring packets with lower and lower data rates?

---

<div class="post-metadata">

**Author:** ![cslorabox](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/cslorabox/32/35697_2.png) [@cslorabox](https://www.thethingsnetwork.org/forum/u/cslorabox)\
**Post date:** [June 27, 2020, 1:29am UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/4 "2020-06-27T01:29:27Z")

</div>

> [@LloydXmas](#):
>
> How does a gateway

Again, gateways really don’t do anything. The Network server acts _through_ gateways.

> [@](#):
>
> signal to a node that its packets are not reaching that gateway in the first place? I mean, if the node is using a higher data rate than it should and is thus not able to reach the gateway, then obviously the gateway cannot send a downlink message to the node to adjust its data rate since it doesn’t know that node even exists.

It cannot, of course

So nodes start in the most long range mode (high spreading factor, ie low data rate, and high RF power) and then may be commanded to go to a shorter range mode if the received signal indicators suggest that would be workable.

> [@](#):
>
> Do nodes using ADR _start_ with a high data rate and then send recurring packets with lower and lower data rates?

This would be a less effective strategy. However, this does happen when a short range mode that was previously working ceases working. Perhaps a nearest gateway has gone down, or perhaps the node has moved. Of a substantial period of time without response, it will start ramping to longer range modes.

Of course it’s possible that the network is dead entirely (server problems) or corrupted (sessions keys lost by server) in which case the longer range mode isn’t going to work either. But at least the node tried…

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [June 27, 2020, 8:04am UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/5 "2020-06-27T08:04:07Z")

</div>

> [@LloydXmas](#):
>
> Do nodes using ADR _start_ with a high data rate and then send recurring packets with lower and lower data rates?

You may see this for OTAA. Like [EU868 LMIC](https://github.com/mcci-catena/arduino-lmic/blob/v3.2.0/src/lmic/lmic_eu_like.c#L167) first tries the default channels at some initial data rate that is configured in the device. This may very well be the fastest data rate available (SF7BW125). When all default channels fail, LMIC will decrease the data rate one step, and try again.

This is fine for an OTAA Join, as for such the node knows it should always receive a downlink for each uplink, so it knows when things failed. But for ADR, it may take as many as 96 uplinks to detect that no downlink was received. According to [the 1.0.2 specifications](https://lora-alliance.org/sites/default/files/2018-05/lorawan1_0_2-20161012_1398_1.pdf#page=16):

> **4.3.1.1 Adaptive data rate control in frame header (ADR, ADRACKReq in FCtrl)**
> 
> […]
> 
> If an end-device whose data rate is optimized by the network to use a data rate higher than its lowest available data rate, it periodically needs to validate that the network still receives the uplink frames. Each time the uplink frame counter is incremented (for each new uplink, repeated transmissions do not increase the counter), the device increments an ADR\_ACK\_CNT counter. After ADR\_ACK\_LIMIT uplinks (ADR\_ACK\_CNT \>= ADR\_ACK\_LIMIT) without any downlink response, it sets the ADR acknowledgment request bit (`ADRACKReq`). The network is required to respond with a downlink frame within the next ADR\_ACK\_DELAY frames, any received downlink frame following an uplink frame resets the ADR\_ACK\_CNT counter.

In LoRaWAN 1.0.x, for most (if not all) regions, ADR\_ACK\_LIMIT is 64, and ADR\_ACK\_DELAY is 32. (In LoRaWAN 1.1, it’s a configuration.)

When a device detects it has missed an expected downlink then at worst it already had 96 uplinks not being received, or at best simply only missed the ADR-triggered downlink. It may want an aggressive strategy to ensure it might actually still be in range, or change its settings to get in range again. But according the the same specifications it seems that a certified device should only decrease its data rate by one step and wait another 32 uplinks:

> If no reply is received within the next ADR\_ACK\_DELAY uplinks (i.e., after a total of ADR\_ACK\_LIMIT + ADR\_ACK\_DELAY), the end-device may try to regain connectivity by switching to the next lower data rate that provides a longer radio range. The end-device will further lower its data rate step by step every time ADR\_ACK\_DELAY is reached. The ADRACKReq shall not be set if the device uses its lowest available data rate because in that case no action can be taken to improve the link range.

Aside: the above is also why ADR-enabled devices that have trouble receiving downlinks will eventually end up at DR0.

---

<div class="post-metadata">

**Author:** ![Jeff-UK](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jeff-uk/32/35697_2.png) [@Jeff-UK](https://www.thethingsnetwork.org/forum/u/Jeff-UK)\
**Post date:** [June 27, 2020, 9:21am UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/6 "2020-06-27T09:21:12Z")

</div>

> [@cslorabox](#):
>
> So nodes start in the most long range mode (high spreading factor, ie low data rate, and high RF power) and then may be commanded to go to a shorter range mode if the received signal indicators suggest that would be workable.

That is not necessarily true! Many devices start at SF7 - short range - especially for initial OTAA join requests and start requesting network access and config info. After a few attempts with no success the node then falls back to SF8 and tries cycle again, on no success SF10, and so on until SF12 attempts. There is much debate about which policy (Start at SF7 and back off or start at SF11 or 12 and ramp up - probably under ADR control) leads to the lowestest early life battery power consumption. It will depend on deployment scenarios and how fast any given network starts to adjust node settings under ADR control. I believe TTN (IIRC) waits for around 20 messages before adjusting under ADR. There is also some guidance/network policies that ‘ban’ (discourage?) network joins at e.g. SF12, and of course the RX2 back up window on TTN is set at SF9 😉

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [July 7, 2020, 8:23am UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/8 "2020-07-07T08:23:36Z")

</div>

As for the data rate for OTAA, Semtech writes [in Joining and Rejoining](https://lora-developers.semtech.com/library/tech-papers-and-guides/the-book/joining-and-rejoining):

> In addition to random frequency selection, randomly selecting available DataRates (DRs) for the region that you want is also important.
> 
> **Note** : It is important to vary the DR. If you always choose a low DR, join requests will take much more time on air. Join requests will also have a much higher chance of interfering with other join attempts as well as with regular message traffic from other devices. Conversely, if you always use a high DR and the device trying to join the network is far away from the LoRaWAN gateway or sitting in an RF-obstructed or null region, the gateway may not receive a device’s join request. Given these realities, randomly vary the DR and frequency to defend against low signals while balancing against on-air time for join requests.

And as for ADR acknowledgements:

> [@arjanvanb](#):
>
> It may want an aggressive strategy to ensure it might actually still be in range, or change its settings to get in range again. But according the the same specifications it seems that a certified device should only decrease its data rate by one step and wait another 32 uplinks

The same strategy is indeed explained in Semtech’s [Understanding ADR](https://lora-developers.semtech.com/library/tech-papers-and-guides/understanding-adr):

> If no answer is received from the network server by the time the acknowledgement delay period has expired, the data rate will automatically be reduced by one step, as illustrated in Figure 8.
> 
> ![ADR](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/e/4/e4629214bfef660d35dd9936c2b1bf23f55ad25b.png)  
> _Figure 8_
> 
> After this one-step data rate reduction, the end device continues sending messages to the server (at this new, lower, data rate) requesting an ADR acknowledgement. Once an acknowledgement _is_ received, the end device uses the new, server-determined, data rate until it receives an instruction to change it again via the normal ADR mechanism. However, if no answer is forthcoming, the end device continues to ratchet down the data rate, step by step, until it gets a response or, assuming the device and network are in Europe, until it reaches SF12 (Figure 9).
> 
> **Note:** The highest spreading factor that can be used with LoRaWAN varies by region, for instance in the USA, the highest SF is SF10.
> 
> ![ADR SF12](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/c/8/c8b225fe8a2318ab28b8bb81ebf1defb37fa2919.png)  
> _Figure 9_

Just like in the LoRaWAN specifications: not a word about the transmission power.

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [July 7, 2020, 2:29pm UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/9 "2020-07-07T14:29:52Z")

</div>

Some join sequences seem to hit the same SF several times before moving on - a quick run through from to 7 to 0 would seem more efficient, possibly trying a couple of times at the 7, 8 & 9, travelling hopeful, before using up air time & battery banging away at SF12 in vain.

Then perhaps backoff for many multiples of the configured send interval rather than fruitlessly trying just a few moments later.

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [August 16, 2020, 4:38pm UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/10 "2020-08-16T16:38:52Z")

</div>

Related: [Start OTAA join on SF7BW125 or SF12BW125? (EU 868MHz)](https://www.thethingsnetwork.org/forum/t/start-otaa-join-on-sf7bw125-or-sf12bw125-eu-868mhz/15189)

---

<div class="post-metadata">

**Author:** ![haowong](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/haowong/32/36740_2.png) [@haowong](https://www.thethingsnetwork.org/forum/u/haowong)\
**Post date:** [February 9, 2021, 7:06am UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/11 "2021-02-09T07:06:02Z")

</div>

I don’t understand the logic of ADR:

If I keep sending unconfirmed messages, that means I don’t need to any downlink acknowledgment.

So even if I don’t receive the downlink after 64+32 uplinks, it doesn’t mean that I need ADR to make any adjustments. Isn’t that against my original intention?

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [February 9, 2021, 9:19am UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/12 "2021-02-09T09:19:49Z")

</div>

The point of ADR is to tune a devices signal to its environment by changing the Data Rate.

If it’s being received with great signal strength, then the DR can be dropped, using less power for the device and less air time for the community as a whole.

It’s the device transmission that’s key here, not downlinks.

It’s unrelated to unconfirmed messages - which are the best for the community as well.

---

<div class="post-metadata">

**Author:** ![haowong](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/haowong/32/36740_2.png) [@haowong](https://www.thethingsnetwork.org/forum/u/haowong)\
**Post date:** [February 9, 2021, 1:10pm UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/13 "2021-02-09T13:10:50Z")

</div>

My understanding of ADR is that it needs the response of the network server, which is what I call the **downlink**.

I learned before that the unacknowledged message will never receive the downlink.

Combining the two, I feel that the ADR conflicts with the unacknowledged message, because the ADR will never receive the response from the network server.

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [February 9, 2021, 1:17pm UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/14 "2021-02-09T13:17:02Z")

</div>

You are conflating the two things which are separate.

You can ask for uplinks to be confirmed or not - not being preferable. On receipt of a confirmed uplink, the gateway will send back a ‘got it’ message.

If you have ADR turned on, at some point (20 or 30 messages in), the network server will evaluate your signal strength and if need be, queue an ADR MAC request as a downlink. For a Class A device, this should be picked up when the next uplink occurs.

I’m not sure why you say that a device will not receive a downlink? It’s independent of uplink confirmations.

---

<div class="post-metadata">

**Author:** ![haowong](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/haowong/32/36740_2.png) [@haowong](https://www.thethingsnetwork.org/forum/u/haowong)\
**Post date:** [February 9, 2021, 1:28pm UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/15 "2021-02-09T13:28:58Z")

</div>

I got it.

The downlink of ADR has nothing to do with the uplink confirmation.

Thanks a lot! 😉

---

<div class="post-metadata">

**Author:** ![cslorabox](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/cslorabox/32/35697_2.png) [@cslorabox](https://www.thethingsnetwork.org/forum/u/cslorabox)\
**Post date:** [February 10, 2021, 12:24am UTC](https://www.thethingsnetwork.org/forum/t/adr-and-gateway-distance/38112/16 "2021-02-10T00:24:19Z")

</div>

> [@haowong](#):
>
> The downlink of ADR has nothing to do with the uplink confirmation.

They’re independent, but I believe in an ideal case they could share the same packet downlink packet.

Though that’s kind of irrelevant as you really really shouldn’t be using confirmed uplink
