iOS: TrackMe

A while back I posted a couple of entries about Swift (here and here) and I stated:

Despite my initial misgivings of Swift (these posts have been on the negative side), I know I’ll end up developing with it.

Well done smarty-pants me! I’m now actively using Swift for some iOS development.

I always like to approach using different bits of tech in a way that is either of some use to me personally (see LearnAWord), or just a bit of a laugh (see ILoveTwitterLamp). This particular app is mostly in the first camp, but a little in the second.

Being a biker, I like to go for rides and explore the countryside a bit – have a look at a map and just pick a general direction to ride in. I’ll put my proper Garmin GPS in my bag as a “just-in-case” measure, but it’s definitely more fun not having some device doing all the navigation for you sometimes. Of course this all goes out the window when you have somewhere specific to be 🙂

Often it’s annoying to come back from a ride and realise you’re really not sure where that great little off-the-beaten-track section of road was, or maybe you can only remember the route again if you were riding it, rather than being able to skip a bit out and head straight to the good stuff. This led me to start developing a little tracking app I can set running on my phone that stores my GPS locations as I ride – and I can view the routes I’ve taken (See the red line in the image below, of a route being simulated in the iOS simulator).

TrackMe Prototype showing a polyline being rendered at the tracked coord points.

TrackMe Prototype showing a polyline being rendered at the tracked coord points.

Admittedly, I can view a large amount of my route history on my normal GPS device, but I can’t really do anything with that data, other than view a cruddy pink line on a cruddy little screen. I have tried getting the data off the SD card, but even the export menu is next to useless.

With this system I can track where I go and (ultimately) share this data via iCloud docs too I hope. This means I’ll be able to create some sort of “Desktop viewing app” for all the routes I save on my iPhone. Of course I’ll add tagging for points of interest and the like to the app too.

Addendum

You may be asking why I don’t just use my iPhone as my GPS unit on my motorbike. Simple answer: I live in the UK, Manchester no less. It rains here on the majority of days (I’m not kidding, see this post on the Guardian!) and I just don’t trust waterproof cases with my very expensive phone. I do however trust my specifically engineered Garmin Motorcycle GPS unit, that I’ve inadvertantly dropped-kicked across many a carpark, to do the job

A Busy Month and Some Bike Related Raspberry Pi Stuff!

A bit of a delay on this update due to a rather hectic last month 4 weeks or so. Students are back in their masses and alas the day job really eats into my hacking time. The very cheek of it! 🙂

Thankfully this isn’t a downbeat post, rather it’s the first showing of what is one of my most favourite Raspberry Pi projects to date! It’s a mashup between my two major hobbies of coding/hardware and motorbiking.

Lean Sensor UI

What you’re looking at is a lean sensor and display, with the intended use being to see lean angles in real time on a motorcycle. Naturally it’s using an RPi at the core of it, here’s the current features run-down:

Hardware:

  • 4″ Screen in waterproof case with handlebar mount
  • RCA connection from the RPi to the screen
  • MPU6050 chip which provides the gyroscope…
  • … connected via i2c to the RPi via the Pi Cobbler

Software:

  • PyGame providing the simple rendering output
  • Left/Right lean angles shown on top corners, with an arc showing the lean angle by a circle indicator
  • The large number visible is the top lean angle value in the last 5 second window
  • Detection of “spikes” of data against threshold values (per sample check for unexpectedly high degrees-of-change per second)
  • When spikes are detected you simply need to pass that axis back through 0 degrees to reset it (the indicator circle on the screen will lock in place and light up yellow to indicate the issue). On a bike you just need to level back up again, nothing more. This may seem like it’ll be annoying on the road but in practise it should happen without fuss and be largely unnoticeable – and really help to ensure you aren’t seeing duff values on the screen.

Additionally to what you see in the photo, the system now has a switch to press to set the zero-point for the gyro (basically a case of “please take the current gyro scope values as if they were all 0, the default state” – this means you don’t need to worry too much about the mounting of the system on the motorbike)

The MPU6050 chip I’m using is a cracking piece of kit. For less than £5 (tip: go to eBay, ignore the like of Cool Compoments/Sparkfun etc, they are a rip-off for this) you get a gyroscope, accelerometer and temperature sensor all in one board with a simple i2c interface so it’ll work with RPi or Arduino with hopefully minimal fuss. I’m really pleased with the performance of the gyroscope, it’s not noisy at all when dealing with whole-degree increments.

I’m still at the bench-test stage for this project (The last piece of the jigsaw being deciding on exactly how to power everything on the motorbike: whether I do it directly off the battery or provide my own power system…) so I’m focusing on getting the software nice and stable for the first real-world test in the coming week or two I hope. Nothing to put up on GitHub yet, but it’s not far off. If you’re picking up the MPU6050 I suggest you look here for some great Python code to get you up and running: https://github.com/cTn-dev/PyComms

I suppose in summary I’ve developed something which is sure to encourage me to low-side my bike sometime in the not-so-distant future… d’oh!

Some more bike stuff to distract :)

Just a few photo updates today, nothing major I’m afraid.

Some cat took a liking to my bike. It had seemingly walked up the side, onto the seat and then on to the top box(?!)

Some cat took a liking to my bike

Some cat took a liking to my bike

I got some new hand guards that have little lights across the front of them too. I haven’t wired them up yet but they look good on the bike. I’m a big fan of hand guards for filtering through traffic, if you’ve ever seen someone tap their brake lever against something at any speed (happens in racing with horrible results – most like to happen with wing mirrors on the road) you’ll appreciate the use of these on road bikes.

New handguards with inbuilt lights.

New hand guards with inbuilt lights.

Handguards fitted to the bike

Hand guards fitted to the bike

Versys 1000 is here!

Picked up the Versys 1000 today, boom! 🙂 Remember I said it was raining? Well it still is 😦 Ended up just taking a longish route home rather than a full-on ride out. Weather is looking dry for the weekend, so should get to put some miles on it then.

I spent my afternoon putting a luggage rack for a Givi topbox on it and hooking up my heated gloves wiring harness. I also spent an absolute age finding the accessory wire that Kawasaki decided to hide by taping it right behind the instrument panel (why?!). Ultimately I took off one side fairing, the screen and a few additional bolts just to get some leverage to access the tape holding the wires in place. Not cool Kawasaki, not cool. Hey, at least the wires are free to use now 😀

Versys 1000

My new motorbike! Totally psyched about picking this up soon. I’m away over Christmas so I have to wait until the New Year before I get a chance to pick it up and probably put a silly number of miles on it very quickly 🙂 Long term plan is to take it touring Europe, the Versys 650 I have currently was very well behaved doing Ireland and Scotland in the last few years, but I just felt like I was having to ride it a bit hard with 2 up and full luggage. The 1ltr engine behind this should see me well 🙂

The new beast!

The new beast!

The new beat!

The new beat!