In this video, we're going to show you three demonstrations. 1
For the three demonstrations, we are only going to focus on the spreading factor parameter. 2
The application is very simple. 3
We configure an OTAA end device to send a frame every 5 seconds with SF9. For the first demonstration, 4
the ADR flag is disabled so the network server will not send the best spreading factor and power transmission 5
so the end device will carry on, transmitting with SF9 whatever happens. 6
For the second demonstration, we will enable the ADR algorithm and send unconfirmed data frames 7
and for a third demonstration, we will enable the ADR algorithm and send confirmed 8
data frames. 9
OK. Let's start ! 10
I'm still using the same configuration file for my end device. 11
For the first application, I setup the OTAA activation mode and I send every five seconds one byte of temperature 12
in an unconfirmed data frame. 13
I also use the default spreading factor nine. 14
Great. 15
I now go on my network server and as usual I've got on the left my device log and on the right, one tab 16
for my gateway logs and the other one for the application. 17
But for this demonstration I will mostly use the gateway logs. 18
I start my end device. 19
There is the join procedure. 20
And the opening data. 21
I can see that the LoRa transmission is done in SF9. 22
That's exactly what I expected. 23
The end device will never change the spreading factor and never check if it still have a connection to the 24
network server. 25
Okay. 26
So now for the second demonstration, I will enable the ADR on the device. 27
I programmed the new firmware and I started. 28
Once again, there is a join procedure and I can see the uplink data. 29
The first frame uses SF9 because I configured SF9 as a default value. 30
But if I wait for a few frames, then I can see that an optimization occurred. 31
The networks sent a new value for the spreading factor and it assumed that the best value would 32
be SF7. 33
That is quite normal because if we look at the RSSI and the SNR value, we can guess that in my case 34
my device is very close for my gateway. Ok. 35
Now what happens if the device goes further from the gateway. So far away that it goes out of the gateway 36
coverage? 37
I can simulate that. 38
I just have to unplug my gateway, so the device won't be connected to the network server anymore. 39
Well, let's try that. 40
Okay. 41
We don't see many things. 42
Actually, the networks server can't tell the device to change the spreading factor because the network 43
server doesn't even know that the device is trying to send data. 44
So the device doesn't know that it can't reach the network server and the network server doesn't know 45
that the end-device tries to reach it. 46
This situation could last for a long time, but fortunately, from that point, the ADR algorithm will 47
work as follow. 48
In the stack, there are two values that manage the ADR behavior. 49
First, there is the ADR limit value. 50
If an end device hasn't had any news from the network for ADR Limit number of frames, then the device 51
itself will ask for an optimization. 52
And secondly, if an end device has asked for an optimization for more than ADR delay number of 53
frames, then it consider that the network is not reachable anymore and it has to change its spreading 54
factor with a higher value. 55
The default value for limit and delay are 64 and 32. 56
That means that if you send a message not so often, it can take a very long time to optimize the spreading 57
factor. 58
Ok, in our case it will be shorter because I send that out very quickly and anyway for this demonstration 59
that will even be quicker because I modified the stack to have limit at 8 and delay at 4. 60
So I have: limit plus delay. 61
So 12 frames the optimization process should appear. 62
Great. 63
So back to our demonstration that is still running in the background. 64
I can see that the last time the end device heard about the network server was frame number 2. 65
So there should be an optimization after frame count to 14. 66
Yes. 67
There we go. 68
The end-device changed the value to SF8 and another 4 frames later. 69
It's changed to SF9 and so on. 70
Okay. 71
Now I turn my gateway back on. 72
It can take a few seconds and there we go. 73
As soon as the gateway reconnects to the network server, it notifies the end device for an optimisation 74
and you can see the value by yourself. 75
The spreading factor goes straight back to spreading factor seven. Ok. Now, for the last demonstration, 76
the end-device will use confirmed data frames instead of unconfirmed data frames. 77
That means that the end device will receive optimisation value after each uplink. 78
Let's try that. 79
I power up my end device. 80
And I can see the join procedure. 81
After each uplink, there is now an acknowledgement and in the same frame the network server sends 82
the ADR value. 83
So right after the start we can see the optimization process from SF9 to SF7. 84
And of course, if I don't move the end device, the spreading factor value SF7 remains. Ok. 85
Now after the frame number 4, I move my end device outside of the network coverage. 86
Once again, I simulate that by deconnecting my gateway. My end device seams stuck. 87
Actually, it's not. 88
But the logs that you can see only represents the valid frames. 89
And the frame number 5 has probably been sent, but an acknowledgement hasn't been received, so 90
the log doesn't show it. 91
Actually, the end device is trying again and again, and each time it tries, it increases its 92
Spreading Factor. 93
So we wait a little bit and I reconnect the gateway. 94
And here we go. 95
The frame number 5 arrives on the network server. 96
We can see that the spreading factor used when the transmission succeeded was SF10. 97
And of course, right after, the network server will again optimize the spreading factor until reaching 98
SF7, because my end device is now closed from my gateway. 99
Great. 100
That was a long demonstration, but ADR is very important. 101
One last point. 102
The ADR process is specified by the LoRa Alliance, but the algorithm itself is not standardized. 103
So you can write your own calculation depending on your application.