How about painting a line on the inside tire wall, and using a reflective optocouple mounted inside the tire well to detect revolutions..
Use the CCP's Capture Module to time per revaluation.
Compute the period for each revaluation.
This is the new CCP's capture value, minus the previous capture value.
Use unsigned 16 bit integer arithmetic for the computations.
Then, low pass filter the period values.
The long term average will be very accurate.
The Steps are as follows:
1) Measure the period of each revolution.
2) Update a running period with each new period's low-pass filtered value.
3) The wheel's speed equals the inverted filtered-period value.
4) Wheel acceleration is computed by processing the filtered period value at regular time intervals, not at the same point of each rotation.
A while back on Microchip Forumns, Olin provided the following info:
Compute the period of each rev, which is just the new capture value minus the previous capture value using unsigned 16 bit integer arithmetic. Then low pass filter these period values.
It's important to low pass filter the period, not the speeds you get by inverting the period. This is because the measurement jitter will make one cycle look short, but the cycles before and after will be longer to compensate. In other words, the long term average will be correct. Applying a linear filter makes sense. The measurement jitter is no longer linear after inversion, so that's not the space you want to filter in.
So measure the period each revolution, use this to update a running filter of the period, then invert that as needed when you need speed. You can compute acceleration from the filtered period at regular time intervals, independent of the rotation speed. Just grab the latest filtered period whenever you need it.
Bookmarks