RPM and counts per shaft turn in MD49 and EMG49

Hello all,

I have an small problem with my EMG49 motor and MD49 driver.

I use this to get the RPM:

Serial.write(CMD); Serial.write(GET_SPEED); delay(5); if(Serial.available() > 0) { speedRPM=Serial.read(); }

And I am counting the total cycles of my motor, each 980 counts I add 1 cycle.

Ok, the problem is that the RPM I get from the driver aren’t the same that the count cycles.

I add a operation to get the RPM with the counts and the time, I get two times with a second of diference and the two positions of the motor in these two moments.

time_rpm= time2-time1; // if (time_rpm == 1000){ counts_rpm=position2-position1; new_rpm=(counts/1000)*60.0; {

When I get 20rpm of the driver, I get 18rpm with my operations.

It is possible that the driver is broken or something?
Am I doing something wrong?

Thanks!

Hi popake,

The preferred method for obtaining the speed of the motors with the Devantech MD49 (RB-Dev-42) is to use the 0x21 (GET_SPEED_1) and 0x22 (GET_SPEED_2) serial commands.

Since your calculation of the RPM seems slower than the one provided by the motor driver, this would indicate that your calculations using the raw encoder values cause a delay that changes the final RPM value that you calculate.
This is especially possible since you are using the Arduino libraries which are known to have a lot of overhead (things as simple as DigitalWrite are up to 50 times slower than using pure C).

We recommend that you use the commands provided by the motor driver as they are most likely returning the proper RPM for your motors.

As a reference, here is the link to the documentation for the Devantech MD49 (RB-Dev-42):
robotshop.com/media/files/pdf/md49-documentation.pdf

Hope this helps.

Thanks for the reply.

My first attempt was to calculate the speed with the 0x21 (GET_SPEED_1) . But this value is wrong with visual RPM counts.

The good value is the second one that I calculate. The delay doesn’t matter because the calculation is between millis() (arduino counts millis since start without delays) and the position value of the motor encoder.

If I remove the all operations and I only use the command 0x21 to get the speed, I get for example 40RPM but if I count the RPM visual I get 36-37.

Hi popake,

It is interesting that you report a higher RPM count from the device than what is visually observed. We shall contact the manufacturer to obtain more information about your situation and we will reply again once we know more.

Sincerely,

The GET_SPEED commands return what is essentially the power output of the MD49, this is not the rotational speed of the wheel.
You need to use the GET_ENCODERS command and you should recieve 980 counts per rotation.

In the instructions are:

[table][tr][td]0x21[/td] [td] GET SPEED 1[/td] [td]2[/td] [td]1[/td] [td] returns the current requested speed of motor 1 [/td][/tr][/table]
But I’m think you are right.