Pycom Pytrack Getting Started

Chris just shared a new tutorial: "Pycom Pytrack Getting Started"



In this getting started guide we’ll use the Pytrack from Pycom to detect our location on Earth using the onboard GPS module and use the accelerometer to control a 3D model on the PC. I put a WiPy onto my Pytrack, connected it to the PC and…

Read more

Yeah the Pycom L76 library is a bit ho hum. A great exercise for anyone to learn how GPS works would be to write your own library. But fortunately for those of us who know enough about parsing NMEA … someone prepared one earlier. L76micropyGPS.

According to the docs it runs its own thread in the background updating location structures in micropyGPS (look at micropyGSP.py in the lib directory) at around 4 times a second (look in L76micropyGPS.py in the lib directory it sends data to micropyGPS then sleeps for 0.25s). So its not something for low power applications without some modification.

I modified the main.py to include the following extra parameters.

while (True):
print(“my_gps.parsed_sentences: {}”.format(my_gps.parsed_sentences))
print(“my_gps.satellites_in_use: {}”.format(my_gps.satellites_in_use))
print(“fix status {} fix type {}”.format(my_gps.fix_stat,my_gps.fix_type))
print(“lat {} long {} height {} m”.format(my_gps._latitude,my_gps._longitude,my_gps.geoid_height))
print("speed {} (knots, mph, kph) Course {} ".format(my_gps.speed,my_gps.course))
print(“my_gps.date: {}”.format(my_gps.date))
print(“my_gps.timestamp: {}”.format(my_gps.timestamp))
print(“my_gps.hdop: {}”.format(my_gps.hdop))
print(“Free Mem: {}”.format(gc.mem_free()))
time.sleep(1)

2 Likes

Great suggestion Peter!

It’s cool to see someone take the tutorial and improve it a bit! Is this a change that works directly with the provided code in the tutorial?

@Stephen I should have been clearer. The code snippet basically expands the alternative L76micropyGPS library example code main.py and not the code in the tutorial above. (see https://github.com/gregcope/L76micropyGPS/blob/master/main.py). The example as it stands didn’t print Lat/long, height, speed, course, fix status etc. All things you need to use to start doing smart things with the GPS. I am only learning python and I thought the print statements were fairly nifty in how they use the {} for formatting structured variables.

2 Likes