Cycle pedaling steadiness sensor/feedback system (thinking out loud)

Hi! I am about to start bicycle winter training on rollers and I'm wondering how I can make things more fun by gathering and visualizing some data. Maybe there would even be an actual benefit for my training.

One goal of bicycle training is to make the pedal movement as efficient as possible, which also means as steady as possible, so that there is as little acceleration (increase or decrease of angular speed of the cranks) as possible, because accelerations mean that additional power is required from the cyclist at some point. Any little speed change during pedal revolutions are supposed to make a difference here. More steady pedaling should indicate better efficiency.

If I could measure the steadiness of my pedaling, I could for example compare my steadiness between rides and see if there is progress. Or, even better, I could use some sort of real time visual feedback to inform myself of how steady my current pedaling is.

I haven't found any descriptions of a similar project so far, so I'm about to figure out what would be required to come up with a simple solution for this. Maybe someone knows better and can provide useful tips?

The easiest setup I can think of is a single accelerometer fixed to the pedal crank or to the chain wheel. The accelerometer would basically measure centripetal force (plus the gravity force pointing to different angles, relative to the accelerometer). Every speedup or slowdown in pedaling should result in an immediate change of the centripetal force.

With a radius of 10 centimeters (distance from crank axis to accelerometer mount point) and a maximum pedaling frequency of about 120 rounds per minute, my calculations show about 1.6g as the expected centripetal force. The force of gravity would have to be added or subtracted to/form this, depending on the point where the accelerometer is during a revolution, so the range should be between 0.6 and 2.6g during pedaling with 120 RPM (which I can hardly do, by the way).

The lower bound for pedal rotations per minute should be somewhere near 80 RPM. With that speed, the centripetal force is 8,4 N, which is below 1g. So the force range for slow pedaling is roughly between 0g and 2g.

I have no experience with accelerometers. The ADXL335 with +/- 3 g range and analog interface could be a good choice. It measures 3 axes, which I don't expect to be necessary (sine we are rotating in a plane), but having data for more 2 axes instead of one could turn out to be helpful. I don't know yet.

As for resolution of force measures during one pedal revolution, I think there the absolute minimum would be 4 measures per pedal revolution. With 120 RPM this would result in 8 samples per second.

A first practical consideration is: How to mount the stuff on the bike? I have Arduino pro mini 328 around which I could use, they might even fit into the crank axis, including batteries. So I guess that can be solved.

Another consideration: Data logging on the bike or direct transfer to Arduino to computer?

With the pedals rotating, any wired connection seems impossible. So one option could be writing data to an SD card. The data rate at 8 samples per second and 10 bit resolution and 2 axis values should be 160 bit/sec. I guess it wouldn't be a problem to write this away to the card every now and then.

Recording is fine, but real time feedback on a display or computer (plus recording) would be much more interesting. This could be done using wireless data transfer - another area where I haven't got any experience so far. From what I read, XBee should be easy to use and with 250 Kbit/sec, the possible data rate would be far more than enough. An Arduino Uno attached to my laptop via USB could work as the receiver station.

A few questions:

  • Is XBee the simplest solution for wireless transfer? (Simple is important to me, since I'd rather have results earlier than cheapest.)
  • Any better recommendations for an accelerometer to choose?
  • Would it be better to have two accelerometers mounted in opposite positions? So their measures could negate out gravity effects?

Thanks for any input!

EDIT: As a side effect, from the gathered data one could also deduct cadence (pedal rotations per minute). This, combined with wheel rotations per minute, could allow to deduct gear transmission ratio.

Hi sendung,

Why not just attach an optical rotation sensor to one of the rollers? Then there's no need for advanced stuff like accelerometers or xbees!

All you would need is a contrasting colour marker stuck on one of the rollers. Then perhaps an ir led and photodiode (you can get them in a single unit) mounted to pick up the marker as it passes the sensor. You can then measure the time between the marker passing the sensor, and knowing the number of roller rotations for 1 wheel rotation, you can calculate the road speed and look for your small variations in speed.

Paul

I agree, it sounds to me that all you need is to know the speed of the rollers or wheels, or are we being too simplistic?


Rob

Thanks, Paul!

You're right, having some "rotation encoder" on the rollers would definitely simplify things.

In terms of the analysis, I would find it more valuable if the data I gathered could be associated with pedal strokes. With accelerometers the pedaling frequency would be encoded in the signal, with highest values where centrifugal force and gravity work in the same direction. Through this, I might be able to display the force distribution over an averaged pedal stroke.

On the other hand, I might first try it the easier way, doing exactly what you propose and see how far this takes me.

Why would you propose an IR LED?

sendung:
Why would you propose an IR LED?

Hmm... IR nearly always seems to be used for this application, not entirely sure why. Perhaps its less affected by fluctuations in ambient light.

http://playground.arduino.cc/Main/InterfacingWithHardware#light_sensor

The accelerometer approach doesn't seem likely to be very sensitive to speed changes. I would have thought that an MVR sensor pointed at the chain wheel would be a better way to measure rotational speed. That would give you one sample per tooth, with roughly microsecond timing resolution. Would that be good enough resolution - what sort of resolution do you actually need?

I suspect you also need to be able to relate the speed variations to pedal position so you can understand what's happening in terms of your own movements - a second sensor to detect the crank would give you that.

PeterH:
The accelerometer approach doesn't seem likely to be very sensitive to speed changes. I would have thought that an MVR sensor pointed at the chain wheel would be a better way to measure rotational speed. That would give you one sample per tooth, with roughly microsecond timing resolution. Would that be good enough resolution - what sort of resolution do you actually need?

Actually, an accelerometer measures changes in speed quite well, because all changes in speed are caused by acceleration. That being said, I agree with your assesment that sensing the gear teeh would be a far better solution in that it is far easier to calculate changes in speed. The problem with an acceleromer in this application is that you need to do a lot of math to integrate the readings from two axes of acceleration, in a situation where both axes are constantly changing acceleration in both amount and direction, and after all that, you have to integrate with time in order to arrive at speed.

All this may be further complicated by how you mount the accelerometer; fixed to the pedal crank or fixed to the pedal itself.

As for radios, xbee have fine products, though they are much higher cost than many of the alternatives, like the little 415 or 915 MHz transmitter/receiver pairs, 2.4 GHz transceivers, or bluetooth.

PeterH, thanks for adding to the thread! Actually I have no idea what an MVR sensor is. Googling brings a wide variety of things, but no clear definition.

I don't really know what resolution I would need to come up with conclusions about steadiness. With 10 bits for the range of -3 to +3g, there should be ~440 steps for my range of 0 to 2.6g. A 1% change in angular speed, according to my math, would result in a 2% change in centrifugal force. 2% of 440 is roughly 9. For my intuition, this means I should be able to detect deviations of 1 % and smaller in rotation speed. But that's only theory, given that I don't know too much yet about signal processing.

You're right, being able to relate velocity to the pedal position would allow for very detailed feedback. This is what I hoped to be able to do from the accelerometer signal alone. On the other hand, for the beginning an overall steadiness score is more important than a detailed analysis.

lar3ry:
Actually, an accelerometer measures changes in speed quite well,

It doesn't seem at all suitable for this case though. The proposed method was to measure centripetal acceleration and infer speed from that. That is not going to give you a very sensitive speed signal and you would have to pick it out from a noisy environment with lots of vibrations and moving parts and so on. I'm sure it would be possible to get a speed signal out of it but I suspect it would take a lot of work and give very poor accuracy.

Using an accelerometer to measure tangental acceleration might be more feasible but you would still have to deal with a lot of noise and now you also have to deal with integration errors.

A simple sensor picking up crank movement directly seems far more practical to me. The MVR sensor I suggested is a Magnetic Variable Reluctance sensor routinely used with a toothed trigger wheel to detect engine crankshaft and camshaft position. The sensors are typically packaged as a cylinder about 15mm diameter and 50mm long with commonly available automotive connectors - you can see some examples at www.trigger-wheels.com but they're commonly available and you can buy them from any motor parts store.

Thanks for spelling out the verbose name! This helped me find lots of information. Interesting that there is a solution especially for measuring rotation speed of toothed wheels.

As far as I understand, the sensor would work only with ferromagnetic wheels. So an aluminium ring (which I am using) won't do.

sendung:
As far as I understand, the sensor would work only with ferromagnetic wheels. So an aluminium ring (which I am using) won't do.

Two more ideas.

The MVR might work with the chain itself. It might be worth a try.

You might be able to optically detect the teeth with a light sensor, perhaps IR, but a regular LED for illumination might work just as well. The if the chain is different enough in reflectivity from the ends of the gear teeth, you might even better sense the reflectivity where the chain is on the gear.

sendung:
So an aluminium ring (which I am using) won't do.

Wow, I hadn't considered that. Given that it's a stationary bike (so weight is hardly relevant) and you're going to be adding sensor hardware anyway, wouldn't it be easy enough to change to a steel chain wheel?

How about one of these http://uk.farnell.com/kingbright/ktir0611s/photo-interrupter/dp/2079964 to detect the passing gear teeth. The slot width is 5mm. If that isn't wide enough, here http://uk.farnell.com/omron-electronic-components/eesx3070/photomicrosensor-transm-tran-op/dp/2301868 is an 8mm one.

If you want to know the pedal positon as well, you can attach a magnet to the sprocket wheel and use a unipolar Hall sensor to detect it, or use 2 magnets and a bipolar Hall sensor.

Meanwhile I have built a first prototype and tested a bit. In case anyone is interested, here is a little report.

I built a very simple rotation encoder with an LED (red, not infrared) and a photoresistor. The sensor is attached close to the side of one of the rolls, which has a grey plastic surface. I attached a small piece of white paper to the roll. The Arduino program averages the last ten readings from the photoresistor and so detects when a reading deviates from that average by a certain amount. For every detected revolution, the program sends a counter, and the duration of the last revolution (in milliseconds) to the serial port.

On the other end there is a Processing program that reads the serial port and writes the data it receives to a CSV file and also displays some values like current speed (numeric and in a graph), nothing fancy yet.

Although I grounded the metal frame of the rollers to the house ground (power socket), I still had problems with electrostatic discharge in my first test run. After a few pedal strokes, the Arduino (which was lightly connected to the frame via the sensor) froze. I then attached an additional copper wire to the ground cable that touches the surface of the front roll. With that, the Arduino kept running fine.

From looking at the CSV output it seems as if I could in fact derive the wanted "steadiness" value from that data. For example, I rode at 80 rounds per minute for several minutes, using a metronome as pace maker. With the gear I was using, at 80 RPM, the average duration per round was 70.5 milliseconds. This makes roughly 10 roll revolutions (and thus measures) per pedal revolution. The regular variation in my pedaling is actually visible when I simply plot the duration values (graph attached). To represent steadiness numerically, I guess I could look at either standard deviation or variance of the duration value during that phase. In order to have comparable results, I would of course have to do each test in the same gear and ideally with the same warmup program and duration.

Among the things I will try next is to measure revolution duration in microseconds instead of milliseconds. With the values deviating between 60 and 80 milliseconds, the actual resolution of the duration deviation is only a few integers. Then, on the display side, I will display the moving standard deviation for e.g. the last 100 revolutions. I'll probably post an update when I have the result from that test (after christmas though).

I had the impression you were looking for speed variations within a single revolution rather than speed changes over multiple revolutions - did I misunderstand?

Peter, I think that's what Sendung is doing. He's getting 10 revolutions of the roller to one of the wheel, and in the gear he has used, around 10 roller revs per pedal rotation also. So when he talks about measuring the average over 10 revolutions, that is one wheel revolution. The variation in that sample of 10 gives a measure of the steadiness.

Paul

Just found this related article in the "Journal of Science and Cycling" and thought I'd share with everyone interested.

Tomoki Kitawaki, Hisao Oka: A measurement system for the bicycle crank angle using a wireless motion sensor attached to the crank arm

http://www.jsc-journal.com/ojs/index.php?journal=JSC&page=article&op=view&path[]=51