< Bicycle Computer

Bicycle Computer / Camera

Bicycle Computer / Camera
What:
A Raspberry Pi based Bicycle computer with camera.
Participants:
{{#arraymap:User:Stuphi|,|x|Has participant::x}}

It is useful when cycling to be able to record rides. Also, immediate feedback on speed and time is useful. Commercial devices are available from companies such as Garmin that work very well.

What is proposed is to use a Raspberry Pi model A with the camera add on, a GPS receiver and an LCD display all housed with a battery pack in a robust cycle mountable case. Software will be used to grab images from the camera, append GPS Location data to the images and file away. At the same time, a GPX track will be recorded and filed away. The LCD display will show current status and simple menu controls via buttons or switches.

Possible advancements could include:

  • A graphics display with maps generated from Openstreetmap data.
  • Computer image processing to record car numberplates.

Initial Goals

  • Get the Raspberry Pi camera module working with an existing Model B Pi.
  • Source a GPS module and get that working with the same Pi.

Useful Information

Notes on GPS module GPS module datasheet

Following is an scad model of the GPS module.

module gpsmodule(){
	union(){
		color("green") difference(){
			cube(size=[55,30,1.6]);
			translate([49.5,18,0]) cylinder(h=6, r=2, center=true, $fn=16);
			translate([5.5,18,0]) cylinder(h=6, r=2, center=true, $fn=16);
		}
		color("white") translate([29,0,1.6]) cube(size=[14,11,5.8]);
		color("Silver") translate([14,4.6,1.6]) union(){
			cube(size=[12,25.4,2.5]);
			translate([6,27.6,0])rotate(a=[-90,0,0])cube(size=[10,10,4.3], center=true);
		}
		color("MidnightBlue") translate([49,6,1.6]) cylinder(h=6, r=5);
		color("MidnightBlue") translate([39,22,1.6]) cylinder(h=6, r=5);
	}
}
gpsmodule();

Initial testing of GPS module seems to work. I managed to get a fix once I moved it into the conservatory.

$GPGGA,210906.000,5051.XXXX,N,00115.XXXX,W,2,06,2.0,38.2,M,47.5,M,1.8,0000*XX

To get this working, I needed to delete any refs to \dev\ttyAMA0 in \boot\cmdline.txt and \etc\inittab

Because I had connected the brown wire, I also needed to raise the pin it was connected to before the GPS would run. Then I started getting messages as above. A fix was made in only a few seconds with a good view of the sky. Similar to my Garmin Etrex. Now all I need to do is write some code that does something useful with this data.

The code to read the GPS data above was a simple Python script. I use the gpio command from Wiring Pi to set the GPS running.

import serial                                                                                                                                       
import time                                                                                                                                         
import os                                                                                                                                           
                                                                                                                                                    
os.system("gpio mode 7 out")                                                                                                                        
os.system("gpio write 7 1")                                                                                                                         
                                                                                                                                                    
def readlineCR(port):                                                                                                                               
    rv = ""                                                                                                                                         
    while True:                                                                                                                                     
        ch = port.read()                                                                                                                            
        if ch=='\r' or ch=='' or ch=='\n':                                                                                                          
            return rv.rstrip()                                                                                                                      
        rv += ch                                                                                                                                    
                                                                                                                                                    
port = serial.Serial("/dev/ttyAMA0", baudrate=9600, timeout=3.0)                                                                                    
                                                                                                                                                    
while True:                                                                                                                                         
    rcv = readlineCR(port)                                                                                                                          
    print rcv
This article is issued from Old-wiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.