Well. It appears that I'm not the biking machine I thought I was. Or the programmer.

After some careful rewiring, poring over some documentation, and some recreational coding, I found that due to the position of the magnet on my wheel, I was actually receiving not one but up to four signals for every single pass by the sensor.

The only reason I didn't notice this was actually because of how inaccurate I was previously measuring passes. Also, that I was delaying 10ms between sensor polls meant that at least one or two of the signals would be ignored, with slightly improved accuracy as the magnet went by faster.

Now I think it is a little more realistic. I fiddled with the magnet on the wheel so that 9/10 times it will only signal once for every pass (best I can do). To account for that erroneous 1 time in 10, I put in a 100 millisecond ignore state. This means I can't have more than 10 sensor reads a second. But I don't think these legs will ever push that wheel around more than 10 times a second. Know your limits, Master Wayne.

I re-implemented the interface I had with the computer to do both the counting and the pausing I had before. Trying it out briefly, I found that I'm not actually hitting 250rpm, actually closer to 175 to 200rpm while going "balls out." The program feels a little more responsive, though I'm not sure if I should be able to notice a difference unless I'm going full speed.

#915, posted at 2010-10-03 23:43:05 in Cognitive Surplus