StefanGriffiths
Posts: 25
Joined: Sun Aug 06, 2017 12:14 pm

Cycling Sensors for Cycling Computer

Sun Aug 06, 2017 12:18 pm

Hi,

For my 3rd year Dissertation I'm making a cycling computer using a "Raspberry Pi" and I had a question.

What type of motion sensors would I need to have to go on the wheels of my bike that register with a raspberry pi, I need to be able to record the speed at which I'm travelling.

Any suggestions would be great.

Many Thanks

User avatar
bitbank
Posts: 248
Joined: Sat Nov 07, 2015 8:01 am
Location: Sarasota, Florida
Contact: Website

Re: Cycling Sensors for Cycling Computer

Sun Aug 06, 2017 5:36 pm

Something like this would work:

http://www.ebay.com/itm/IR-Optical-Limi ... 2749.l2649

You can look at my pi_car project for the code to talk to it. You set up a GPIO interrupt and count the pulses in the callback routine.

https://github.com/bitbank2/pi_car
The fastest code is none at all :)

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

Re: Cycling Sensors for Cycling Computer

Sun Aug 06, 2017 6:39 pm

Use a hall-effect sensor with a magnet on a spoke.

You can then use wheel size and 3.141592 (π) to determine how far you've moved in one revolution. https://www.sheldonbrown.com/cyclecompu ... ation.html gives 2097mm for my 700*23c road wheels.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

User avatar
aTao
Posts: 1084
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: Cycling Sensors for Cycling Computer

Sun Aug 06, 2017 7:39 pm

DougieLawson wrote:
Sun Aug 06, 2017 6:39 pm
Use a hall-effect sensor with a magnet on a spoke.

You can then use wheel size and 3.141592 (π) to determine how far you've moved in one revolution. https://www.sheldonbrown.com/cyclecompu ... ation.html gives 2097mm for my 700*23c road wheels.
No, you cant! The outer edge of a bicycle tyre is not a circle, and you will not measure its diameter that accurately.

Any way, when I were a lad we used to clothes peg a card to the frame so every spoke hit it... Calibrate pitch of thrrrrap to a measured distance

But seriously, as Dougie says, hall effect is most reliable, but do calibrate it over a known distance since wheel measurements can be misleading.
>)))'><'(((<

drgeoff
Posts: 8633
Joined: Wed Jan 25, 2012 6:39 pm

Re: Cycling Sensors for Cycling Computer

Sun Aug 06, 2017 7:51 pm

Many of the cheap cycle computers use a magnet and a reed switch. In a quiet room with the bike upside-down, move the wheel backwards and forwards with the magnet near the sensor and you can hear the reed switch click as it makes and breaks.

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

Re: Cycling Sensors for Cycling Computer

Sun Aug 06, 2017 8:06 pm

aTao wrote:
Sun Aug 06, 2017 7:39 pm
No, you cant! The outer edge of a bicycle tyre is not a circle, and you will not measure its diameter that accurately.
You know that, I know that. But it's a pain to mark a straight line, mark a point on the tyre where it touches the road, move the bike along the line until the point on the tyre touches again. Then measure distance (when the website I found has done all that stuff and produced average values for average wheel sizes).
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

User avatar
bensimmo
Posts: 3343
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Cycling Sensors for Cycling Computer

Sun Aug 06, 2017 9:22 pm

All sorts of methods.
Traditionally a roller on the tyre turning a wire cable, then a reed switch and magnet.
Now Hall effects, lasers, GPS, whatever you can imagine and try.


Reed switch is dead easy, it's just a 'switch' on/off and has worked for many many years for front, rear and cranks speed/cadence measurements.


Either use tables to get the tyre diameter, most 'speedos' BiTD came with tables of values e.g. https://www.cateye.com/files/manual_dl/ ... 0_v7_E.pdf or good old* Sheldons site (or mark and ride on a few turns and average it out) That methods been around since I was small and probably before that, and that's BBC Micro era.

Forgive me but what age is "3rd year Dissertation" as it doesn't sound a lot for a Final year Degree course (which is what I know as that)



*well dead :-(

danjperron
Posts: 3076
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Cycling Sensors for Cycling Computer

Sun Aug 06, 2017 9:34 pm

I did a small python code with a small sensor on this post!

viewtopic.php?p=812499#p812499

It is quite simple anyway!

User avatar
aTao
Posts: 1084
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: Cycling Sensors for Cycling Computer

Sun Aug 06, 2017 11:24 pm

DougieLawson wrote:
Sun Aug 06, 2017 8:06 pm
aTao wrote:
Sun Aug 06, 2017 7:39 pm
No, you cant! The outer edge of a bicycle tyre is not a circle, and you will not measure its diameter that accurately.
You know that, I know that. But it's a pain to mark a straight line, mark a point on the tyre where it touches the road, move the bike along the line until the point on the tyre touches again. Then measure distance (when the website I found has done all that stuff and produced average values for average wheel sizes).
was think more "measured mile" than one rotation.... As well as average wheel sizes, it also includes... err... cyclist's girth.
>)))'><'(((<

StefanGriffiths
Posts: 25
Joined: Sun Aug 06, 2017 12:14 pm

Re: Cycling Sensors for Cycling Computer

Mon Oct 02, 2017 4:13 pm

What Model would be best for a cycling computer, because from what ive looked at the Raspberry Pi Model 3 satisfies what I need for the cycling computer?

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

Re: Cycling Sensors for Cycling Computer

Mon Oct 02, 2017 4:32 pm

StefanGriffiths wrote:
Mon Oct 02, 2017 4:13 pm
What Model would be best for a cycling computer, because from what ive looked at the Raspberry Pi Model 3 satisfies what I need for the cycling computer?
Model 3 is OK. Pi Zero uses less power which gives longer life on batteries. Any model Pi will have limited life on battery compared to a typical bicycle computer.

scotty101
Posts: 3185
Joined: Fri Jun 08, 2012 6:03 pm

Re: Cycling Sensors for Cycling Computer

Mon Oct 02, 2017 4:48 pm

StefanGriffiths wrote:
Mon Oct 02, 2017 4:13 pm
What Model would be best for a cycling computer, because from what ive looked at the Raspberry Pi Model 3 satisfies what I need for the cycling computer?
At Uni we made a cycle computer for our second year Real Time Operating System course using a Freescale 68HC12 microcontroller* which is significantly less powerful than any of the raspberry pi's. Any model of Pi would be capable of this.
As PiGraham has mentioned, if battery life is a concern for you project, you might be better off using a Pi Zero or a much simpler microcontroller, perhaps an arduino.

*Even the 68HC12 was overkill for this application.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

User avatar
bensimmo
Posts: 3343
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Cycling Sensors for Cycling Computer

Mon Oct 02, 2017 8:34 pm

Any, cheapest possible really.
But it depends how far you wish to take it I guess.
Want WiFi or Bluetooth then you need the Pi3 or ZeroW for ease of use.


Personally I would go Zero/ZeroW.

----

Of course you can then add GPS to log routes.
Accelerometers to see what you can get from that.

Pedaling cadence (similar to wheel velocity).Strain gauges, suspension travel measurements, Bluetooth air valve pressure. Temperature and barometers, pressure...

Possibly ANT connected devices (no idea on this, but that's Bluetooth).

Remote readings, light charge checking etc...
Fun light control, auto turn on, dim and even indicators etc.

Oh and possibly a display.

User avatar
przemof
Posts: 133
Joined: Mon Dec 30, 2013 6:43 pm

Re: Cycling Sensors for Cycling Computer

Mon Sep 24, 2018 10:04 pm

I use pi zero w + BLE speed and cadence sensors and a few more for heart rate, pressure/altitude, temperature, GPS & more. Keeping all exceptions from bluepy under control was a major challenge. Code is here: https://github.com/PrzemoF/Open-Cycling-Computer

User avatar
Imperf3kt
Posts: 1386
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: Cycling Sensors for Cycling Computer

Mon Sep 24, 2018 10:20 pm

I do not suggest a Pi3b or Pi3b+, you'll have a lot of difficulty powering it reliably.

The Pi0w looks like a great option, to me. Might try this myself, my bike has sat in the garage ever since I bought it. (It does have a computer on it which somehow still runs on the same batteries it came with several years ago), but all it does is tell me my speed, average speed, top speed, km travelled and the time.
Last edited by Imperf3kt on Tue Sep 25, 2018 12:00 am, edited 1 time in total.
Stop plugging your fan directly into the GPIO 5v
https://www.electronics-tutorials.ws/power/transient-suppression.html

LTolledo
Posts: 736
Joined: Sat Mar 17, 2018 7:29 am

Re: Cycling Sensors for Cycling Computer

Mon Sep 24, 2018 10:30 pm

For a DIY project looks interesting and challenging... and fun time doing it.

however an off-the-shelf cycling computer with Bluetooth and/or ANT+ would probably be cheaper and less troublesome than the RPiZW version.
have several for my road bikes (road-racer bikes).

but then again nobody is stopping anyone from doing the challenge..... ;)
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

User avatar
przemof
Posts: 133
Joined: Mon Dec 30, 2013 6:43 pm

Re: Cycling Sensors for Cycling Computer

Mon Sep 24, 2018 10:44 pm

Considering how much time and money I've spent doing it... I could probably buy a large box of top line garmins :D
Anyway, I'll take over the market of cycling computers when the project is finished ;)

energyi
Posts: 79
Joined: Tue Mar 24, 2015 9:39 pm

Re: Cycling Sensors for Cycling Computer

Wed Sep 26, 2018 10:33 pm

Just a heads up that the Pi Zero has a camera ribbon cable slot to add a relatively inexpensive camera to the zero. It would record the rides as well as provide bike computer info.

energyi
energyi

energyi
Posts: 79
Joined: Tue Mar 24, 2015 9:39 pm

Re: Cycling Sensors for Cycling Computer

Wed Oct 17, 2018 8:08 pm

energyi wrote:
Wed Sep 26, 2018 10:33 pm
Just a heads up that the Pi Zero has a camera ribbon cable slot to add a relatively inexpensive camera to the zero. It would record the rides as well as provide bike computer info.

energyi
Even less expensive route for Rpi0 video: viewtopic.php?f=63&t=224714
energyi

User avatar
przemof
Posts: 133
Joined: Mon Dec 30, 2013 6:43 pm

Re: Cycling Sensors for Cycling Computer

Wed Oct 17, 2018 8:20 pm

Interesting idea - thanks!

Return to “General discussion”