I'm currently working on an autonomous terrain-mapping rover, and I've run into problems in the seemingly most straight-forward area: processing quadrature encoder data.
For any unfamiliar, a quadrature encoder is a rotary incremental encoder with 2 output channels which fire pulses 90 degrees out of sync. I.e. if ChnA's pulse leads ChnB's, you're moving forward and vice versa. And if you know the resolution of the encoder (pulses/revolution) you can easily determine the distance you've traveled.
I'm specifically using this encoder: http://www.lynxmotion.com/p-448-quadrature-motor-encoder-wcable.aspx
Now according to the encoder's specs, 400 pulses = 1 revolution.
Ok great! I'll just hook up ChnA to the input of a digital counter module, and preload the module to 400 less than its interrupt point, and every interrupt will be a rotation!
The wheel barely moves an eighth of a revolution.
Looking at the output of ChnA on my logic analyzer reveals that in one full rotation of the wheel, there are over 2400 pulses. I have no idea where that's coming from.
Does it have something to do with the gear ratio (it is attached to a motor shaft with a 30:1 gear ratio)? If that's what it was, it would be 400*30 which is way more pulses than I'm actually getting per rotation. Or am I missing some other glaringly obvious piece of information?