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

    LoPy4 failing to connect to Australia TTN?

    Scheduled Pinned Locked Moved LoPy
    6 Posts 5 Posters 80 Views 5 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.
    • V Offline
      Victor Hooi
      last edited by

      I have purchased several LoPy4 kits, and I'm trying to connect them to the local TTN network here in Australia.

      First, I followed the tutorial at https://docs.pycom.io/gettingstarted/registration/lora/ttn/ to register the LoPy4 device on TTN.

      1. I created a new application.
      2. I selected "Add end device". PyCom/LoPy didn't appear in the "LoRaWAN device repository", so I picked "Manually"
      3. LoRaWAN verison was set to "MAC V1.0.2"
      4. Regional Parameters version was set to "PHY V1.0.2 REV A"
      5. Frequency Plan was set to "Australia 915-928 MHz, FSB 2 (used by TTN)"
      6. I got my DevEUI from the LoPy4 using the below snippet:
      from network import LoRa
      import ubinascii
      
      lora = LoRa()
      print("DevEUI: %s" % (ubinascii.hexlify(lora.mac()).decode('ascii')))
      
      1. AppEUI was filled with zeros
      2. AppKey was generated
      3. End Device ID was pre-filled with the DevEUI - I left this alone.

      I then tried to register the device to the network via OTAA, using some of the commands from https://docs.pycom.io/tutorials/networks/lora/lorawan-otaa/.

      >>> from network import LoRa
      >>> import socket
      >>> import time
      >>> import ubinascii
      >>> lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.AU915)
      >>> dev_eui = ubinascii.unhexlify('SANITISED')
      >>> app_eui = ubinascii.unhexlify('0000000000000000')
      >>> app_key = ubinascii.unhexlify('SANITISED')
      >>> lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_eui, app_key), timeout=0)
      

      I then wait several minutes to see if it's joined - and it hasn't:

      >>> lora.has_joined()
      False
      

      Does anybody have any ideas why it's failing to connect?

      Also, from the official LoRaWAN OTAA instructions, there's two points that aren't very clear:

      1. It's unclear when you should specify dev_eui or when you should let is use the default? When would you use one over the other?
      2. There's some commented out parts which mention they should be used with AU915 and PyGate specifically - I assume in this case since I'm just connecting to the community TTN network which may not use a PyGate device I don't need it right? The text is a little unclear when this is needed exactly.
      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jcaron @Victor Hooi
        last edited by

        @Victor-Hooi the all-zeroes App EUI seems weird to me, although I haven’t used the TTN UI in a long time.

        Are you within reach of an existing gateway? Are you indoors or outdoors? Do you have line of sight? how far away are you? Do you know the details of the gateway?

        IIRC the AU frequency plan is similar to the US plan, having a lot more channels than a single gateway can support, so you need to remove a lot of channels and only keep those actually used by the network, that’s probably the commented parts you are referring to.

        1 Reply Last reply Reply Quote 1
        • K Offline
          kjm
          last edited by

          I've never got an OTAA join confirmation here in AU for pycom devices. Give ABP a shot that seemed to work.

          1 Reply Last reply Reply Quote 0
          • G Offline
            Gijs
            last edited by

            @jcaron in the new TTN (nowadays called The Things Stack) they no longer provide a random app EUI, so you'll have to make up your own. Their instructions mention to use all 0's.

            Indeed check if you're in range of a local gateway.

            There's some commented out parts which mention they should be used with AU915 and PyGate specifically - I assume in this case since I'm just connecting to the community TTN network which may not use a PyGate device I don't need it right? The text is a little unclear when this is needed exactly.

            The frequency plan FSB2 indeed coincides with the instructions listed in the green block on this page: https://docs.pycom.io/tutorials/networks/lora/lorawan-otaa/: long story short, a gateway generally listens to only 8 channels, of which these 8 are the most common, and listed on the TTS as 'FSB2'. The instructions mention Pygate, but with the new TTS interface, it is possible to define the frequency plan in more detail than before.

            # Uncomment for US915 / AU915 & Pygate
            # for i in range(0,8):
            #     lora.remove_channel(i)
            # for i in range(16,65):
            #     lora.remove_channel(i)
            # for i in range(66,72):
            #     lora.remove_channel(i)
            

            concerning your other question

            It's unclear when you should specify dev_eui or when you should let is use the default? When would you use one over the other?

            The only requirement is that the dev_eui is both the same on the device and in TTS. In some cases its convenient to use the LoRa MAC of the Lopy4, in other cases its convenient to use the TTS provided value.

            1 Reply Last reply Reply Quote 0
            • G Offline
              GregS
              last edited by

              FWIW, I've managed to get my LoPy 1 (running current FW) to join using OTAA, using this rather old code:
              https://www.gaggl.com/2017/05/connecting-your-lopy-to-the-things-network-in-australia/
              I don't know how reliable it is yet - all I have done is the join.

              G 1 Reply Last reply Reply Quote 1
              • G Offline
                GregS @GregS
                last edited by

                @GregS Caution: I now believe that the only reason that code works for me is because it uses DR0 for the join requests, which is in violation of the regional parameters for Australia, which say to use DR2. I.e - I am too far away from a gateway. As I have said in another thread, the proper way of joining using OTAA is actually working for me, when get closer.
                (I don't know WHY that code uses DR0, but I don't really care - it's not code I will be using any more)

                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