The wheels on the bus go round and round…

Got an email from my dad this morning, he went out to the shop and measured the forward travel on the old Dodge and found it is 23.5" per revolution of the drive line. A bit higher than the ideal 17", but workable. It occurred to me overnight that doubling the sampling rate and dividing the result was a better solution than adding a second magnet to the drive line. Partly because it's easier to undo things like that in the code, and also because I'm not sure how fast the Hall sensor can read the magnet. Having two of them whipping by could be too much at higher speeds. Much better to leave it at one magnet and just lengthen the sampling period. And speaking of the sampling period, here's how the two break down:

One second interval Two second interval
Pulses Distance Interval MPH Pulses Distance Interval MPH
1 23.5 1 1 1 23.5 2 1
2 23.5 1 3 2 23.5 2 1
3 23.5 1 4 3 23.5 2 2
4 23.5 1 5 4 23.5 2 3
5 23.5 1 7 5 23.5 2 3
6 23.5 1 8 6 23.5 2 4
7 23.5 1 9 7 23.5 2 5
8 23.5 1 11 8 23.5 2 5
9 23.5 1 12 9 23.5 2 6
10 23.5 1 13 10 23.5 2 7
11 23.5 1 15 11 23.5 2 7
12 23.5 1 16 12 23.5 2 8
13 23.5 1 17 13 23.5 2 9
14 23.5 1 19 14 23.5 2 9
15 23.5 1 20 15 23.5 2 10

The actual distance covered is close enough to the ideal 17" that the one second sampling actually isn't too bad. All depends on how accurate the old man wants his speedometer to be. Oh, and speaking of that distance, I realize now that the .5 on there means I need to be using float instead of int in the code, otherwise my calculations are going to be off.