Pytrack gps None,None



  • 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)
    
    


  • 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



  • 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



  • 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



  • This post is deleted!


  • This post is deleted!

Log in to reply
 

Pycom on Twitter