TTN Adaptive Data Rate – The Things Uno (RN2483)

That will only be a small contribution, but I hope it still helps one of you.

Adaptive Data Rate (ADR)

I have learned something and I want to show it to you!

A node was installed with OTAA. After some time, a new gateway was built less far away. Through OTAA, the node has registered with SF12. Although then the reception was much better, the node remained at SF12. Too bad for the network and to bad for me because of the power consumption.

ADR is the solution. Hopefully.

In the standard program of the thethingsnetwork library we find the possibility to set the ADR bit by a reset of the radio module.

So just adjust the setup ():

void setup()

  // DHT11
  //sensor_t sensor;

  // Wait a maximum of 10s for Serial Monitor
  while (!debugSerial && millis() < 10000)

  // Set callback for incoming messages

  debugSerial.println("-- STATUS");

  debugSerial.println("-- RESET, ADR ON");

  debugSerial.println("-- JOIN");
  ttn.join(appEui, appKey);

To test it, I changed the default SF from 7 to 9 to see if the SF drops after X sends.

In the library under


you can change the following:

#define TTN_DEFAULT_SF 9
#define TTN_RETX "7"

In the wiki of TTN is written:

[…] To determine the optimal data rate, the network needs some measurements (uplink messages). Currently TTN takes the 20 most recent uplinks, starting at the moment the ADR bit is set. These measurements contains the frame counter, signal-to-noise ratio (SNR) and number of gateways that received each uplink. […]


[…] A regular ADR request is scheduled when we have enough measurements and the current data rate is not optimal. The request is only scheduled, and will be attached to an existing application downlink (such as an ACK or downlink payload). […]

as well as

[…] An ADR request is sent when the device sets the ADRAckReq bit. By default this happens after sending 64 uplinks without receiving a downlink, but as that depends on the device implementation we can’t give you an exact number here. […]

Read more here.

After about 30 times was sent, I ran a downlink manually. But without success. The SF stayed at 9.

So I waited. After about another 64 sends, a downlink was triggered by the TTN.

And behold: It works as expected! 🙂


I can only advise you to activate the ADR bit, so you help yourself and everyone else!

As we can see, after about 64 sends, a downlink is sent again:

To do

So if a gateway is added, the SF always adapts to the conditions. Hopefully in future versions also the transmission power.

But what happens if a gateway goes down?

The Node does not know and would not change something… For this I plan in the future another contribution.

See here:

Have fun and good luck, see you,

greetings Mario