Take your GrovePiZero on a bike trip!

Take your GrovePiZero on a bike trip!

Pizero and grovepizero are small enough to take with you when biking!

Street View Bike

The Pizero and GrovePiZero are best buddies on the road, as their size make them perfect for portable projects.

Here we will create a street-view bike which takes a photo per minute, then tags them with GPS data and environment data. At the end you have a collection of tagged photos that can be turned into a quick recap of your trip, and a file that you can get into Google Maps to track your ride.

Street View Bike Presentation

What you'll need for this project:

Useful to have:

  • Cinch SD card
  • Dexter Industries Wifi Dongle
  • JuiceSSH on an Android phone

Nice to have:

GPS data

The Grove GPS sensor is one we don’t use often, but there’s really no reason not to! It plugs into the GrovePi’s, or GrovePiZero’s RPISER port (that stands for Raspberry Pi serial port).

The GPS sensor will give you raw data from the satellites (and also give you this awesome feeling – woah, I’m talking to a satellite!). The difficulty here is handling that raw data, but we have a groveGPS library that is simple to use and will give you the basic functionality.

Available for use are latitude, longitude, and altitude although this project does not record altitude. Time is also given based on UTC (Coordinated Universal Time) so you might want to change that to match your timezone.

Sample code to handle GPS data with the dextergps library
import dextergps
g = dextergps.GROVEGPS()
# get data from GPS
g.read()
# check data validity
if g.lat != -1:
print("{} {}, {} {}, {}, {}".format(g.lat,g.NS,g.lon,g.EW, g.latitude,g.longitude))

This GPS information can be saved in the photo file format, we’re still working on that. In the meantime, it’s being overlayed on each photo, and saved in a CVS type text file.

Temperature and Humidity sensor

This sensor is a straightforward one.

The code is already in the standard grovepi library, and all that’s needed is the following call:

[ temp, hum ] = grovepi.dht(dht_sensor_port,dht_sensor_type)

where dht_sensor_port is the digital port where it’s plugged in
and dht_sensor_type is either 0 (for the blue sensor) or 1 (for the white sensor)

LCD Screen

The LCD screen is not a necessity but it will alert you if there’s an issue with the project, while you’re on the road.

At bootup, a check sequence is run, and the LCD screen gives an output as to what passed and what didn’t. It saved us a few times when the camera cable had got a little loose.  You can remove the screen if you want to. It will save power, and it makes the project even smaller. However we highly recommend it while you’re testing the setup and go through the first few runs.

Taking it on the road for testing with Cinch

On your first few attempts in developing projects like this one, it’s a good idea to use the Dexter Wifi Dongle with a Cinch SD card.

This will turn your setup into a Wifi Access Point, which you can access from your cell phone or tablet.  Once the PiZero is booted up, you should see a new wifi connection called dex.  Connect to it via your phone or tablet (there’s no security on it). Caveat: use a cell phone only if you’re comfortable with the command line. The screen resolution is too small to access the desktop comfortably. We’ve used JuiceSSH with success on an Android phone. If you have a tablet, you don’t need anything, you can simply use a browser to connect to http://dex.local  However the tablet does not let you type in things easily. It got used only to double check the photos.

This setup allows you to start/stop programs, check your photos (on a tablet), and even debug while on the road or in the middle of the forest!

USB Drive

The Pizero only allows one USB device at a time. You get to pick between the WiFi dongle, and the USB drive.  While doing tests, the wifi turned out to be very useful, but writing to the SD card proved dangerous. It’s much safer to write to a USB drive when going on an actual run.

Follow the instructions on techjawab to mount an external drive in a stable way. Before we followed these steps, the usb drive would get renamed once in a while. Those steps worked nicely, but once they’re set, you won’t be able to boot up the Pi without the usb drive in place. Or at least we couldn’t. So do those steps last, when you’re sure that everything else is working.

 

Power

 

As this project is meant to be 100% portable, you will need a power source to take with you. Cell phone chargers are not all created equal, and you don’t want your project to crash mid-way due to a power issue.  In the same vein, if you take this project in a car (it makes a nice dashcam !) the power outlets in old cars were meant for lighting cigarettes and not power raspberry pi projects. New cars are fine.

The Anker PowerCore+ mini is very small, quite powerful and gave good power for many hours.

Getting the Results

After your bike ride, you can remove the USB drive from the Pi and connect it to your computer. You’ll have access to all photos and a trip.csv file.

You can import the trip.csv file into Excel to graph out temperature and humidity (especially fun when you do a camping trip!)

The photos can be used to create an accelerated stop-motion movie.

To get the data into Google maps, go to https://www.google.ca/maps/d/ and click the Create New Map button, then the Import link to get the lat/long into the map.  Photos are a bit more work. At the time of writing this project, the photos themselves don’t contain the geolocation information, so you have to do the linking manually. As soon as the geoinformation gets saved directly into the photos, then a variety of approaches can be used to display the photos onto the map.

 

How to get the code for this project:


The code will be released shortly after the end of the Kickstarter campaign

File Path

How to get the code for this project:

Downloadable File:

Need help?

Have a question or a problem?  Post it on the forums and we’ll help you out.