Sunday, November 15, 2015

The Software Side of the House

With the hardware pinned down it was time to figure out what I was going to do with this thing. The example code for the GPS logger shield get me 90% of the way there. I just decided what GPS NMEA data I wanted to log and how often and sent it to the SD card. You can check out the code at my GitHub repo.

My plan was to log my location every 5 seconds and then post process to figure out all the stats I cared about for my jog. I wanted to know the stats about my pace: average minutes/mile, 1/4 mile split rates. This is incentive for me to jog and try to improve on my time. Maybe a little weird but it works for me.

I looked around to see if anyone had already done anything like this before. As usual I found a lot of things kinda like what I was looking for but no exact matches. So I started with some code written for a Sparkfun tutorial. It had a similar spirit of what I wanted to do - overlay GPS data on a map but not worry about being online. It used a module to parse the GPS NMEA sentences that I logged to the SD card. Thanks to Becky Lewis in the UK for putting together the NMEA parser that was closest to what I wanted. The code I made for myself (before I thought about showing my dirty laundry to the world) iterated until I hand selected the starting point and then the end point of the jog. With the start and end point known, then it calculates my beloved stats. Currently, it has a clunky if a jog else a commute logic section to figure out what kind of GPS track I'm trying to make sense of. I'm thinking of a slicker way to read in bounding box metrics and what map to use with that bounding box. But rather than go down that somewhat clunky sounding road, I might consider using a different module and maybe a web resource to dynamically load map data on a web page?

Going back to the original Sparkfun tutorial post. I see some suggestions in the comment section to try geopy or pymaps. I'll have to go back and check those out.

The Sparkfun tutorial uses matplotlib to plot the GPS data ovelayed on a map that you know the Top Right and Bottom Left Lat/Long. This works well enough but it is not the prettiest of outputs.

For my next rev I would really like to figure out how to plot my progress in a similar way to how Nike+ does it using a heat map style line plot - faster is green slower is red.
All for now. Until the next time ...

No comments:

Post a Comment