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

    Alex's Corner - Week 3 - LoPy LoRaWAN Nano-Gateway & TTN

    Scheduled Pinned Locked Moved Events
    webinarloralopynano gatewaylorawan
    26 Posts 10 Posters 17.0k Views 13 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.
    • PiAirP Offline
      PiAir
      last edited by

      BTW, I just noticed that the LoPy Nano Gateway and node support downlink information....nice. :)
      (now I just have to add some code on the client to actually do something with it and a payload function to do the encoding on the TTN side, see if only the TTN backbone works then testing is much more interesting).

      pfff....until I get another upvote I am only allowed one post per 600 seconds...

      While I was waiting to post, I had another look at the abp_node.py code in the examples folder:

      for i in range (200):
      s.send(b'PKT #' + bytes([i]))
      time.sleep(4)
      rx = s.recv(256)
      if rx:
      print(rx)
      time.sleep(6)

      It might be worthwhile to explain somewhere that this node example script sends 200 packages and then stops.
      Now, resetting will restart the node, but because the devices on TTN by default do "Frame Counter Checks", the backend will ignore the packages after the reset because the node will start at 1 again and the backend will see them as duplicates.
      You can reset the frames counter for the device to fix this.
      0_1490999567448_Reset_Frames_up.PNG

      1 Reply Last reply Reply Quote 3
      • G Offline
        gerkez @PiAir
        last edited by

        @PiAir
        Hi Pierre,
        Thanks for your replies. I appreciate it a lot.
        Who could have guessed that the ttn network / router was down?
        Waited until today, have the same config as you described and guess what?
        Today everything works. I'm happy, because now I have a gateway I can connect to without having to leave my house :-)
        Thanks again.

        1 Reply Last reply Reply Quote 3
        • PiAirP Offline
          PiAir
          last edited by

          I combined a couple of my tests / results of this weekend in another blog post titled "LoRaWAN + The Things Network = Still some love left". Which shows that this weekend was better than last week when I wrote "LoRaWAN + The Things Network = Tough Love or No Love ?" ;-)

          1 Reply Last reply Reply Quote 1
          • R Offline
            rskoniec
            last edited by

            @daniel said in New firmware release 1.6.7.b1 (LoRaWAN Nano Gateway with TTN example!!):

            @rskoniec I'm also seeing those and I'm investigating the cause together with Espressif.

            @rskoniec said in New firmware release 1.6.7.b1 (LoRaWAN Nano Gateway with TTN example!!):

            Sometimes I see series of W (xxxxxxxxx) wifi: post pm rx bcn failed messages on my LoRaWAN Nano Gateway:

            Push ack
            Push ack
            Push ack
            W (147750288) wifi: post pm rx bcn failed
            W (147750288) wifi: post pm rx bcn failed
            Pull ack
            Pull ack
            Pull ack
            

            With the newest f/w 1.6.10.b1 I'm still seeing these messages. @daniel Any news from Espressif?

            The machine is working as good as it's code.

            1 Reply Last reply Reply Quote 0
            • P Offline
              Peter Lans
              last edited by

              Thank you Alex and all the people here on the forum.
              Thanks to all the information provided here I managed to connect my Lopy as nano gateway to TTN. The frontpage detected it although my console tells me it is not connected. I guess that will be fixed at some point in time too.
              But the data is coming through from de OTAA node, so I guess it works. It has to, because my Lopy is the only gateway around.

              As I am completely new to lora, micropython and microprocessor programming, it is an exiting journey for me. But from here, I do have a great starting point to move on.

              Kind regards,
              Peter Lans

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

                @Peter-Lans
                TTN is saying the gateway "not connected" and other issues should be fixed early next week.

                https://www.thethingsnetwork.org/forum/t/known-issue-gateways-show-as-not-connected-in-the-console/6527

                1 Reply Last reply Reply Quote 0
                • B Offline
                  bucknall
                  last edited by

                  I've gotten around to pushing up the LoPy LoRaWAN Nano-Gateway Tutorial!

                  Check it out here - https://docs.pycom.io/pycom_esp32/pycom_esp32/tutorial/includes/lorawan-nano-gateway.html

                  Developer Evangelist - Pycom

                  1 Reply Last reply Reply Quote 2
                  • palmy-nzP Offline
                    palmy-nz
                    last edited by palmy-nz

                    Hi Alex, thanks for these videos.

                    I managed to get the nano-gateway working, using the Packet Forwarder protocol and finding out my Device EUI with these commands

                    import network
                    import binascii
                    binascii.hexlify(network.LoRa().mac())
                    

                    However, I could not get the node working with the otaa_node.py example. I am getting this error:

                    ValueError: invalid argument(s) value
                    

                    On this line

                    lora.add_channel(0, frequency=915100000, dr_min=0, dr_max=5)
                    

                    Note I am on the 915 frequency (New Zealand). Has to be something to do with that aye?

                    Any advice appreciated.

                    Ps. I would love to see in an upcoming video how to pull data from sensors, and also push to nodes e.g. trigger led/servo.

                    J B 2 Replies Last reply Reply Quote 1
                    • J Offline
                      jmarcelino @palmy-nz
                      last edited by

                      @palmy-nz
                      For the 915Mhz region the dr_max parameter (LoRa datarate setting) has to be 4 and not 5.

                      You'll also need to change the nano gateway script to match the frequencies and channel, please see this thread https://forum.pycom.io/topic/983/otaa_node-py-error/3

                      1 Reply Last reply Reply Quote 1
                      • B Offline
                        bucknall @palmy-nz
                        last edited by

                        Hi @palmy-nz please try the settings that @jmarcelino suggested and let me know how you get on. If this fails, I have another idea of what might have been the issue!

                        Data acquisition is definitely an interesting topic! I'll make sure it's on the list for Alex's Corner!

                        Cheers,

                        Alex

                        Developer Evangelist - Pycom

                        palmy-nzP 1 Reply Last reply Reply Quote 0
                        • palmy-nzP Offline
                          palmy-nz @bucknall
                          last edited by

                          Thanks @jmarcelino @bucknall

                          Changing the dr_max from 5 to 4 (for 915mhz) did fix this ValueError.

                          Now I am just getting Not joined yet

                          My gateway config.py looks like this

                          GATEWAY_ID = '70b3d54990c648be'
                          
                          SERVER = 'router.au.thethings.network'
                          PORT = 1700
                          
                          NTP = "pool.ntp.org"
                          NTP_PERIOD_S = 3600
                          
                          WIFI_SSID = '***'
                          WIFI_PASS = '***'
                          
                          LORA_FREQUENCY = 915100000
                          LORA_DR = "SF7BW125"   # DR_5
                          

                          Anything glaringly obvious?

                          B J 2 Replies Last reply Reply Quote 0
                          • B Offline
                            bucknall @palmy-nz
                            last edited by

                            @palmy-nz looks fine :) - have you set up an application on the TTN yet?

                            Developer Evangelist - Pycom

                            palmy-nzP 1 Reply Last reply Reply Quote 0
                            • palmy-nzP Offline
                              palmy-nz @bucknall
                              last edited by palmy-nz

                              @bucknall I do, but device status still 'never seen'.

                              My device eui, app eui, and app key all match node main.py (from otaa_node.py)

                              Not sure about the application handler, currently set to ttn-handler-us-west? no au (aussie) option

                              Where could I be looking?

                              1 Reply Last reply Reply Quote 0
                              • J Offline
                                jmarcelino @palmy-nz
                                last edited by jmarcelino

                                @palmy-nz
                                Did you change your nanogateway.py line 41 as in that thread I linked?

                                Where it says "freq": 868.1 should be "freq": 915.1

                                Then in your otaa_node.py remove all 3 lora.add_channel() lines and replace with

                                for channel in range(0, 72):
                                    lora.remove_channel(channel)
                                
                                lora.add_channel(0, frequency=915100000, dr_min=0, dr_max=4)
                                

                                This is necessary for 915Mhz regions

                                palmy-nzP 1 Reply Last reply Reply Quote 0
                                • palmy-nzP Offline
                                  palmy-nz @jmarcelino
                                  last edited by

                                  @jmarcelino i had missed that change.

                                  I have now changed the freq: and added the remove channel loop.

                                  But still getting Not joined yet.

                                  I tried changing s.setsockopt(socket.SOL_LORA, socket.SO_DR, 4) value, without any luck.

                                  Here are my files...
                                  Node - main py
                                  NanoGateway nanogateway py
                                  NanoGateway config py

                                  A 1 Reply Last reply Reply Quote 0
                                  • A Offline
                                    avinash @palmy-nz
                                    last edited by

                                    @palmy-nz Did you get a chance to complete this?

                                    I was able to connect my nano gateway to TTN, but te node is still getting "Not joined yet".
                                    I'm using 868100000 frequency.

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

                                      @jmarcelino can you help me please?

                                      I was able to connect my NanoGateway to TTN, then I connected a node and i no had problems, however, now I am having problems to connect the node, when I start the node the following messages appear in the NanoGateway:

                                      [ 884.453] Received packet: {"rxpk": [{"data": "ABeYANB+1bNwQfHGnEnVs3BtML tNbMI=", "time": "2018-02-14T15:38:34.160580Z", "chan": 0, "tmst": 860755474, "s tat": 1, "modu": "LORA", "lsnr": 5.0, "rssi": -20, "rfch": 0, "codr": "4/5", "fr eq": 903.9001, "datr": "SF7BW125", "size": 23}]}
                                      [ 884.710] Push ack
                                      [ 887.718] Pull ack
                                      [ 889.710] Pull rsp
                                      [ 890.633] Sent downlink packet scheduled on 866.755, at 923.299 Mhz using SF12BW500: b' yZ\xe2\xb8 \x 191\xc3NL\xc7/\xba+\xf4\xc4'

                                      but the node is still getting "not joined yet", I am using the 915 Mhz.

                                      1 Reply Last reply Reply Quote 2

                                      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
                                      • 2
                                      • 2 / 2
                                      • First post
                                        Last post

                                      Pycom on Twitter

                                      Pycom