Appropriate sensor to detect bicycle steering?

I have a stationary trainer bicycle that I am trying to interface with Arduino. Based on some other threads here I know that I can use a reed sensor or a hall effect sensor to detect the RPM of the spinning rear wheel.

What I'm trying to get information on is how I can detect the position of the handlebars. I'd like to be able to detect the front wheel's relative position to being straight. Obviously a sensor doesn't have to return this information directly, but I'd like to be able to say that the angular offset is 0 degrees when the steering is straight, and x or y degrees to the left or right when it is turned.

So far I've thought about building a tray for the front wheel and connecting that to a rotating potentiometer, but I suspect there's a better solution. Any ideas?

Sparkfun (and others as well) sell compass modules like this :

At 50$ it's a bit pricy, but you would get actual heading :slight_smile:

The best bet would be to use an absolute optical shaft encoder. This would give a resolution of just over a degree for an 8 bit one. However these are not cheap.

Based on some other threads here I know that I can use a reed sensor or a hall effect sensor to detect the RPM of the spinning rear wheel.

I assume you know that putting the sensor on the rear wheel will give you the RPMs of the wheel, which is not the rider's cadence (pedal RPMs). To get the cadence RPMs, you'd have to put the sensor on the crankarm.

In either case, of course, you want the sensor on the frame and the magnet (for the Hall Effect sensor) on the rotating part.

With the sensor on the rear wheel, and by knowing the rear wheel circumference, you can calculate speed and distance, rather than cadence. If you put the sensor on the crank, you'd have to know about the gear ratios (as you shift) in order to get speed, etc.

I think you're going to need some gearing-up to measure handlebar turn - when riding a bike, the turn of the handlebar is tiny; most of the steering is done by lean, except at very low speed.

I would look into the magnetic encoder used in the RepRap project. More details are here:

http://reprap.org/bin/view/Main/Magnetic_Rotary_Encoder_1_0

In absolute encoder mode, the IC used on this board has a 10-bit resolution providing 1024 absolute positions per 360° (step size ~ 0.35°)

You can get samples of the IC directly from Austria Microsystems, too.

Wayne

If your bike steering has a lock to lock turn (and doesnt spin 360 degs), you could use a slide poti. Just have a small arm come off where your handle bars meet (at the base of the Y so to speak), and then hard linkage it to the slide.

Or you could use a standard rotary poti, and do a figure 8 around the base of the Y on the handle bars, and the poti shaft, with something like a ruber band, and when you turn the wheels it will turn the poti.

lol windhamrules beat me to it, a potentiometer, a rubber band and maybe a pulley on the pot

Thanks for all the suggestions! I'll investigate these options and post information about what works.