Measuring rotations problem with motor encoder

dc motorencoderinterrupts

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,
enter image description here

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

Best Answer

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...