LoPy ADR does not seem to work

  • Hi,
    ADR seems not working right, it stays at sf12 all the time without ever changing the spread factor.
    Here is my init.

    lora = LoRa(mode=LoRa.LORAWAN, adr=True, public=True, tx_retries=3, device_class=LoRa.CLASS_C)
    app_eui = binascii.unhexlify('01 23 45 67 89 FF FF FF'.replace(' ',''))
    app_key = binascii.unhexlify('01 23 45 67 89 AB CD EE EE EE 45 67 89 AB CD EF'.replace(' ',''))
    # join a network using OTAA (Over the Air Activation)
    lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=0)
    # wait until the module has joined the network
    while not lora.has_joined():
    # create a LoRa socket
    s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
    # set the LoRaWAN data rate
    s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5)
    # selecting confirmed type of messages
    s.setsockopt(socket.SOL_LORA, socket.SO_CONFIRMED, False)
    # make the socket blocking

    I'm using LoPy with mutitech conduit and gotthardp/lorawan-server.
    What could be wrong?

  • Did someone successfully connect to the Things Network (TTN) with ADR working?

    The TTN should have ADR enabled by default with the algorithm kicking in after 20 packets, yet even after 70 packets it's still at SF12BW125. The gateway is just next door, my packets have an RSSI of about -50 and a SNR of around 5-7. SF7 would still give plenty of margin.

    My LoPy firmware is at 1.7.3b2.

  • Solved.
    I found another page on the server to set the ADR, just fill this up and it all works.


  • To get ADR working or to find why it doesn't work is not straightforward, as the algorithm how to implement is not part of the LoraWAN specification and up to the Network Server if it is implemented at all. Even with a proper Network Server it may require attention on the device side to get it properly working. First I would start with LoPy ADR on a server where it works, like Loriot and after that go to another server; in this case it would need some changes still. Also would be good to make sure ADR is working on gotthardp, checking its documentation and test with a device with proven ADR operation. In your current setup I see too many uncertain part.

Log in to reply

Pycom on Twitter