MG37D input/output characteristics (dead zone)

Hi everyone

I’m working with DC motor MG37D (Pololu - 37D Metal Gearmotors) 30:1 and 70:1 versions.

Applying a ramp to the input and measuring the velocity I get the following input/output characteristics. Different graphs have been obtained with different power supply (6, 8, 10, 12, 14, 16 Volts). As you can see, there is a ‘dead zone’ in which the velocity remains constant during a range of inputs. This stall velocity is the same for all the power supplies (8.9 rad/sec). There is a small zone at 4.45 rad/sec (8.98/2) and another one at 17.55 (8.9*2 aprox).

It is not a problem of the encoder reading because you can ‘hear’ the constant velocity when the motor enters these dead zones and the acceleration when it leaves it.

I’m using Arduino IBT2 driver and Arduino nano for the PWM generation and encoder reading. I’ve also tried with a different motor, driver and micro and I get the same results.

Following figures shows the input/output using 12 Volts and the response applying a square wave 3.2-3.5, 4.2-4.5 and 5.2-5.5. As can be seen (and heard too) in the middle one the velocity does not change if the square wave is in the ‘dead zone’.
image

Any ideas about what this strange behavior happens?.

Best regards

Hello.

The problem you are observing is likely an issue with your code or PWM generation, and possibly partly with whatever visualization we are looking at. Can you confirm that just connecting the motor directly to the power supply and varying the voltage will smoothly change the motor speed? After that, can you look at your motor driver’s PWM input and output duty cycles on a scope through the regions where you’re having these issues?

- Patrick

Hi
Thanks for your answer, Patrick

The following figure shows the PWM output (0-255) from the micro when I wrote a 105 (more o less the begining of the dead zone) and a 110 (more o less the end of the dead zone). Itcan be seen there is a slight difference in the pulse width, as expected.



Same thing in the output of the driver (i.e. the input of the motor). Note that the amplitude is 12V instead of 5V. The motor was not connected in this test but I think it proves that it is not a problem with the PWM generation. If I attach the motor and conmute the output between 105 and 110 (square wave) I don’t hear change on the velocity.

In the shared link there is a small video. You can hear (sorry, the volume is a little low) the signifficant change of velocity in second 45. But the pulse width shown in the scope, does not experiment this significant increasing. Is like the motor ignores the increasing pulse width until it reaches a certain value.
https://drive.google.com/drive/folders/1-0GFfsjUsN_GfpAvc3KrkSD7KCsd0K0X?usp=sharing

Thanks again for your help
Best regards

Thank you for all the scope captures and video.

There are still many variables involved, so let’s quickly try a simpler test. Can you confirm that just connecting the motor directly to an adjustable power supply and varying the voltage will smoothly change the motor speed?

- Patrick

Hi Patrick
The answaer is yes. When I vary the power directly to the motor inputs the velocity increases as expected.
This figure shows the velocity (don’t bother about the noise, its normal due to the encoder resolution and the sample time) inside the ‘forbiden zone’.

Velocities between (aprox.) 8.9 and 9.8 rad/sec cannot be achieved using the PWM.

I don’t know if this means that is a driver problem but I have used a different driver and I get the same results.

Best regards

This rules out an issue with the motor and encoder, which means this is likely a problem with the PWM generation on the Arduino or with the motor driver. Given that you can hear it in the motor, the issue is likely real, but there might also be some kind of data calculation or visualization mistake that could be misleading where you’re looking for the problem. As much as possible, I recommend you simplify your tests to looking at actual measurements rather than graphs that are the result of calculations.

An easy one to start with is set the PWM to a duty cycle that puts you in the middle of a dead zone and see what happens if you then raise or lower supply voltage without changing the duty cycle. Presumably, this will cause your motor speed to vary in a way that you can audibly verify. If you then, instead, vary your PWM duty cycle a bit and the motor does not respond, it will mean you are not actually varying the power to the motor.

- Patrick

Hi Patrick
I’m pretty sure it is not a measurement problem.
Do you think it will work if I place a RC filter between the driver output and the motor input?
This will convert the PWM signal into an analogic one. But will introduce some ripple.

No, putting an RC filter on the motor driver output would not be helpful. The motor itself acts as the low-pass filter, which is why these drivers can have PWM outputs.

I’m not following exactly how you’re making this graph, but it seems very unlikely that different combinations of supply voltage and duty cycle are giving you the flat speed in the same spot (and at exact mathematical multiples of that spot), especially when you have already verified that the motor can run in between those speeds. I understand some flat spots apparently exist based on your hearing them, but it is difficult to believe that they are happening at the same exact motor speed.

- Patrick

Hi Patrick
Hi Patrick
As the motor seems to work well when I use a DC voltage directly from the power source instead of the PWM, I thought that converting the PWM to a DC with the filter could help.
What I’m doing is to generate in Arduino a ramp from 0 to 10 and map it from 0 to 255. A slow ramp that last 100 seconds from 0 to 10. Write it on the PWM using Analogwrite. PWM output is fed into the driver (I’m using Arduino IBT2 but I’ve tried a couple more). The driver is powered with a variable power source that I’ve changed [6,8,10,12,14,16]. The encoder is read using Arduino interrupts, detecting rising and falling edges in both channels (4X). I can plot the velocity measured in Arduino serial plotter but to get the graphs what I’m doing is to use a MCP4725 DAC. The analog signal is read using a data acquisition card (NI USB6001) from Simulink to plot it in a Scope and I can visualize it in a oscilloscope. The signal visualized in the Simulink Scope and in the Arduino plotter are the same so the DAC is not doing anything wrong besides introducing a small noise.
The graphs show the real velocity, as I can hear when the motor enters and exits these flat zones. And yes, is always the same velocity (8.9 rad/sec aprox). Moreover, note that there is a smaller flat zone at half of this speed and another one at double. Maybe is some kind of resonant frequency.
Visualizing the PWM signal it can be seen that the pulse width is increasing monotonically as expected, even when the motor enters the flat zone. So, I think that the problem must be between the PWM output and the motor.
Changing the power supply does not change the velocity of the flat zone. It changes the input (0-255) in which appears and the length of them. Using 6V almost disappear, but they are still there.
I’ve tried what you told me, putting a 107 (in the middle of the flat zone) and varying the power supply and there is a change of velocity. But I think that is because if you change the power, for example, from 12 to 10 or from 12 to 14, the flat zone is not between 105-110 yet. See magenta, blue and yellow lines. The flat zone moves and the motor exits of it because 107 is not on the flat zone anymore.
Look at these pictures. I have applied a square wave 95-100 (4 seconds) then 105-110 (4 seconds) and 115-120 (4 seconds). In the first picture the power supply is 12V (magenta line) and the flat zone is in the middle stage (105-110). In the second picture the supply is 10V (blue line) and the flat zone is in the first stage (95-100). Changing the power supply makes the flat zone move.
Look at these pictures. I have applied a square wave 95-100 (4 seconds) then 105-110 (4 seconds) and 115-120 (4 seconds). In the first picture the power supply is 12V (magenta line) and the flat zone is in the middle stage (105-110). In the second picture the supply is 10V (blue line) and the flat zone is in the first stage (95-100). Changing the power supply makes the flat zone move.

Any ideas?

This proves that there is not actually a flat spot at that speed, and it is also not consistent with your graphs that show speeds in the dead zone to be unreachable independent of the supply voltage.

- Patrick

That’s true but I cannot achieve the velocities in the flat zone, leaving constant the power supply. And I cannot vary it from the micro.
There must be an explanation to this behavior.
Could you try to obtain the input-output characteristic (input vs velocity) of a MG37D with your own driver and micro?. Just to see if you get the same results.
Best regards

We already have tried tests like that and the behavior matches what you have already confirmed: if you actually change the power to the motor, the motor speed will change (i.e. there are no “dead zones”). That means your results are probably from some combination of the following:

  1. The microcontroller and driver are not delivering the power you are expecting to the motor.
  2. The measurements or graphs are not accurately reflecting the true behavior of the system.

If you want to figure out what is going on, that needs to be the focus of your investigation.

In case it helps you mentally to look somewhere else, the motor is relatively simple and it is inherently analog. Yes, it could have some kind of rough spots, but that would mostly show itself as curves being not completely smooth, not completely flat spots you are showing in your graphs. Your microcontroller and other setup, meanwhile, are digital, and there could be subtle bugs involving rounding and overflows that could cause these kinds of flat spots. Can you try something other than a motor, like maybe an LED, to see what your system is doing? Or maybe that RC filter you wanted to do, but with just a meter instead of the motor?

- Patrick

Hi Patrick
This is the IO characteristics of a diferent motor. It’s a EMG30 (EMG30 data). Same driver (Arduino IBT2), same power supply (12V), same micro (Arduino nano), same program.
As you can see ther is no flat zone. Different color graphs have been obtained with different sample time. The larger the sample time, the smaller the measurement error as expected.

The problem with this motor is that the encoder has only 12 PPR which leads to big measurement noise if I use 10 msec sample time.
error=(1/0.01)(2pi/(1230))=1.74 rad/sec
while the error with the MG37D is
error=(1/0.01)
(2pi/(6430))=0.32 rad/sec

I think that this proves that the problem is in the motor MG37D not on the setup I’m using.
Can you, please, obtain the input-output characteristics of your MG37D and show me the results?.
Best regards.

Ok, we tried it. We used a Jrk motor controller to control the motor speed, sweeping the PWM duty cycle up from 0% in increments of about 0.2% (so we have over 500 data points per test), and we used an A-Star 32U4 Mini to measure the encoder speed. The graph below shows the results for a 12V 37D motor with the Jrk powered at 12V and a 24V 37D motor with the Jrk powered at 24V.

As you can see, we did not observe any flat spots or dead zones beyond the expected one at the lowest duty cycles, where the applied voltage is not yet high enough to get the motor started.

- Patrick

Hi Patrick
These are really high velocities. I’m working with the 30:1 gearbox and the velocity is under 200 RPM. Which gearbox are you using?
I don’t understand why the velocity is almost the same with 12V and 24V.

I think the problem can be in the way Arduino generates the PWM signal. I’m going to try with a different micro to see what happens.

Best regards

The results I posted report the speed of the encoder, which is on the motor and independent of the gearbox.

To make sure it’s clear, the red and blue curves show the speeds of two different motors. The blue is a 12V motor version powered at 12V and the red is a 24V motor version powered at 24V. The 12V and 24V motor versions are designed to be approximately the same speed at their respective nominal voltages.

- Patrick

By the way, if you are only measuring 200 RPM from your encoder, that is also an indication of a problem with the setup since it should be spinning on the order of thousands of RPMs. If that 200 RPM value is actually from calculating out the speed of the output shaft, I recommend you look directly at the encoder speed instead since that is one way you can simplify the setup to more directly see what is going on.

- Patrick

You’re right. I’m mesuring at the motor shaft but the graphs show the velocity at the output shaft. It’s just a question of scale. Dividing my velocity by the gear ratio matches your measurements.
But it is not a problem of measurement. I can hear the motor not increasing the velocity when it enters the flat zone. The graphs show the real, the true velocity of the motor. You can hear it even if you don’t measure the velocity.
I’ve tried with the non encoder version of the motor (using an external encoder to measure the output shaft velocity) and it seems to work better but there is a small flat zone.
I’m using millis function to measure the time to calulate the velocity and I’ve read that this can affect to the PWM signal. I’ll try to apply the control action without using the millis function, to see if I get a constant increasing of the velocity.
Thanks again for your help.