A GPS Module https://www.sparkfun.com/products/11058
An antenna https://www.sparkfun.com/products/464
A Raspberry Pi (preferably the newest Pi 3 since I know it works) https://www.adafruit.com/products/3055? ... oCQNrw_wcB
Breadboard cables https://www.amazon.com/gp/product/B00M5 ... UTF8&psc=1
Optionally, a 3.3V USB to UART (LVTTL) https://www.amazon.com/gp/product/B00SL ... UTF8&psc=1 (or similar) This makes configuring the GPS easier
A 12V to USB cigarette adapter and USB cable of your choosing
A USB mouse, keyboard, and HDMI monitor for working with the Pi
So first off, the "why?"
If you've ever tried to look at your line through a track, you've probably noticed that it's not very useful:
Here's a corner from one track in Texas using my Galaxy S5's onboard GPS (1Hz). Pretty useless, with some accelerometer data and speed, but wildly spread out and pretty inaccurate.
![Image](http://i1305.photobucket.com/albums/s549/Drewster1107/LapTimer_slow_zpsqompqsij.jpg)
Here's what a different track looks like (zoomed out a bit) with (true) 20hz GPS - with a fast enough interface (wi-fi)
![Image](http://i1305.photobucket.com/albums/s549/Drewster1107/LapTimer_fast_zpsvx7ieyhb.jpg)
Obviously, the first thing you see is that it's immediately obvious what line was taken. Did I apex early for my best lap? But another thing that's better is there's WAY more detail in acceleration, etc. - you can even see how long I was decelerating, for instance.
Pretty f'n awesome for something that costs about what a GPS of half the speed will run you (a little less if you already have a few of these lying around).. so let's get onto the "how".
The basic idea is:
[GPS}--UART-->[Pi]--Wi-Fi(via Pi)-->HLT
The GPS itself is configured from and outputs using 3.3V serial, AKA UART. You have to make sure that any voltage you give to it is 3.3V, otherwise you'll fry it.
1) Get your GPS configured to output 20Hz. You can totally do this with serial commands, which I encourage you to do! However the fastest way to get the GPS outputting at max speed is using the included software (found on the SFE site) and a USB to serial converter. Just make sure you save the settings to FLASH so it runs at 20Hz every time it boots up (it can take a while if you're indoors)
-Set Baud to the max of 115200
-Set Update rate to 20Hz
Using the provided software on your PC, it'll be seriously easy to configure and see that it's working
2) Configure your Raspberry Pi's serial interface. For the most part, I used Python to do most of this since it is by *far* the most simple way to interface with low-level peripherals, but of course the sky is the limit with that little thing.
-Set up serial. PySerial is your friend here, and Lady ADA is, too - https://learn.adafruit.com/adafruit-ult ... ead-of-usb The UART interface on the Pi 3 is /dev/ttyS0! For any write-ups, NOT AMA0
-Keep in mind that the Pi 3 uses UART to provide a console if you don't have a monitor, etc. - you need to disable it so console messages don't screw with your GPS
-The Pi 3 also changes its clock speeds and doesn't account for how they affect the UART clock. you can account for this and read about it here http://raspberrypi.stackexchange.com/qu ... pberry-pi3
The actual connection here is super simple - just make sure to use 3.3V:
![Image](http://i1305.photobucket.com/albums/s549/Drewster1107/20161015_085636_zps93steggt.jpg)
Using Python you can really easily check and see that your serial interface is working using something like this:
Code: Select all
#import the serial library so we can talk to the GPS
import serial
#Define the interface - you should have already configured the GPS using the included software if you took the easy road
ser = serial.Serial(port='/dev/ttyS0', baudrate = 115200, timeout = 1)
#While the port is open, display what's being sent - we should see NMEA sentences scream through the terminal
while ser.isOpen():
line = ser.readline()
print line
#If you see gibberish, chances are the baud rate is mis-matched. If the messages come once every second, the update rate wasn't set correctly
#Press ctrl+z to stop the script
-Most of this is done with hostapd, which you can read about here: https://frillip.com/using-your-raspberr ... h-hostapd/
4) Once you have the network up, use sockets to stream the data to the App. https://docs.python.org/2/library/socketserver.html
-The port definition used here is used on HLT!
-There's lots of stuff out there on how to do this - but you can test this by using .listen() and connecting to the port with PuTTY with another computer. Once the socket is connected, start sending it data! HLT is cool in that you can pretty much just use getline() from serial and blast it over the socket
-Be careful and make backups of the files you change! You're editing the Pi's hardware configuration, and while it'll work great to host an isolated Wi-Fi connection, you have to keep in mind that (if you don't give it a main IP to route everything to) it has no real internet connection via Wi-Fi once these settings take effect. Without an Ethernet cable, it's like plugging in a router by itself.
5) Configure the Pi to run the script on boot.
-Be sure to try this out a few times while you have a monitor! Keep in mind that if you go to your home screen (or something) HLT will close the pipe to the Pi and cause an error. You need to wait until a device connects again, otherwise it'll crash
-Make sure that you configure HLT, set the track up, etc. before you connect to the Pi's network. Otherwise, the app will try to download POI's when there's no IP connection! If you configure the track, etc. THEN open up Wi-Fi, the app should find the device, and you should be good to go- but this takes some practice.
That's it for now! Those are pretty much the building blocks that I dug up, and I'm hoping that it stirs some interest in those of you looking to do something similar. I'll post more information and elaborate soon, but I hope that you try it out if you're interested and post problems/ suggestions!