RoboClaw Encoder Reading

Hey, I am testing my DC motor with optical encoder. When I connect the encoder to roboclaw, I try to use command 30 to read the speed. In the user manual it says that command 30 will return 5 bytes and the first 4 bytes represent speed. I got different values for different speed, but I can’t link these value to the actual speed value. How can I convert them to the actual speed of motor? Thanks.

Hello.

In general, the speeds of identical brushed DC motors supplied with the same voltage and under the same load can be different. Did you get your motors from us? If you tell me what the two speeds are, I might be able to give you an idea of whether or not the difference is reasonable.

For your second question, it sounds like you are asking about how to get the speed of your motor at its output. As it says in the datasheet for the Roboclaw, command 30 returns a speed in pulses per second. So, you would need to know how many pulses per revolution your encoder has to calculate a value like RPM. If you are using a gearmotor with an encoder mounted directly on the motor shaft (instead of the gearbox output shaft), you would also need to divide your result by the gear ratio of the gearbox to get the output shaft speed.

-Jon