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

    [SOLVED] LoRaWAN Nano Gateway and TTN - Status not connected

    Scheduled Pinned Locked Moved LoPy
    lorawanttn gateway
    12 Posts 6 Posters 6.9k Views 6 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.
    • draskoD Offline
      drasko
      last edited by jmarcelino

      Firmware version: 1.7.5.b2

      I have created TTN GW from their console, checked "Legacy Semtech Pakcet Forwarder, selected ttn-router-eu`: https://console.thethingsnetwork.org/gateways/eui-240ac4fffe00ba00

      TTN console still gives me "Status not connected".

      I've used the LoRaWAN Nano GW exaple from this: https://docs.pycom.io/pycom_esp32/pycom_esp32/tutorial/includes/lorawan-nano-gateway.html

      Any ideas how to get GW connected to TTN?

      BR,
      Drasko

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

        @drasko
        Just to confirm did you use the nano-gateway code on that webpage or from the much more up-to-date repository linked from it? I.e.

        https://github.com/pycom/pycom-libraries/tree/master/examples/lorawan-nano-gateway

        draskoD 1 Reply Last reply Reply Quote 0
        • draskoD Offline
          drasko @jmarcelino
          last edited by

          @jmarcelino I took the latest code from the github repo. I thought that this one should be most up to date.

          1 Reply Last reply Reply Quote 0
          • draskoD Offline
            drasko
            last edited by

            Here is my boot.py:

            # boot.py -- run on boot-up
            import param
            import os
            import machine
            
            from machine import UART
            uart = UART(0, 115200)
            os.dupterm(uart)
            
            if machine.reset_cause() != machine.SOFT_RESET:
                from network import WLAN
                wl = WLAN()
                wl.mode(WLAN.STA)
                original_ssid = wl.ssid()
                original_auth = wl.auth()
            
                print("Scanning for known wifi nets")
                available_nets = wl.scan()
                nets = frozenset([e.ssid for e in available_nets])
            
                known_nets_names = frozenset([key for key in param.known_nets])
                net_to_use = list(nets & known_nets_names)
                try:
                    net_to_use = net_to_use[0]
                    net_properties = param.known_nets[net_to_use]
                    pwd = net_properties['pwd']
                    sec = [e.sec for e in available_nets if e.ssid == net_to_use][0]
                    if 'wlan_config' in net_properties:
                        wl.ifconfig(config=net_properties['wlan_config'])
                    wl.connect(net_to_use, (sec, pwd), timeout=10000)
                    while not wl.isconnected():
                        machine.idle() # save power while waiting
                    print("Connected to "+net_to_use+" with IP address:" + wl.ifconfig()[0])
            
                except Exception as e:
                    print("Failed to connect to any known network")
                    wl.init(mode=WLAN.AP, ssid=original_ssid, auth=original_auth, channel=6, antenna=WLAN.INT_ANT)
            

            Can it be that enabling UART is posing the problems?

            I have compared example from GitHub with the one from the documentation - practically no differences. Which might lead to the conclusion that new firmware broke LoRaWAN nano Gateway.

            It should be noted that I am not sending anything to this GW - I am just trying to connect it to TTN. Should I be sending something to it to force it into "active" mode?

            BR,
            Drasko

            1 Reply Last reply Reply Quote 0
            • draskoD Offline
              drasko
              last edited by

              OK, found the issue - it was the matter of a closed UDP port 1700 on my home router.

              After opening the port on home WiFi router config, LoPy NanoGateway is detected as "connected" on TTN.

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                speeeeeed2006 @drasko
                last edited by

                @drasko said in [SOLVED] LoRaWAN Nano Gateway and TTN - Status not connected:

                UDP

                For me still nothing, I have take the code from the example in Github and changed the firewall of my router to accept UDP from 1700 and still nothing.

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

                  @speeeeeed2006
                  There have been problems with The Things Network in the past few days causing gateways to be shown as offline

                  https://www.thethingsnetwork.org/forum/t/known-issue-gateways-appear-as-offline/8278

                  Keep an eye on ther NOC section of https://status.thethings.network for updates

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

                    Hello,
                    I'm facing the same issue here with the newest firmware and code from github.
                    made sure the UDP port was open to the IP of the Lopy board. *even used DMZ to be 100% sure.

                    my gateway looks <not connected> in the console.
                    I still have no node ready to send data to it...
                    curious how long should it take to appear as online on the site ?

                    also tester two different routers; ttn-router-eu and the one from the us...

                    any help would be appreciated :)

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

                      @gmtl When the gateway is up & connected, you see messages in the REPL prompt like:

                      [310633.921] Pull ack
                      [310658.907] Pull ack
                      [310678.935] Push ack
                      [310683.941] Pull ack
                      [310708.928] Pull ack
                      

                      This is the log of the UDP communication to the server. If you don't see that, then either the connection is not set up properly or you gateway at the server.
                      Edit: Could you post the sequence of messages you get after starting the gateway. Maybe something else fails, like accessing the ntp service.

                      G 1 Reply Last reply Reply Quote 0
                      • G Offline
                        gmtl @robert-hh
                        last edited by

                        @robert-hh said in [SOLVED] LoRaWAN Nano Gateway and TTN - Status not connected:

                        : Could you post the sequence of messages you get after starting the gateway. Maybe something else fails, like accessing the ntp service.

                        Hi Robert,
                        I finally made it work! I've used a different server address;
                        once used this, it apeared like less than a minute later.
                        router.eu.thethings.network

                        now working on the Feather M0 with the LMIC example
                        so many different example and little details to take care of but not completely sure yet of so many details... I need to keep looking around :) *but I forgot my laptop charger at the office.... haha

                        1 Reply Last reply Reply Quote 0
                        • N Offline
                          nojava4u
                          last edited by nojava4u

                          I know this is an old post, but I've got my Lopy LoRaWAN nano gateway up and and in Atom console which I am connected by USB, I see this:
                          [ 2970.621] Starting LoRaWAN nano gateway with id: b'240AC4FFFE000646'
                          [ 2972.960] WiFi connected to: MakeItRain
                          [ 2972.964] Syncing time with pool.ntp.org ...
                          [ 2973.118] RTC NTP sync complete
                          [ 2986.965] Opening UDP socket to ttn-router-us-west (0.198.14.128) port 1700...
                          [ 2986.977] Setting up the LoRa radio at 903.9001 Mhz using SF7BW125
                          [ 2986.992] LoRaWAN nano gateway online
                          [ 2986.996] You may now press ENTER to enter the REPL but Did we connect..

                          So I used the https://github.com/pycom/pycom-libraries/tree/master/examples/lorawan-nano-gateway
                          Code here and followed Alex Corner Week 3. It seems to be working, but my Gateway shows "not connected" on my TTN Console

                          I don't have any sensor nodes setup yet, however I'm receiving packets? see below. I have no idea if it actually working because I cannot ping the IP, though it is connected to my wifi and I can see the MAC address and the IP assigned to it in the Wifi Router. I guess my main question is my gateway actually connected to the TTN? Can I send data without a node? Where are these packets coming from??

                          MicroPython v1.8.6-703-g5e80328a on 2017-07-05; LoPy with ESP32
                          Type "help()" for more information.

                          [ 3022.243] Received packet: {"rxpk": [{"data": "xIWurbe8MYL6FkXy9crif61qCaVFXQ==", "time": "2018-04-20T17:14:53.523263Z", "chan": 0, "tmst": 3263950178, "stat": 1, "modu": "LORA", "lsnr": -48, "rssi": -121, "rfch": 0, "codr": "4/5", "freq": 903.9001, "datr": "SF7BW125", "size": 22}]}

                          [ 4176.367] Received packet: {"rxpk": [{"data": "3JU0hEE34WkDAv/z5zkMTdMoguptgSSnmE0B4skytmMRvg4FTZN1ZPCl8iBvoXEbgwgaKzkQ06Qs4iQIaGg4lreaF9Wrd7CCQcW+GvCvdMx0DtoJpPrQ/p/+uEYm9XZTAueEhT0EAC88dTnKKcbVuGoej4hmHWa8TH/tdwfYB7CjR1XrgrTSfHBinta2FlCA/OIZb6g5Z1PEIgFqjXd5100aiIJi7LpnAREMleskGbGhncUxQcQpL7xK3N+dCpujweenV9ycoNoS+gKL3jIlOyx+hK6jIYR9v9PLIfEHv1Mrcu/xGfwbRORBL6gYTlUEgp0=", "time": "2018-04-20T17:34:07.646666Z", "chan": 0, "tmst": 121396999, "stat": 1, "modu": "LORA", "lsnr": -44, "rssi": -116, "rfch": 0, "codr": "4/5", "freq": 903.9001, "datr": "SF7BW125", "size": 242}]}
                          [ 4937.723] Received packet: {"rxpk": [{"data": "0ccO", "time": "2018-04-20T17:46:49.3603Z", "chan": 0, "tmst": 881125496, "stat": 1, "modu": "LORA", "lsnr": -43, "rssi": -118, "rfch": 0, "codr": "4/5", "freq": 903.9001, "datr": "SF7BW125", "size": 3}]}

                          [ 5669.469] Received packet: {"rxpk": [{"data": "iNLdSAM3usU51C84TZp1YG9U8KDpfkQEfA==", "time": "2018-04-20T17:59:00.748699Z", "chan": 0, "tmst": 1611203146, "stat": 1, "modu": "LORA", "lsnr": -48, "rssi": -123, "rfch": 0, "codr": "4/5", "freq": 903.9001, "datr": "SF7BW125", "size": 25}]}

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

                            @nojava4u if your gateway is connected, you should see in it's log lines like:

                            [1194454.555] Pull ack
                            [1194479.579] Push ack
                            [1194479.579] Pull ack
                            [1194504.623] Pull ack
                            [1194529.418] Pull ack
                            

                            If you do not get that, then either your gateway cannot connect to the the TTN server (unlikely), or your gateway is not (properly) registered. For that, follow the instructions at: https://docs.pycom.io/chapter/tutorials/lora/lorawan-nano-gateway.html, starting with "Registering at TTN".
                            Besides that, you will ever see messages being received by your gateway. I see them here too, at my nanogateway about once every 30 minutes. At my fully compliant gateway I'm receiving these every two minutes. Looking at the content, it looks like noise, even if I do not understand the statistics behind that.
                            At a triggering preamble length of 40 bit and a data rate of 5670 bit/s, there should not be a random match more often than once every 3 years.

                            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