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

    Pytrack gps None,None

    Scheduled Pinned Locked Moved Expansion Board
    6 Posts 3 Posters 163 Views 5 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
      rholas
      last edited by rholas

      I try to start my pytrack board with Lopy4 but gps get only None,None.
      I went out into the garden for 20 mins but still not lock gps, program wait for gps signal.

      import socket
      import time
      import pycom
      import ubinascii
      import machine
      import network
      from network import LoRa
      from L76GNSS import L76GNSS
      from pytrack import Pytrack
      from LIS2HH12 import LIS2HH12
      from machine import ADC
      
      lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.EU868)
      
      # create an OTAA authentication parameters
      dev_eui = ubinascii.unhexlify('7XXXXXXX')
      app_eui = ubinascii.unhexlify('A7415FCXXXXXX')
      app_key = ubinascii.unhexlify('6A42ED2XXXXXXXXXXXXXX')
      
      lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_eui, app_key), timeout=0, dr=4)
      
      pycom.heartbeat(False)
      
      pycom.rgbled(0x7f0000)
      while not lora.has_joined():
          time.sleep(5)
      
      pycom.rgbled(0x00007f)  
      s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
      s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5)
      
      s.setblocking(True)
      
      py = Pytrack()
      l76 = L76GNSS(py, timeout=60)
      acc = LIS2HH12(py)
      s.setblocking(False)
      gpsResult = l76.coordinates()
      print(gpsResult[0])
      while gpsResult[0] != "None":
              gpsResult = l76.coordinates()
              time.sleep(5)
      pycom.rgbled(0x007f00)  
      while True:
          coord = l76.coordinates()
          accel = acc.acceleration()
          battery = py.read_battery_voltage()
          s.send(str(coord)+":"+str(accel)+":"+str(battery))
          time.sleep(60)
      
      
      1 Reply Last reply Reply Quote 0
      • R Offline
        rholas
        last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • R Offline
          rholas
          last edited by rholas

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • R Offline
            rholas
            last edited by

            Modify code to work with L76GNSV4.py

            import socket
            import time
            import pycom
            import ubinascii
            import machine
            import network
            from network import LoRa
            from L76GNSV4 import L76GNSS
            from pytrack import Pytrack
            from LIS2HH12 import LIS2HH12
            from machine import ADC
            
            lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.EU868)
            
            dev_eui = ubinascii.unhexlify('70B3DXXXX')
            app_eui = ubinascii.unhexlify('A74XXXXX')
            app_key = ubinascii.unhexlify('6A42ED2AXXXXX')
            
            # join a network using OTAA (Over the Air Activation)
            lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_eui, app_key), timeout=0, dr=4)
            
            pycom.heartbeat(False)
            # wait until the module has joined the network
            pycom.rgbled(0x7f0000)
            while not lora.has_joined():
                time.sleep(5)
            
            pycom.rgbled(0x00007f)  
            # create a LoRa socket
            s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
            
            # set the LoRaWAN data rate
            s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5)
            
            # make the socket blocking
            # (waits for the data to be sent and for the 2 receive windows to expire)
            s.setblocking(True)
            
            # send some data
            #s.send(bytes([0x01, 0x02, 0x03]))
            py = Pytrack()
            L76 = L76GNSS(pytrack=py)
            L76.setAlwaysOn()
            acc = LIS2HH12(py)
            # make the socket non-blocking
            # (because if there's no data received it will block forever...)
            ##s.setblocking(False)
            L76.get_fix(debug=False)
            if L76.fixed():
                pycom.rgbled(0x000f00)
            while True:
                coord = L76.coordinates(debug=False)
                ido = L76.getUTCDateTime(debug=False)
                accel = acc.acceleration()
                battery = py.read_battery_voltage()
                s.send(str(coord)+":"+str(accel)+":"+str(battery)+":"+str(ido))
                time.sleep(60)
            
            

            Get data from my car over Lora:

            {'latitude': 47.XX636, 'longitude': 16.XX56, 'ttf': 1}:(-0.5155029, -0.3260498, 0.8127441):3.84871:2020-06-17T09:35:44+00:00

            J 1 Reply Last reply Reply Quote 0
            • J Offline
              Jean-Guillaume LALANNE @rholas
              last edited by

              Hello @rholas

              I have seen your post on this forum thread.
              I have the same problem.

              (None, None) - (1970, 1, 1, 0, 0, 7, 439353, None) - 2544192
              (None, None) - (1970, 1, 1, 0, 0, 9, 436383, None) - 2544384
              (None, None) - (1970, 1, 1, 0, 0, 11, 433600, None) - 2544384
              (None, None) - (1970, 1, 1, 0, 0, 13, 431573, None) - 2544384
              (None, None) - (1970, 1, 1, 0, 0, 15, 428571, None) - 2544384
              

              I have tried to use the L76GNSV4 file as you mentioned and I found it here
              But I don't get anything. It seems blocked.

              What should I do ? I use the reference code from the pytrack 2 documentation and I get None for the coordinates and when i use L76GNSV4, nothing happen.

              thanks in advance for your help

              Best regards

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

                As mentioned before, GPS reception inside is generally very poor, so the result is as expected when using it inside.

                Next, if you are using the external antenna on the pytrack2, make sure the jumper labelled AON is also present.
                Let me know
                Gijs

                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