Mixing Computer Science and Motorcycles Pt. 1

Historically, my personality hasn’t lent itself to half-measures when I’m interested in something. I very much prefer “go big or go home” as an approach to hobbies. My sportbikes find their way to racetracks, my KTM was offroad within 3 hours of purchase, and every spring when I start hiking I get scolded for dragging poor Audrea to the steepest hill I can find in my eagerness to find a challenge. To that end, my first Raspberry Pi project is shaping up to follow that pattern.

A couple of weeks ago I was invited to walk through a network security company by one of their directors. In the course of that walkthrough (which was incredibly interesting), it was pointed out to me that a Raspberry Pi project would teach me quite a bit about Linux, and programming in general. For $50 that seemed like an obvious purchase.

Raspberry Pi kit

$49.99 for a computer. Not a bad deal at all.

Incidentally, during that same walkthrough, the gentleman who invited me in happened to touch on a problem I’d encountered a few years before concerning tracking movement outside of cell phone service areas . He was concerned that his son, who had recently begun riding a motorcycle, would find himself crashed somewhere outside of cell service with no way to call for help. I immediately informed him of my Delorme InReach Communicator, which I’d purchased about 18 months ago for riding in the backcountry. It’s basically a communicating and tracking device the size of a small walkie-talkie with text messaging and GPS tracking capability. It’s a fantastic device that has saved me from deep trouble at least once when my phone decided it didn’t want to stay with my motorcycle deep in the backcountry about an hour before I was supposed to meet up with Audrea in Eastern Washington.

delorme

$269 plus $30/month. Expensive, but worth it.

Over the next couple of days as I waited for my Raspberry Pi to arrive I couldn’t quite shake the idea that the functions of the Delorme unit could be duplicated, if not improved, using tools available for the Pi. I thought about it for a few days as I waited for my SD card reader USB drive to come in the mail (Thanks, Windows 10 upgrade, for ruining my computer’s built in reader) and came up with a rough idea for a project.

The general idea is that by utilizing a Raspberry Pi unit attached to the glove box in my KTM could collect data from a GPS tracking device (USGlobalSat BU353-S4 USB GPS Receiver – $29.95) and an accelerometer (BerryIMU-accelerometer, gyroscope, magnetometer -$25) to provide rough telemetry data and GPS track any time the bike were turned on. That would lead to my next problem: How do you transmit data from a moving motorcycle in the middle of nowhere to a server or even just my laptop? If that could be done, could it be possible to set G-force/shock limits for the accelerometer to indicate a crash? If that were possible, could a message be transmitted to that server/computer that would send out alerts to a pre-determined list of contacts with my exact GPS coordinates, accident data, and current attitude of the bike (upright vs on its side)? Other things that could eventually be incorporated over time include a real-time fuel-air mixture reading to check tuning, a dashcam, Google Hangouts-based text messaging, and an emergency button to contact family or emergency services should I find myself stranded without crashing.

Keep in mind where I’m riding and my caution starts to make sense.

Clearly I was getting out of my depth. I like writing code and tinkering with stuff, but for this I had to contact the only person I knew who had actually built a tracking app that did a cell-based version of what I was thinking: The son of the man who took me on the walkthrough.

Yesterday I wrote out all of my questions in a Facebook message, and to my delight received not only a confirmation that this was possible, but a huge list (with links) of relevant hardware and software, similar projects, his code for his mapping app, as well as meeting dates/times for Linux user groups in the Seattle area. In short, Jack made my life significantly easier. (Thanks again, Jack!)

This morning I woke up and went to work on figuring out what order I wanted to address the long list of challenges ahead of me. I’d need to buy a bunch of hardware, rewire the electrical system on my bike (and ensure the power draw wouldn’t drain my battery), arrange battery backup for the RP unit if the bike’s electrical system fails, figure out how to get the information to sync up with each other element so that the data output stream was consistent, figure out how to use the satellite communicator to send a stream of information to a server, add a touchscreen or pair the Pi to my phone via Bluetooth, then figure out the limits to determine when a mass-email or text would be sent to my emergency contacts.

KTM_990_ABSRouting2_zps4a920b54

I’m sure I can figure out the KTM’s electrical system diagrams. Yep. 100% certain. Where do you enter the maze? Is there like a golf cart I can ride through it?

I’m sure there’s a lot more, but for now this is where I find myself today.

A few minutes ago I ordered the GPS unit from Amazon. It seems smart to tackle one problem at a time instead of trying to build it all at once and try to figure out what the hell’s going on. If I can get one thing at a time working and slowly incorporated into the broader scheme, this project becomes more manageable, so that’s what I’ll do.

I suppose I could have just downloaded a Super Nintendo emulator to the Raspberry Pi and played Super Mario Bros on it, but that doesn’t match my approach to hobbies. A huge mountain of technical learning, programming, hardware modifications, and satellite interface seems to be more my speed.

Go big or go home, I guess.

Next steps:

  1. Wait for GPS unit to arrive.
  2. Wire up the Raspberry Pi to run while my motorcycle is on.
  3. Learn how to overlay the GPS data over the open-source map display from OpenStreetMap.org.
  4. Find way to turn collected GPS data into GPS tracks for my Garmin.
  5. Once everything else on this list is complete, start in on the accelerometer.
20140823_153711

By the time this project is done, I should be able to send an email from here with my precise coordinates to let folks know I’m OK and have just stopped for the night so I can keep looking at that view.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s