Manage and display locations of GPS tracking devices
This was from my demo system just before decomissioning, with live data from my actual device.
My motorcycle was stolen, and I really wished I had a way to track it down.
I knew it had an OBDII port (like most cars, not so many bikes), which I had previously used to flash the ECU and log engine data, and thought, wouldn't it be cool if it was fitted with a GPS tracker which just plugged into that (i.e. no cutting/soldering required).
I found just such devices (specifically the Coban GPS306) available on eBay for USD$60 and bought one.
By default the devices come configured to use www.gpstrackerxy.com. That system is hosted by some unknown-to-me company in China, plus you only get 30 days free access.
The other open source solutions out there looked ugly, heavy, or clunky. So I made my own.
So the primary use case is: "as myself, I want to find where my bike is, so that I can get it the hell back" =)
Currently the device gateway handles device initialization, heartbeat, and location request/response.
Now I have the basics working (location request/report/view on map), I've stopped active development. The main reason for this is that I can't see they system being widely useful to myself or others (I now keep my bike locked in the garage). Still, it was a fun thing to do.
Currently only works for the Coban GPS306, since that's what I bought.
HOWEVER - the system /is/ architected to make additional device support easy to add.
For anyone interested, the other things I thought would be cool to do are on the Trello board
GPS Tracker Device <--> Device Gateway <--> MongoDB <--> REST API <--> Web Frontend
These devices use GPRS (so you need a SIM with some credit) to talk over the net to an admin server (which I call "device gateway") via TCP or UDP.
The protocols are pretty simple strings containing commands (e.g. send me your location) and responses (e.g. my location is lat.x long.y)
You configure them by sending an SMS
e.g. to tell my device to use my home gateway, I sent it an SMS containing "adminip8888 59.167.194.249 9000" (9000 is the port)
After that, it's talking to my device gateway.
TCP socket server using gevent, mongoengine for ODM/ORM
The gateway can send commands to the devices (mongodb used to store these, as well as all other data)
Then there's a REST API (python flask, mongoengine for ORM/ODM) talking to the DB
I did initially try eve-mongoengine and flask-mongorest. Though they were great to quickly get basics up, I found them too restrictive (plus, from past experience I know the latter has some serious bugs and is horribly unmaintained).
Plus - for Version Zero I only needed a few endpoints quickly knocked up, hence DIY!
Angular, Bootstrap, Jade, Sass, Bower, Gulp
TBH web's not my strong point, but with these excellent tools I managed!
This is very shorthand and assumes you're familiar with the stuff in use.
Using virtualenv recommended = no system-wide packages
mkdir venv && virtualenv venv/gps
. venv/gps/bin/activate
pip install -r requirements.txt
Nothing fancy yet!
. venv/gps/bin/activate
./device_gateway.py
Should now be listening on port 9000
In another tab: cat sample-reqs/tkip102-1.txt | nc localhost 9000
With virtualenv activated, from repo root just run 'nosetests'
- Collection of docs on the GPS tracker devices by Barbu Dor (thanks Barbu!)
- Trello board for this project
- TK103 GPS Tracker
- Traccar - much more fully-fledged open source server, Java
- my-GPS - free hosted solution (web signup didn't work for me when I tried it ...) - PHP
- OpenGTS - widely-used, open source, Java