I’m using a gearmotor with 19:1 ratio and this Motor Driver. I want to read out the RPM of the motor. Therefore I connected the yellow cable of the motor, which is the encoder A output, to the arduino. To calculate the RPM I am using the following code:
Since the motor can do 500 rpm it should run at almost this speed, when using “dcStart(255)” in my code. But when running my code it gives values, that are about 10500 rpm. Is there any mistake I am doing?
The RPM reading sounds about right. The encoder for that gearmotor is on the motor’s output shaft, instead of on the output shaft of the gearbox. With a 19:1 ratio, the motor’s output shaft will rotate 19 times faster (9500 RPM) than the gearbox’s output shaft (500 RPM). Getting a rate of about 10500 RPM is a little on the high side, but still within the +/-10% range we expect for our metal gearmotors.
The encoder on the 37D gearmotor provides a resolution of 64 counts per revolution (CPR) of the motor shaft. That count is achieved by counting the rising and falling edges of both encoder channels; however, Schlingek’s code only counts the falling edges of one of the encoder channels. That means he is only getting a quarter of the total possible counts he could be getting, 16. Keep in mind that this is 16 CPR for the motor, not the gearbox output shaft.
Something seems to be not consistent at all, because I used the same code, but the rpm that I am getting as a result seems not credible.
Assumptions:
Setup should be the same compared with my used micro metal gear motor. As you have mentioned the 420 CPR are the counts of the edges of both channels.