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

    Cellular LoRaWAN Nanogateway

    Scheduled Pinned Locked Moved Projects
    lora gatewaylora
    12 Posts 4 Posters 957 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.
    • L Offline
      lewis
      last edited by

      I was able to get it work just fine. The internet connection to the server worked fine. I'm having issues getting downlink messages to the lorawan nodes, but on AT&T LTE-M its working great.

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

        @mylescai the nanogateway opens a socket connection to the TTN server. So you just have to attach and connect the LTE link, and the go on with connecting to TTN.

        Edit: To be more specific. In nanogateway.py, function start(), at about line 140 the wifi is set up. At that place you can instead set up the LTE connection.

        M 2 Replies Last reply Reply Quote 0
        • M Offline
          Miguel Toscano G @robert-hh
          last edited by

          @robert-hh said in Cellular LoRaWAN Nanogateway:

          et up the LTE connection.

          Hi Robert, help me please =D, ¿How can I instead set up the LTE connection ?

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

            @robert-hh
            I changed config.py code for these:

            from network import LTE
            import time
            import socket

            lte = LTE()
            lte.init()

            lte.attach(band=20, apn="internet.itelcel.com")
            print("attaching..",end='')
            while not lte.isattached()
            time.delay(0.25)

            print('.',end='')
            print(lte.send_at_cmd('AT!="fsm"'))
            

            print("attached!")

            lte.connect()
            print("connecting [##",end='')
            while not lte.isconnected():
            time.sleep(0.25)
            print('#',end='')
            #print(lte.send_at_cmd('AT!="showphy"'))
            print(lte.send_at_cmd('AT!="fsm"'))
            print("] connected!")

            print(socket.getaddrinfo('pycom.io', 80))
            lte.deinit()
            #now we can safely machine.deepsleep()


            and now i know, I have to change this into nanogateway.py.... ¿but how ?

            self.wlan = WLAN(mode=WLAN.STA)
            self._connect_to_wifi()


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

              @Miguel-Toscano-G All you have to do is start LTE and connect to the network. Once you have done that, you can run the nanogateway code as it is. I just tried that here with NB-IoT.
              For connecting to the LTE service, follow the examples.

              M 1 Reply Last reply Reply Quote 1
              • M Offline
                Miguel Toscano G @robert-hh
                last edited by Miguel Toscano G

                @robert-hh Hi Robert, thank you for help me, I tried with the example "nanogateway" code with WiFi and its work good, but when I changed the config file with de LTE code. I get this IndentationError.

                ----------- Console--------------
                OK
                attached!
                connecting [##] connected!
                [(2, 1, 0, '', ('18.195.176.111', 80))]
                Traceback (most recent call last):
                File "main.py", line 14, in <module>
                File "nanogateway.py", line 99
                IndentationError: unexpected indent
                Pycom MicroPython 1.20.2.rc6 [v1.11-01f49f7] on 2020-02-28; FiPy with ESP32
                Pybytes Version: 1.3.1
                Type "help()" for more information.


                File nanogateway.py
                line 99 refers to ssid y password

                           99        self.ssid = ssid
                           100        self.password = password
                

                *** the main and nanogatawey files, I did not modify them. Only to the file "config", I delete all the wifi code, and paste the lte configuration, and also, I put the information telephone company.

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

                  @Miguel-Toscano-G Obviously the file is formatted wrong. Did you really copy the line numbers? If not, there is probably a mix of tabs and spaces in the file, which may be causes by the process of copying and storing.

                  M 2 Replies Last reply Reply Quote 0
                  • M Offline
                    Miguel Toscano G @robert-hh
                    last edited by

                    @robert-hh you are correct, that was the error =D

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

                      @robert-hh Finally it is running on LTE cat m1 =D thanks... ¿Do you know, how can i use lte cat m1 and wifi on the same gateway at the same time? I want to connect my fipy with ttn using LTE CAT M1(its ready) and connect the same gateway with a laptop through wifi....

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

                        @Miguel-Toscano-G There was a discussion about simultaneous WiFi and LTE mode at the forum. As far as I recall the result, there was no clear control about which interface is used by the gateway for it's communication.
                        Do you use the FiPy in AP or STA mode?

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

                          @robert-hh So far, I have used the fipy connected to wify and I have also used the fipy with lte. I'm not sure what I'm using (Ap or STA).... but I only use one technology at a time (wifi or lte)

                          wifi code (config.py)
                          """LoPy LoRaWAN Nano Gateway configuration options"""

                          import machine
                          import ubinascii

                          WIFI_MAC = ubinascii.hexlify(machine.unique_id()).upper()
                          GATEWAY_ID = GATEWAY_ID = WIFI_MAC[:6] + "FFFE" + WIFI_MAC[6:12]

                          SERVER = 'router.us.thethings.network'
                          PORT = 1700
                          NTP = "pool.ntp.org"
                          NTP_PERIOD_S = 3600

                          WIFI_SSID = ''
                          WIFI_PASS = '
                          '

                          LORA_FREQUENCY = 903900000
                          LORA_GW_DR = "SF10BW125" # DR_0
                          LORA_NODE_DR = 0

                          LTE code (config.py)

                          """ LoPy LoRaWAN Nano Gateway configuration options """

                          import machine
                          import ubinascii

                          WIFI_MAC = ubinascii.hexlify(machine.unique_id()).upper()

                          Set the Gateway ID to be the first 3 bytes of MAC address + 'FFFE' + last 3 bytes of MAC address

                          GATEWAY_ID = WIFI_MAC[:6] + "FFFE" + WIFI_MAC[6:12]

                          SERVER = 'router.us.thethings.network'
                          PORT = 1700

                          NTP = "pool.ntp.org"
                          NTP_PERIOD_S = 3600

                          for US915

                          LORA_FREQUENCY = 903900000
                          LORA_GW_DR = "SF10BW125" # DR_0
                          LORA_NODE_DR = 0

                          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