Mark Jenkins wrote: > I was hoping to use a hall effect sensor because of the the ease of > setting up this type of system with 4 magnets set 90 degs apart on > each wheel, i imagine this would make the software harder to write and > may require additional hardware so may not be practical or possible, No, that sounds fine, particularly as I presume the digital hall sensors have hysteresis and therefore debounce the signal nicely. If the PIC has to debounce the sensor, that would complicate things as you may have to develop a PLL-style system to determine the actual speed and ignore "bounce" suggesting a higher speed. This could otherwise be a problem if the "bounce" at a lower speed was comparable to the actual signal at a higher speed. I must confess, no solution has came to my mind last night. The general approach I would be looking at however, is to count transitions on each wheel sensor (if the sensors are such as to have equal "mark" and "space" sectors, transitions in both senses could be counted to double the resolution) in a common "sum" counter, and also apply the transitions to a "difference" counter which counts up for the left wheel and down for the right. Let's say you want to detect a 10% speed difference. Every time the "sum" counter reaches or exceeds 40 (each wheel has generated 20 counts, or perhaps one has generated 19 and the other 21), you subtract 40 from the sum counter and look at the difference counter. If the difference counter reads 6 or more, you reset it to 4 and indicate a speed difference. If it reads 3 or 4, you subtract 1, and if it reads 5, subtract two. If the difference counter is negative, the same algorithm applies to the negative numbers. The effect of this algorithm is that small variations in speed will cause the difference to "slop" around in the range -2 .. +2, variations consistently in one direction will cause the count to oscillate between -3 and -2 or +2 and +3, a difference greater that 5% will cause it to run up and oscillate between 4 and 5 (or negative thereof) while at exactly 10% difference, it will consistently sit at +/-5. Any more, and it will sit at +/-6 or greater and indicate accordingly. -- Cheers, Paul B.