Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Output of quadrature motor encoders


#1

Hi,

I’m looking to buy some motors with quadrature encoders from you and I have a question.

I found a few DC motors/encoders (no datasheet) laying around that have a hall effect quadrature encoder attached. I tried using these but found they generated false interrupts when connected up to my MCU. I hooked up a scope and found the encoders were taking 7us to transition when the motor was running slowly (about 1 rev/sec) and there is a little sine wave “bump” in the middle of the transition.bump

So I’m wondering if this is normal for a Hall quadrature encoder? Or are yours of a different type that produce a quicker/cleaner digital output that would be more compatible with hooking to 3.3v MCU’s GPIO pins?


#2

Hello, Greg.

The hall effect sensors on our encoder boards have some hysteresis to prevent bounces like that. Here is the sample output from a Magnetic Encoder Pair Kit for Micro Metal Gearmotors board I have lying around.

DS1Z_QuickPrint1DS1Z_QuickPrint2

You might also be interested in reading this blog post about developing those boards.

-Nathan


#3

Thanks for the info, I added some schmitt triggers to my cheap encoders and now they work pretty well. Though since I have to build several more of these robots I think I will be buying my motors/encoders from you for the next ones, your encoders look much better!

I’ve run into one thing and I’m wondering about, I have a PID controller driving the motors and I have noticed that when I start the motors at slow speed, the initial pulse train from the encoders can be weird. Like I’ll see a one pulse on channel one and multiple pulses on channel 2, or the phase of the signals will be off making the PID controller think the motors are running in reverse. Or I’ll see a lot of pulses on one channel and none on the other which can make the PID think the motor is running way to fast.

Any of these things result in a rough startup of the motor ie: if the PID thinks the motor is running way to fast, it tries to reverse it to slow it down.

What I’m wondering is, do all encoders do this or is it just mine? Is there something I should be doing to reject these startup anomalies?

Right now I have my own interrupt handler similar to those I’ve seen in other people’s projects. Is there a particular encoder library that is better at dealing with imperfect encoders I could be using?


#4

We haven’t run into signal issues like that with our encoders. If the frequency of the spurious signals is much higher than the frequency of the expected output, a low pass RC filter might help, though we do not have any specific advice for implementing it. We are not aware of any encoder libraries that implement any kind of filtering.

-Nathan