Homebrew GPS Tracking

Nothing to say really since the C2C update from January with no race reports to add, what to do, what to mention... 

Last week was sad. We lost our beautiful cat Ernie (Speeding driver).
(Update: Just over a week later, Eric was also gone, hit by another car. I am heartbroken.)

We're going to have to get some new friends for Eric (who is being *very* clingy).

Remain Indoors

Well it's been exactly two years since the event {voiceover *do not talk about the event*}, still mostly good days, the occasional bad day or two, some unpredictable bad headaches, the erratic balance etc etc.... but on the whole, mostly awesome - and still steady constant improvement and progress.
I've just had a celebratory glass of Champagne.

One Up

This week I am running in the Centurion virtual "climbing" event - I've not had a specific target for this really, with the upcoming NDW race I didn't want to compromise that by going for one of the "massive" totals, so just decide to mix it up a bit, mainly run for the height I'll get but don't obsess over it - I don't want to hate it or see any run as a chore.
Mont Blanc looks like it's going to be my completion for the week. It's been good fun though and simply went around and ticked off all the major mountains of the home counties - Box Hill, Wendover Woods, Ashdown Forest, Chalkpit, Botley Hill. Although on Monday I did explore, find a super steep section (~40%) lose footing, descend at speed on backside and manage to sustain impressive running "trail rash" 😲


Having a week off work, decided to do a bit of dabbling in my spare time.
For some time I've wanted a (really) simple tracker to use when I'm out on a long training run or racing so looked around for options and what's available.
I've pondered the options a few times and tried a few alternatives, but nothing quite hits the spot for my needs or usage..

Firstly at the top of the heap there's the Garmin InReach Inmarsat trackers - but that eye-watering monthly price and inflexibility on usage time. Just want to use one on a race? yup sign up for a full month (which will automatically renew if you forget to cancel), want to nip out for a weekend.. yup, month again. So basically since I'd *want* to use it for the occasional day or two pretty much every single month, you're looking at a full yearly subscription.

Then there's Spot trackers (very) slightly lower down the price range... but I'd tried one before (rented) and it was mostly useless and rather unreliable.
There's the "rent a unit" option, but then you need to pre-book, know when you want it, send it back after and so on. So still not ideal for the "oh the weather's good, I'm going to nip out for an explore".

So most of the time I'd just use the Glympse tracker on my phone to keep my position known, but... if I'm out and running I don't want to risk running down my phone battery, and the app isn't particularly useful for trail running with just a basic google map displayed so being able to watch where I'm going or what trail I'm following is 75% guesswork - there's no facility to upload a "guide track".

I'll tell you want I want, what I really really want

I just want a simple self contained device I can turn on, forget about and run with. That. Just. Works.

So. Onto the internet.... (cough, ebay, amazon)

The technology and devices themselves are pretty simple (ignoring the Inmarsat tech here), these days, and after a few searches, there's a big market for "pocket GPS trackers" for "monitoring your children" "aged people" etc. 🙄
Some are/were basic SMS reply boxes, they track location and have an inbuilt phone module, a text message sent to the box will respond with the location, but... technology and mobile internet has advanced in leaps and bounds. There are ridiculously cheap little units that given a data sim, will, when configured will ping back their location to an internet server (albeit to some Chinese one with limited and somewhat rudimentary features)

So, it *should* be possible to jerry up my own tracking server, that way I can customise it to do what I want, I'll understand the detail of how it works and hopefully be able to fix anything that doesn't or at least understand why it's not working, and I've only got myself to blame.

A little more investigation and the landscape is a little bit "wild west" I try to find some sort of "standard" system, but it's all cloned devices, each with the same name e.g. "TK-102" but EVERY SINGLE ONE IS COMPLETELY DIFFERENT!

Whatever, time to take a punt and buy a few to play with. I order a few that seem to have the most professional promotional blurb, but assume that the device being described as "GENUINE" is highly unlikely to be....

Unsurprisingly, when it arrives a mere couple of days later, it is clearly a random variant (despite having original packaging and logos), but looks like it works just fine and comes with a spare battery. (There's even a how to spot a fake website: 'fake or genuine') also reading more many of the clone army are now superior to the original "Xexun" model.

I *wish* I could get hold of one that I could write my own onboard software for, but I think the only way that will be possible would be to build my own, but that's a whole new can of worms (and sunk time) creating a small compact device with battery, charging circuit and so on - perhaps I'll try at some point. But for now, I just want a self contained off-the-shelf device that 'just works'.

Time to roll up the sleeves, work out how it works, and rustle up a little bespoke tracking system.
As you'd expect from a "back of the factory" cloned box, the technical documentation is somewhat vague and sparse... I work through the user manual and work out which commands work, which ones don't, and which aren't covered at all (the tracker takes an sd-card but doesn't include any commands to say *how* to use that feature).

The tracker comes with it's own web tracking support, which has a few "remote control" commands, so... I slap a gateway in between and capture the traffic. Unsurprisingly, again, it doesn't *all* work, e.g. if I try the "set update frequency" command it kills the tracker. Sigh... I'll stick to the "send SMS message" to configure it. for now.

The protocol is basic text and trivial to process and figure out with a bit of sleuthing.
Here in order - it's dumping out date, lat/long position, speed, time, orientation and "overspeed flags" and "mileage" (nope - no idea I suspect this is a side-effect of this primarily being used for "fleet" or "taxi" tracking.) :

*There* you are!
I find a few projects online doing some similar ideas playing with these types of trackers, all with completely different but suspiciously similar protocols, but the ideas and tips are useful.
I decide a basic "node.js" project will be perfectly suited for a server that needs to provide a basic/custom web service and listen to network traffic from the tracker.
Web mapping is just so straightforward now using mapping toolkits like "leaflet"...
Map with NDW trail loaded.
hack. copy. paste. bodge. hack.. et voila! version 0.1 of the ivor tracker. The code needs significant TLC before I publish it anywhere.

The first test outing.
The server listens to the tracker shows current location (version 1 was on a google map).... I've since flipped it to OS mapping when zoomed in.

"I'd be running up that hill
with no problems" ♯♭

After the first "test" outing, I set the updates to 20 second intervals and the battery runs down after 4 hours, I forgot to take the spare battery, or the charging cable - I decide to figure out how to get the battery status....

One evening later! and there it is, I can display current charge on a tooltip.

Mobile tracking.
In the process I discover that the box is also publishing its currently connected GSM cell tower information! I get excited about this and spend another evening playing with it and waving my hands explaining how cool this is... 

When I start telling a disinterested Hugo about it I hear Cara saying to Hugo "sound impressed, he's very excited about it". oh.

After a bit more digging, and learning what MCC's MCN's and LAC's are  I find a way to retrieve GPS locations for a cell tower and manage to get GPS coordinates for my nearby towers, and triangulate the position.... and decide that it's not actually that useful really - I can locate myself within about a 3 mile circle.

Hmm, perhaps I'll think of something useful to do with that sometime.

I try to walk Hugo through the setup, but his only comment was I was very "old school". I think that's a compliment. I'm taking it as a compliment.

Oh well. I'll start polishing the "user experience" - I'm not really a web developer - the basics work, but I want to be able to upload either a "race" route or "training run" and get the track updating as I go.

It doesn't look *that* hard when you see it like that...
Hopefully I'll have it ready to rock for the NDW100.


Popular posts from this blog

seven month update

Tracking running Part #2

back from the brink