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)
    
    


  • 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