Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    LoraWAN packet performance?

    Scheduled Pinned Locked Moved LoPy
    lorawan otaa
    14 Posts 4 Posters 2.2k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • robert-hhR Offline
      robert-hh @misterlisty
      last edited by robert-hh

      @misterlisty I opened an issue & got a good explanation, allowing a workaround: https://github.com/pycom/pycom-micropython-sigfox/issues/143
      The workaround is to remove in the node all channels but the first one AFTER joining, like this way:

      # remove all channels but the first
      for i in range(1, 16):
          lora.remove_channel(i)
      

      That worked for me.

      1 Reply Last reply Reply Quote 0
      • M Offline
        misterlisty
        last edited by

        Using the Multi-Tech as the gateway. Using a stub antenna for both. Distance between node and gateway is about 5 metres.

        0_1519653991703_Capture.PNG

        from network import LoRa
        import socket
        import time
        import binascii
        import struct
        
        
        
        lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.AU915)
        print("Lora send::-3")
        
        print("DevEUI[",binascii.hexlify(lora.mac()).upper().decode('utf-8'),"]")
        
        
        # create an OTAA authentication parameters
        dev_eui = binascii.unhexlify('00 A3 D5 59 96 62 A9 85'.replace(' ','')) 
        app_eui = binascii.unhexlify('00 80 11 00 00 11 B7 E2'.replace(' ',''))
        app_key = binascii.unhexlify('2B 7E 15 10 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C'.replace(' ',''))
        
        
        print("Lora send::-1")
        
        
        lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=0)
        #lora.join(activation=LoRa.ABP, auth=(dev_eui,app_eui, app_key), timeout=0)
        print("Lora send::0")
        
        while not lora.has_joined():
            time.sleep(5)
            print('Not yet joined...')
        
        print('Finally joined...')
        
        
        s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
        
        print("Lora send::1")
        
        s.setsockopt(socket.SOL_LORA, socket.SO_CONFIRMED, 0)
        
        i = 0
        while True:
            s.setblocking(True)
            print("Sending Hello there #" + str(i))
            count = s.send("Hello there #" + str(i))
            print('Sent %s bytes' % count)
            print(lora.stats())
            time.sleep(60)
            i += 1
        
        robert-hhR J J 3 Replies Last reply Reply Quote 0
        • robert-hhR Offline
          robert-hh @misterlisty
          last edited by

          @misterlisty Did you try to remove all but one channel after joining, like I did in the example below?

          M 1 Reply Last reply Reply Quote 0
          • M Offline
            misterlisty @robert-hh
            last edited by

            @robert-hh Ill try this tomorrow. Why is this required?

            robert-hhR 1 Reply Last reply Reply Quote 0
            • J Offline
              jcaron @misterlisty
              last edited by

              @misterlisty Not familiar with the specifics of the AU region, but as I understand it, there are 72 different frequencies available, and gateways usually listen only on 8 or so. The network should send LinkAdrReq commands to the node to tell it which frequencies to use (it should somehow know which frequencies the gateway listens on). This may require you to turn on adr=True in your code.

              M 1 Reply Last reply Reply Quote 0
              • robert-hhR Offline
                robert-hh @misterlisty
                last edited by

                @misterlisty As @daniel explained:
                "@robert-hh thanks for reporting this. The difference with OTAA actually makes sense if the network server (TTN) is adding channels and the node is accepting it, making the nano-gateway (which only operates in 1 channel) to not receive the messages sent on the new channels.

                The fix is to reject "New Channel Requests" made on the channels that have been manually removed. This was the case on our previous LoRaWAN stack, but something didn't go right when moving to the new 1.0.2 stack."

                That is not true for your gateway, but maybe there is a mis-match of channels being used and seen. As far as I recall the example code for the node, all channels are set to the same frequency.

                1 Reply Last reply Reply Quote 0
                • J Offline
                  jmarcelino @misterlisty
                  last edited by jmarcelino

                  Hi @misterlisty

                  Since the gateway is set to Frequency sub-band 2 you need to remove all channels other except those in sub-band 2 (channels 8-15)

                  This isn't done automatically by the network.

                  Please add this after initialising LoRa to remove the channels the gateway doesn't support:

                  for channel in range(0, 8):
                          lora.remove_channel(channel)
                  
                  for channel in range(16, 64):
                          lora.remove_channel(channel)
                  
                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    misterlisty @jcaron
                    last edited by

                    @jcaron what is adr=True

                    J 1 Reply Last reply Reply Quote 0
                    • M Offline
                      misterlisty
                      last edited by

                      ok..i seem to be getting all the data packets now..mmm..now i'm going to test how far i can go with my car in distance :)

                      1 Reply Last reply Reply Quote 0
                      • J Offline
                        jcaron @misterlisty
                        last edited by

                        @misterlisty it's an optional parameter on the LoRa constructor which enables ADR (adaptive data rate), which is a LoRaWAN features which enables the node and network to adjust parameters (the most important being the data rate, but channels lists as well). Some MAC commands sent by the network are only honoured by the LoPy if ADR is enabled.

                        However @jmarcelino says the network doesn't send those commands anyway, so it may not be useful.

                        Also note that the current firmware version does not correctly preserve channel masks during deep sleep.

                        1 Reply Last reply Reply Quote 0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • 1 / 1
                        • First post
                          Last post

                        Pycom on Twitter

                        Pycom