How to calculate for rpm for mico motor encoders?

How do i extract the the RPM value from the mico motor encoders? I do not know how to use the second signal pin. Im sorry but im just lost where to start there is not enough info for me to go on.

The encoder disc sayy 12 CPR is this for the disk alone or if it is paired with the micro motor?

Hello.

There are few different methods for determining velocity from quadrature encoder signals. Here is a YouTube video with a good overview of a couple of those methods using different hardware (they use one of our 37D gearmotors with a pre-assembled 64 CPR encoder):

The creator also links to example code in the video description.

If you try to apply that to the Micro Metal Gearmotors and our encoder kits for them, keep in mind the 12 CPR value you mentioned for the disc means that for each rotation of the disc you could read up to 12 counts if you read both the rising and falling edges of both signal channels. However, for speed measurement and control, you might be more interested in counting pulses or measuring pulse lengths. The 12 CPR magnetic discs included with our recommended Micro Metal Gearmotor encoder kits consist of six approximately evenly spaced magnetic poles (three north-south pairs), so that means each of the two signal channel will read 3 pulses per revolution.

Also keep in mind that the encoder disc goes on the motor’s extended shaft, which comes before the gearbox, so you will need to account for that if you want to determine the gearmotor’s output shaft speed. For example, if the exact gear ratio for a motor were 100:1, and it generated a pulse frequency of 30 Hz on one of the encoder channels, then you could calculate the output shaft speed like so:

30 \text{ Hz} × 60 \frac{\text{s}}{\text{min}} ÷ 100 = 18 \text{ RPM}

- Patrick

Geat video indeed ! :slight_smile:

So let me try to summirize:

To determine direction the best way i can think of is to record the time of rising edge of encoder A and encoder B. If A -B = negative number then direction is forward , else positive direction backwads. But i guess that would depend on the motor orientation. Correct?

Im a bit confused about the magnetic disc. In 1 revolution of the disc:

channel a - 3 rising edge
channel a - 3 falling edge
channel b - 3 rising edge
channel b - 3 falling edge

thus making it 12 CPR?

If all i want is to get RPM value and not use it for PID purposes: A good way is to listen to only 1 channel, and :

[number of rising edge in a revolution] x [ Time Difference between 2 rising edge in seconds] x  [60 seconds  ÷ 1 minute] ÷ [ gear ratio ] = RPM

so if the time interval between rising edge is 1 second and has a gear ratio of 100:

0.3333 x 1 seconds x (60seconds/1minute)  ÷ 100  = 0.20 RPM

This is assuming that my understanding of how the sensor reads the disc is correct. Am i correct?

A simpler method is whenever you detect the rising edge on encoder channel A, check whether channel B is low or high, and that will tell you the direction the motor shaft is spinning, which may more may not match the direction the gearbox output shaft is turning depending on the number of gear reduction stages.

This is correct.

This is also correct.

- Patrick

1 Like

Thanks a bunch ! :slight_smile: