Comparing Quadrature Encoder Outputs?

I have a project using three quadrature encoders. I need to make sure that the shafts they are mounted rotating the same amount at the same speed. Two of the encoders will be mounted on driven shafts, and I need to make sure that they are rotating at the speed. The third encoder will be on a non-driven wheel on the back, because if the two front wheels are spinning while the back is not, then the vehicle is slipping which is not ideal. I am using a Pololu motor driver to drive the motors and I think I have a decently good grasp on how to do it. However, I do not know how to compare the outputs from the encoders. I assume I will need to use interrupts but I'm getting confused. Any help will be much appreciated!!

Interrupts are a good idea but they are going to make your program more complex to debug.

Basically set up 3 instances of the Encoder.h library and count steps. If one count gets excessively in front of or behind the others then you have found your slip.

Encoder.h will use interrupts where available, so put at least one leg of each encoder onto an interrupt-capable pin. On the UNO this is only pin 2 and 3. On the Teensy 3.0 and above it is every pin.

Automotive ABS systems use encoders on the wheels with 100 or more pulses per revolution. So if they detect a mismatch of 25 counts, the wheel has only slipped by 1/4 of a turn.

Hi,
They usually use impulse sensors rather than full blown encoders on wheels.
Inductive sensor and toothed wheel, makes easier speed sensing.
When wheel speed between wheels is different, then wheel must be slipping.

OP is comparing speeds so a full blown quadrature encoder is not needed.

Tom.... :slight_smile:

If you can get away with the above suggestions of using a single-phase of the encoder output as speed indication (as opposed to velocity given by the quadrature), you might be able to use two of the 16-bit timer/counters in a Mega2560 (e.g.) and use the encoders as their clock source.

You could have a routine that zeros both counters and allows them to accumulate clock pulses from the phase input. After a fixed period of time, read the count value on both. You should be able to determine how closely they’re running from that.

A lot depends on pulses/rev, the angular velocity of the shafts, the sample time etc.