The Katy Trail Bike Pi

Posted on Dec 15, 2018

Alright for those of you that do not live in the KS/MO area and know about the Katy Trail here is a site for you. ( bikekatytrail.com ). The short version: This bike trail runs along the former Katy RailRoad line and is about 250 miles long from Machens, MO to Clinton, MO. My wife and I have done several pieces of the route, but in a couple of weeks the whole thing will be attempted over a week. We have some friends coming in to town that will be accompanying us along the trek. I had an idea to document the trip via photos for them taken along the way and that is where the Raspberry Pi comes into the story.

Pieces of the puzzle:

  • Raspberry Pi Zero
  • Pi Camera module
  • RPi Zero case with the camera hole
  • GPS module
  • Bike Mount

So, like I said I wanted to document the trek down the Katy trail with the end goal of doing a couple of things.

1) Create a time lapse video of the photos that were taken along the ride.

2) GEO Locate the pictures so they could see the progress along the ride with the photos and where it was taken.

So, lets get started.

First I had to find a way to mount a computer … as luck would have it, I found a solution at the local bike store for about $20. I used a generic bike computer mount and stuck the receiver on the back of a RPi Zero case.

From searching around I found this pretty cheap micro USB GPS dongle.

I just let it hang on top of the handlebars since that seems to work just fine without having to attach it to anything besides the Pi and once around the handlebars.

This allows me to take it on and off. I had to add the rubber bands to keep the cover on. We discovered on one of my test runs that the front can pop off. So, that was easy … next how to get GPS data.

Now, after the Pi is mounted I connected a 4000 mAmp battery to it and from my testing it kept the Pi working for 12 hrs. And btw, this is about 10 hrs more than we will be on a bike. I setup a cron job that executes a python program I wrote ( 10 min intervals ) to read the gps data, take a picture and add the gps data to the photo and save it. I learned that there are two modes on the gps mode 3 is the ideal one since it can tell you speed, altitude, etc whereas mode 2 does not include these data points. No big deal I just made sure to hopefully code around it properly.

That is about it for now until we take it on the road and I stitch together a time lapse video. I’m interested to see how all of this works when I get a bunch of still photos to combine.

If anyone is interested in the code just send me a message and I’d be happy to share.