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

    GPy with Hologram.io SIM

    Scheduled Pinned Locked Moved GPy
    hologram.io
    100 Posts 10 Posters 42.8k Views 12 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.
    • T Offline
      tlanier @jmarcelino
      last edited by tlanier

      @jmarcelino
      Below is the code I'm going to use in the GPy plugged into my car USB port. The LED will show me the attach/connection state. This evening I plan to drive to multiple locations to see if I can make it work.

      import pycom
      import socket
      import ssl
      import sys
      import time
      from network import LTE
      
      # send AT command to modem and display response
      def at(cmd):
          print("modem command: {}".format(cmd))
          response = lte.send_at_cmd(cmd).split('\r\n')
          for line in response:
              print(line)
      
      #####################################################################
      print("CAT M1 Test - V0.2")
      
      print("disable MicroPython contorl of LED")
      pycom.heartbeat(False)
      pycom.rgbled(0xFFFFFF)  # White
      
      print("instantiate LTE object")
      lte = LTE(carrier="verizon")
      print("delay 4 secs")
      time.sleep(4.0)
      
      if lte.isattached():
          print("LTE was already attached, disconnecting...")
          lte.disconnect()
          lte.detach()
          print("resetting modem...")
          lte.reset()
          print("delay 5 secs")
          time.sleep(5.0)
      
      # using hologram SIM
      at('AT+CGDCONT=1,"IP","hologram"')
      
      # enable network registration and location information unsolicited result code
      # +CEREG: <stat>[,[<tac>],[<ci>],[<AcT>]]
      at('AT+CEREG=2')
      
      print("full functionality level")
      at('AT+CFUN=1')
      time.sleep(1.0)
      
      print("attempt to attach cell modem to base station...")
      lte.attach()
      i = 0
      while not lte.isattached():
          i = i + 1
          print("not attached: {} secs".format(i))
      
          if (i % 2 == 0):
              pycom.rgbled(0xFF0000)  # Red
          else:
              pycom.rgbled(0x000000)  # Off
      
          # get EPS Network Registration Status:
          # 0 - not registered
          # 1 - registered, home network
          # 2 - not registered, but searching...
          # 3 - registration denied
          # 4 - unknown (out of E-UTRAN coverage)
          # 5 - registered, roaming
          at('AT+CEREG?')
          time.sleep(1)
      
      print("connect: start a data session and obtain an IP address")
      lte.connect()
      i = 0
      while not lte.isconnected():
          i = i + 1
          print("not connected: {}".format(i))
      
          if (i % 2 == 0):
              pycom.rgbled(0x00FF00)  # Green
          else:
              pycom.rgbled(0x000000)  # Off
      
          time.sleep(1.0)
      
      pycom.rgbled(0x0000FF)  # Blue
      
      s = socket.socket()
      s = ssl.wrap_socket(s)
      s.connect(socket.getaddrinfo('www.google.com', 443)[0][-1])
      s.send(b"GET / HTTP/1.0\r\n\r\n")
      print(s.recv(4096))
      s.close()
      
      lte.disconnect()
      lte.dettach()
      
      # end of test
      print("end of test")
      pycom.rgbled(0xFFFF00)    # Yellow
      
      while True:
          pass
      
      
      J T 2 Replies Last reply Reply Quote 0
      • J Offline
        jmarcelino @tlanier
        last edited by jmarcelino

        @tlanier

        I'm afraid the manual is written by Sequans (who make the modem) and is more of a general guide for all possible implementations.

        The LED on the FiPy/GPy is only connected to the ESP32/MicroPython and not to the modem. The SQNLED command will have no effect.

        The correct way to check for correctly registration is via AT commands and specifically the status check AT+CEREG? Valid registration stats are 2,1 or 2,5 (for MVNOs)

        T 1 Reply Last reply Reply Quote 0
        • T Offline
          tlanier @jmarcelino
          last edited by

          @jmarcelino

          Thanks, I've updated the code.

          1 Reply Last reply Reply Quote 0
          • T Offline
            tlanier @tlanier
            last edited by

            @tlanier
            I took the Gpy 50 miles down Interstate 85 through West Point, GA and Opelika, AL. The device never attached to a cell tower during the entire trip.

            J 2 Replies Last reply Reply Quote 0
            • J Offline
              jmarcelino @tlanier
              last edited by

              @tlanier
              Were you using the code you posted below? I didn't notice you had changed the code you to calling lte.attach() again. Have you been doing the other tests with this?

              For setups like Hologram where you do a custom init you need to remove lte.attach() and use AT+CEREG=2 and AT+CFUN=1 manually.

              As you already have those in the code you need to remove lte.attach() otherwise it will cause problems.

              T 1 Reply Last reply Reply Quote 0
              • T Offline
                tlanier @jmarcelino
                last edited by

                @jmarcelino

                Thanks for catching the misunderstanding!

                Here's my revised code. The at(cmd) function has been improved to return the modem response as a list making it easier to parse. I've also added logic to break on <tac> = 1 or 5 just in case the isattached() function is not working.

                I will take the GPy north towards Atlanta today and see if I can connect there.

                import pycom
                import socket
                import ssl
                import sys
                import time
                from network import LTE
                
                # send AT command to modem and return response as list
                def at(cmd):
                    print("modem command: {}".format(cmd))
                    r = lte.send_at_cmd(cmd).split('\r\n')
                    r = list(filter(None, r))
                    print("response={}".format(r))
                    return r
                
                #######################################################
                print("CAT M1 Test - V0.3 - 4/15/18")
                
                print("disable MicroPython control of LED")
                pycom.heartbeat(False)
                pycom.rgbled(0xFFFFFF)  # White
                
                print("instantiate LTE object")
                lte = LTE(carrier="verizon")
                print("delay 4 secs")
                time.sleep(4.0)
                
                if lte.isattached():
                    print("LTE was already attached, disconnecting...")
                    lte.disconnect()
                    lte.detach()
                    print("resetting modem...")
                    lte.reset()
                    print("delay 5 secs")
                    time.sleep(5.0)
                
                # enable network registration and location information, unsolicited result code
                at('AT+CEREG=2')
                
                print("full functionality level")
                at('AT+CFUN=1')
                time.sleep(1.0)
                
                # using Hologram SIM
                at('AT+CGDCONT=1,"IP","hologram"')
                
                print("attempt to attach cell modem to base station...")
                # lte.attach()  # do not use attach with custom init for Hologram SIM
                
                i = 0
                while True:
                    # get EPS Network Registration Status:
                    # +CEREG: <stat>[,[<tac>],[<ci>],[<AcT>]]
                    # <tac> values:
                    # 0 - not registered
                    # 1 - registered, home network
                    # 2 - not registered, but searching...
                    # 3 - registration denied
                    # 4 - unknown (out of E-UTRAN coverage)
                    # 5 - registered, roaming
                    r = at('AT+CEREG?')
                    r0 = r[0]  # +CREG: 2,<tac>
                    r0x = r0.split(',')     # ['+CREG: 2',<tac>]
                    tac = int(r0x[1])       # 0..5
                    print("tac={}".format(tac))
                
                    if lte.isattached():
                        print("Modem attached (isattached() function worked)!!!")
                        break
                
                    if (tac==1) or (tac==5):
                        print("Modem attached!!!")
                        break
                
                    i = i + 1
                    print("not attached: {} secs".format(i))
                
                    if (i % 2 == 0):
                        pycom.rgbled(0xFF0000)  # Red
                    else:
                        pycom.rgbled(0x000000)  # Off
                
                    time.sleep(1)
                
                print("connect: start a data session and obtain an IP address")
                lte.connect()
                i = 0
                while not lte.isconnected():
                    i = i + 1
                    print("not connected: {}".format(i))
                
                    if (i % 2 == 0):
                        pycom.rgbled(0x00FF00)  # Green
                    else:
                        pycom.rgbled(0x000000)  # Off
                
                    time.sleep(1.0)
                
                
                pycom.rgbled(0x0000FF)  # Blue
                
                s = socket.socket()
                s = ssl.wrap_socket(s)
                s.connect(socket.getaddrinfo('www.google.com', 443)[0][-1])
                s.send(b"GET / HTTP/1.0\r\n\r\n")
                print(s.recv(4096))
                s.close()
                
                lte.disconnect()
                lte.dettach()
                
                # end of test, Red LED
                print("end of test")
                pycom.rgbled(0xFFFF00)  # Yellow
                
                while True:
                    pass
                
                T 1 Reply Last reply Reply Quote 0
                • T Offline
                  tlanier @tlanier
                  last edited by

                  @tlanier

                  I drove through both Newnan, GA and Peachtree City, GA with the GPy running in my car. The device never attached to any tower even though I passed by many towers within visible sight.

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

                    Thanks @tlanier

                    Are you able to try it with a Verizon Cat M1 SIM?

                    T 1 Reply Last reply Reply Quote 0
                    • T Offline
                      tlanier @jmarcelino
                      last edited by

                      @jmarcelino

                      Anybody know how to get an evaluation Cat M1 SIM that will work.

                      On the Verizon web page they state: "Machine to Machine Plans are available only to business customers with five or more CLEU lines that have signed a Major Account Agreement. "

                      Verizon Machine to Machine Plans

                      I talked to Kore about a month ago, and they did not offer Cat M1 SIM's at that time.

                      Kore

                      T 1 Reply Last reply Reply Quote 0
                      • T Offline
                        tlanier @tlanier
                        last edited by

                        @tlanier

                        We've talked to the Verizon open development team and they indicated that CAT M1 is on ALL Verizon LTE towers in the country.

                        There's got to be some explanation as to why we cannot connect with the GPy.

                        T 1 Reply Last reply Reply Quote 0
                        • T Offline
                          tlanier @tlanier
                          last edited by

                          @tlanier

                          The Verizon Wireless HelpDesk @ 800-525-0481 has now told us our Hologram SIM is not a valid SIM on their network. We have contacted Hologram to try to determine what could be the problem. No word yet from Hologram.

                          ChrisGammellC 1 Reply Last reply Reply Quote 0
                          • ChrisGammellC Offline
                            ChrisGammell @tlanier
                            last edited by

                            @tlanier said in GPy with Hologram.io SIM:

                            The Verizon Wireless HelpDesk @ 800-525-0481 has now told us our Hologram SIM is not a valid SIM on their network

                            Yep, still trying things here as well. As Ryan said over on our forum, it's possible that Verizon does not have direct records of our SIMs on their network and we encourage everyone to contact us directly for connectivity. We understand you're frustrated while we try to get this sussed out, we are as well. The problem with SIM cards that normally "just work"...is when they don't.

                            ChrisGammellC 1 Reply Last reply Reply Quote 0
                            • ChrisGammellC Offline
                              ChrisGammell @ChrisGammell
                              last edited by

                              @chrisgammell

                              Speaking of frustrated, I'm still getting errors from lte.connect(), is there a way to get a more verbose output?

                              I just saw in the docs that there is a firmware update for the modem as well as as the Pycom boards themselves, going to try that now. Is it possible that that could be contributing to the problem?

                              T J 2 Replies Last reply Reply Quote 0
                              • ChrisGammellC Offline
                                ChrisGammell
                                last edited by

                                I added at('at+csq') into the loop and saw that as the device eventually finds its way onto the network here locally, it goes from "99, 99" to "11, 99" or so. Does yours change if you insert that into the loop, @tlanier? Also could you post a picture of your mobile rig? I'm curious about how you have it all hooked up and powered and such.

                                T 4 Replies Last reply Reply Quote 0
                                • T Offline
                                  tlanier @ChrisGammell
                                  last edited by

                                  @chrisgammell

                                  I did do the firmware update from:

                                  https://pycom.io/downloads/

                                  I have not done the modem firmware update. Thanks for the link. I will try that first thing in the morning.

                                  1 Reply Last reply Reply Quote 0
                                  • T Offline
                                    tlanier @ChrisGammell
                                    last edited by

                                    @chrisgammell

                                    I'm just using the expansion board 2.0 with the GPy powered using the USB port to my computer desktop. I've also drove around in the car with the unit plugged into the USB port on my car.

                                    I'll try the AT+CSQ command in the morning and post the results.

                                    As a new user the system will only allow me to post every 10 mins so I sitting here waiting for the 10 mins to expire so I can send this post...

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

                                      Thank you both so much for your continued tests.

                                      @ChrisGammell We're investigating your .connect() problems. I think our command timeouts were very short for some situations and I've let the LTE team know, hope to see an improvement on the next release.

                                      Modem firmware could have an impact but it's hard for us to tell because our modem manufacturer, very much like Verizon, just doesn't understand roaming MVNOs like Hologram. They only think in terms of carrier certification with the carrier's own SIM card.

                                      That said it won't harm anything to try a newer modem firmware as long as you are careful with the upgrade - give it lots of time to complete even when it seems nothing is happening!

                                      We should be releasing a more streamlined modem upgrade process soon so you can also wait for that instead.

                                      If anyone else can help us run some tests with Hologram especially in a known good coverage area where you already see 2,5 and valid CSQ let us know. It would help if perhaps someone can give us remote access (e.g. TeamViewer) to check out a few parameters.

                                      T 1 Reply Last reply Reply Quote 0
                                      • T Offline
                                        tlanier @ChrisGammell
                                        last edited by

                                        @chrisgammell
                                        I'm getting a +CSQ: 11,99 here indoors.

                                        1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          tlanier @ChrisGammell
                                          last edited by

                                          @chrisgammell

                                          Nothing special about the setup.

                                          0_1524056663842_GPy.jpg

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

                                            @tlanier
                                            Which antenna is that? Do you have a link?
                                            Is it suitable for 746-787Mhz (Band 13) operation?

                                            T 2 Replies 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
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 3 / 5
                                            • First post
                                              Last post

                                            Pycom on Twitter

                                            Pycom