# Measuring rotations problem with motor encoder

I have this motor encoder mounted on the back of a 120RPM motor which has a gearing of 298:1 ratio. The back shaft is directly from the motor, not through any gears.

Im using an encoder disk that has 3 "wings". Exactly this one,

These encoders have 2 outputs for quadrature decoding.

This is my understanding.

1) Using the 3 wings and interrupting on the RISING edge of the signal I should have 3 * 291 transitions per full rotation of the shaft?

2) I only care about how much the wheel has turned by so I can control it to do half rotation, one rotation, x rotations etc. I dont need to know the direction or speed etc. So am I right in thinking I only need to use 1 output rather than both and having to do full quadrature decoding?

My problem

I have this connected directly to an arduino and have one function that is an ISR that is triggered on the rising edge. The function only has one line and increments a variable "ticks".

In my main loop I have it only checking "ticks" and if it = 873 (one full rotation according my understanding of rising edge and 3 wing encoder) then it stops the motor.

The problem is that its undershooting and stopping short each time.

Is there a problem with my understanding on how to properly use the encoder and its data or is it not that simple?

Thanks

• This might call for a small exercise in patience: Mark one position of the output shaft precisely, so you can identify when exactly one full rotation is done. Manually rotate the encoder wheel and thus the motor shaft through as many revolutions as needed to achieve precisely one rotation of the output shaft - For a more definitive result, take the output shaft through 10 full rotations, to get the actual ratio with 1 decimal place precision. Then use that number for your code. Feb 2, 2014 at 6:05
• I think I'll have to do that. I'll rotate and stop after every 1 tick until it lines up to where it started. But can I ask if my logic is right in regards to using the rising edge and only needing one encoder output to do this? Feb 2, 2014 at 11:08

Stopping short (by a small amount) sounds like the ratio may not be quite what you think.

Try counting the gear teeth on each gear in the gear train and finding the ratio. For example, we found that some steppers with gear ratios advertised as 4096:1 were actually 4075.77283951:1.

I would use quadrature so that you can drive the motor backward if it overshoots, but if you can get what you need without that..

Well, okay, if you can't look at it and count teeth, someone else has, but not necessarily for your exact motor.

The exact gear ratio for the 298:1 micro metal gear motor is: (25/12) × (34/9) × (37/10) × (35/13) × (38/10) : 1 (or approximately 297.9238:1)

Also, your question refers to 291, not 298, so if that's the number in your program...

• There's really no way I can count the teeth as there's multiple gears and they are all very small. I'm using the same motors as in the original picture Feb 1, 2014 at 22:33
• This is the exact motor. precisionmicrodrives.com/uploads/media_items/…. but surely if it's only off by that much it shouldn't be visually noticeable? Feb 2, 2014 at 11:06
• Ops. I think the 291 was just a typo. Can I ask how to find those exact gear ratios? Feb 2, 2014 at 11:11
• Someone counted the teeth on the 5 gears. Feb 2, 2014 at 11:33
• Spehro probably got that information from here: forum.pololu.com/viewtopic.php?f=7&t=5627#p35063 This link should be added to the answer. Apr 3, 2014 at 6:30