Page 1 of 1

Raspberry Pi as a bicycle computer

Posted: Sat Mar 04, 2017 12:53 pm
by Leegolais
Hi,

I have a normal bicycel computer (when the magnets are alligned the circuit is closed) and i need a way to controll this with my Raspberry Pi. I want a way to know when the circuit is closed so I can check how many times it does that every minute and from there calculate the speed, how long i have been riding and so on.

Thank you on beforehand.
/Leegolais

Re: Raspberry Pi as a bicycle computer

Posted: Sat Mar 04, 2017 10:26 pm
by SlowBro
You can use any code that reads a switch.

Re: Raspberry Pi as a bicycle computer

Posted: Sun Mar 05, 2017 8:28 am
by DougieLawson
With the speed that a bike wheel runs at it may not be a switch (I'm not sure they'd react quickly enough). It's probably using a hall effect sensor.

I got a reading of 52 miles per hour when I tripped the 40mph speed camera on the way into Brighton off Ditchling Beacon (closed roads for the BHF London to Brighton ride). With a 700C wheel that's 2136 mm (~85 inches) per revolution. 52mph is 3,294,720 inches per hour. So doing the maths that's roughly 646 revs per minute (or 10.7 pulses per second).

Re: Raspberry Pi as a bicycle computer

Posted: Sun Mar 05, 2017 8:49 am
by PiGraham
Whatever sensor your existing cycle computer uses you can use the same magnet to trigger your own sensor. This avoid complictions with signal levels.Likely sensors are:
Reed switch likely to bounce)
Pickup-up coil (not 3.3v logic compatible)
Hall effect sensor

Hall effect should be a good choice. It's robust, has no contact bounce and is availaible in 3.3v logic compatible signal.
Just mount it on the fork where it will detect the wheel magnet.

Re: Raspberry Pi as a bicycle computer

Posted: Sun Mar 05, 2017 8:55 am
by PiGraham
Rather than counted pulses from the sensor every minute you should time between pulses to millisecond resolution and calculate road speed from that. You get a useful speed reading in one or two wheel revolutions rather than waiting for a minute, or waiting for a significant count.

Re: Raspberry Pi as a bicycle computer

Posted: Sun Mar 05, 2017 9:01 am
by wayne.dolesman
There are probably some pointers in this project

http://spectrum.ieee.org/geek-life/hand ... e-computer

Re: Raspberry Pi as a bicycle computer

Posted: Sun Mar 05, 2017 9:02 am
by PiGraham
Bear in mind that a Pi is relatively power-hungry. It will require regular battery charging (I assume you will use USB battery pack), unlike a typical cycle computer that runs for months on a single coin cell battery. That could be OK. If you want better battery life look at a microcontroller with ultra-low power modes and instant start. Pi can't do that.

Also consider that Raspbian has a boot time of 30 to 60 seconds, so you may have to wait before setting off or lose bit of your ride while the Pi wakes up.

You could consider an eink display for low power and daylight readability. Search PaPiRus

Re: Raspberry Pi as a bicycle computer

Posted: Sun Mar 05, 2017 11:12 am
by Leegolais
Thanks guys, I will see if i can make it work. Not really sure which GPIO pins to connect to, so got to do some google search. Comming back with more questions if i can't find out how to do it :)

Re: Raspberry Pi as a bicycle computer

Posted: Sun Mar 05, 2017 10:19 pm
by geoffr
DougieLawson wrote:With the speed that a bike wheel runs at it may not be a switch (I'm not sure they'd react quickly enough). It's probably using a hall effect sensor.

I got a reading of 52 miles per hour when I tripped the 40mph speed camera on the way into Brighton off Ditchling Beacon (closed roads for the BHF London to Brighton ride). With a 700C wheel that's 2136 mm (~85 inches) per revolution. 52mph is 3,294,720 inches per hour. So doing the maths that's roughly 646 revs per minute (or 10.7 pulses per second).
This is something that surprised me: with a reed switch, you can generally hear the contact closing when the magnet passes.
Even on "expensive" sensors like the Garmin GSC10, the sensor is still using a reed switch. I wonder if that has to do with the fact that many Hall Effect Sensors expect a 5V or greater supply, but the GSC10 uses a CR2032 battery. Surely there would be Hall Effect Sensors that run on 3V?