Leegolais
Posts: 2
Joined: Sat Mar 04, 2017 12:38 pm

Raspberry Pi as a bicycle computer

Sat Mar 04, 2017 12:53 pm

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

User avatar
SlowBro
Posts: 164
Joined: Sat Feb 18, 2017 1:30 am

Re: Raspberry Pi as a bicycle computer

Sat Mar 04, 2017 10:26 pm

You can use any code that reads a switch.

User avatar
DougieLawson
Posts: 36123
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Raspberry Pi as a bicycle computer

Sun Mar 05, 2017 8:28 am

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).
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

PiGraham
Posts: 3604
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Raspberry Pi as a bicycle computer

Sun Mar 05, 2017 8:49 am

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.

PiGraham
Posts: 3604
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Raspberry Pi as a bicycle computer

Sun Mar 05, 2017 8:55 am

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.

wayne.dolesman
Posts: 64
Joined: Sat Feb 25, 2017 8:10 am

Re: Raspberry Pi as a bicycle computer

Sun Mar 05, 2017 9:01 am

There are probably some pointers in this project

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

PiGraham
Posts: 3604
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Raspberry Pi as a bicycle computer

Sun Mar 05, 2017 9:02 am

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

Leegolais
Posts: 2
Joined: Sat Mar 04, 2017 12:38 pm

Re: Raspberry Pi as a bicycle computer

Sun Mar 05, 2017 11:12 am

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 :)

geoffr
Posts: 85
Joined: Wed Aug 22, 2012 11:25 am
Location: Melbourne, VIC

Re: Raspberry Pi as a bicycle computer

Sun Mar 05, 2017 10:19 pm

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?

Return to “General discussion”