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

    Having trouble making a lorawan using 2 lopy4 devices

    Scheduled Pinned Locked Moved LoPy
    5 Posts 2 Posters 50 Views 2 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.
    • R Offline
      Roberto Duca
      last edited by

      R
      Roberto Duca about an hour ago

      Hi there! I am quite new to Iot and lorawan.

      I am trying to set up a small network between two lopy4 devices using lorawan in Australia using the 915 frequency. One device is set up as a gateway using the example off the github drive https://github.com/pycom/pycom-libraries/tree/master/examples/lorawan-nano-gateway

      for the config i am currently using the following settings in my config file

      LORA_FREQUENCY = 916800000
      LORA_GW_DR = "SF12BW500"
      LORA_NODE_DR = 8

      on the things network i have the device registered with teh following frequency plan: AU_915_928_FSB_2

      the gateway seems to connect to the internet and shows being active on ttn console, but unfortunately I am not achieving any communication between the node and gateway using lorawan.

      I have tried a couple of various pieces of code i've found but suspect it must be how i am registereing the end device. in my code i am trying this code at the moment to no avail:

      from network import LoRa
      import time
      import binascii
      import pycom
      
      pycom.heartbeat(False) #needs to be disabled for LED functions to work
      pycom.rgbled(0x7f0000) #red
      
      #Set AppEUI and AppKey - use your values from the device settings --> https://console.thethingsnetwork.org/
      app_eui = binascii.unhexlify('removed')
      app_key = binascii.unhexlify('removed')
      
      lora = LoRa(mode=LoRa.LORAWAN, public=1,  adr=0, tx_retries=0)
      
      # Remove default channels
      for index in range(0, 72):
          lora.remove_channel(index)
      
      # Set  AU ISM 915 channel plan for TTN Australia
      for index in range(8, 15):
          lora.add_channel(index, frequency=915200000+index*200000, dr_min=0, dr_max=3)
      
      lora.add_channel(65, frequency=917500000,  dr_min=4,  dr_max=4)
      
      for index in range(0, 7):
          lora.add_channel(index, frequency=923300000+index*600000, dr_min=0, dr_max=3)
      
      #Join TTN Network via OTAA
      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():
          pycom.rgbled(0x7f7f00) #yellow
          time.sleep(5)
          print('Trying to join TTN Network!')
          pass
      
      print('Network joined!')
      pycom.rgbled(0x007f00) #green
      
      
      while not lora.has_joined():
          pycom.rgbled(0x7f7f00) #yellow
          time.sleep(5)
          print('Trying to join TTN Network!')
          pass
      
      print('Network joined!')
      pycom.rgbled(0x007f00) #green
      

      i have tried OTAA and ABP but it doesnt seem to work. i think the hardware is working because if i set up a raw lora gateway and node i can see packets being sent to each other.

      i am not sure what i might be doing wrong? any advice or help would be much appreciated.

      Thanks,

      Rob

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

        @Roberto-Duca the nano gateway only listens on a single frequency rather than 9 or so a real gateway does. You must remove all channels and only use the signe channel the gateway listens on.

        R 1 Reply Last reply Reply Quote 1
        • R Offline
          Roberto Duca
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • R Offline
            Roberto Duca @jcaron
            last edited by

            @jcaron
            Thanks for your reply!

            ok so when i set the frequency on the gateway of 916.8MHz that is the listening frequency?

            i should then restrict the channel frequencies to 916.8MHz on the node then too?

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

              @Roberto-Duca yes, you need to use only the frequency chosen on the gateway.

              Note that the network may (and probably will) send it’s on list of channels and frequencies after the join, so ideally you should configure the network to only send that single frequency (don’t know if you can do that on TTN), or you will have to reset the list of channels after the join (or rather before each transmit).

              Also I believe the nano-gateway only listen on a single DR, so likewise, you should restrict your node to that single DR (both for join and subsequent traffic).

              Remember that a nano-gateway is just there for a bit of testing, it’s by far not a real LoRaWAN-compliant gateway.

              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