Hi guys, I’ve had a project idea, and I’d like some advice. I’m probably not the first one to think of it, so apologies if it’s a well-known problem. Basically, I want to combine a GPS with a cellular modem into a mobile device that sends regular lat/long position updates. The next step is plotting that data on a map, so I can see where my device has been over time.
I already have a [Hologram Nova USB cellular modem that works great with a Raspberry Pi. I was thinking of adding a Qwiic pHAT and a Qwiic GPS module to the Pi.
Can anyone recommend a good starting place for someone who wants to use GPS on a Raspberry Pi?
Thanks](Compatibility | Hologram)
Hello LogicUnit.
You’re right you’re not the first person to think about this. It’s been a pretty popular request for tech support for years!
You may find it’s cheaper to buy a pre made GPS tracker that works automatically and can be viewed on a map but if those solutions don’t meet your needs, building one might be the only option for you. Do a quick google search for “cellular gps tracker” and you might find a ready to go solution that’s less expensive than rolling your own. Keep in mind there may be a service fee to keep those running though.
I don’t believe we currently have any Python or Pi code for using a Qwiic enabled GPS with the Pi at the moment, but if you’re comfortable writing that on your own, I’d go with a [SAM-M8Q for a GPS receiver. Sadly, SparkFun can’t assist you with code if you do decide to write your own.
It might be easier to use a serial GPS rather than Qwiic though since there is less code involved to just receive ASCII text via UART. If you want to go serial, the same SAM-M8Q has a serial port that you can gather data from or you could use a serial only GPS like the [GP-20U7 and save a few bucks. For a quick guide on parsing GPS data on the Pi, checkout [this tutorial.](https://tutorials-raspberrypi.com/build-raspberry-pi-gps-location-navigation-device/)](GPS Module - GP1818MK (56 Channel) - GPS-19166 - SparkFun Electronics)](SparkFun GPS Breakout - Chip Antenna, SAM-M8Q (Qwiic) - GPS-15210 - SparkFun Electronics)
So I’ve done some preliminary work, and my first decision is to ditch the Raspberry Pi. I can use a Sparkfun RedBoard with Qwiic to easily attach the GPS module, and then add a LTE shield to provide cellular connectivity. The example code distributed with the libraries gives me virtually everthing I will need to get lat/lon coordinates, and then send them over LTE.
I’ve also done some experimentation with the Google Maps JavaScript API and it’s very easy to create a map, and then add markers using lat/lon coordinates.
Right now, the current problem is how to go from lat/lon messages from the LTE modem to MySQL data on my web server. I’m wondering if there’s a tool that could ingest SMS messages, otherwise I could write a program that opens up a socket and listens for input. Any suggestions about how to do this would be appreciated.
Does anyone know how to add records to a MySQL database over a cellular connection?
Hi, I’ve been fiddling with MySQL on a local network. Chuck Bell’s GitHub page is very helpful, link to that from the MySQL library. What I have noticed in my testing is that the client type is very sensitive, WiFi vs. Ethernet. Cell network may not even be supported, and there’s some connection loss challenges that the code would need to handle properly. Also, been a lot of changes with MySQL v8 on authentication, you may have trouble with the sha1 library.
I’m heading the route of a http post to a PHP page instead. Oh, just noticed this a 3+ year old post, hope you made some progress since!