PWM behaving oddly for Dual VNH5019

I have a Dual VNH5019 shield and a Uno. I’ve connected the shield to a 37d 30:1 and a 11.3V lithium battery. Then I tried to run a very simple program using the Pololu library which starting at speed 0 did the following:
increment speed
wait 2s
reset encoder counts
wait 2s
calculate speed
print out speed
The program was run on an unloaded motor that had a wheel attached to the shaft. It worked exactly as expected. It’s simple, so I won’t bother to post code unless needed.

The results were troubling. To begin with, at 5 counts, the motor started to turn but it was turning at about 30RPM (way too fast for such small counts). By 50 counts it was up to about 70RPM. Between 50 and 250 it is pretty darned linear, reaching 240RPM at 250 counts. Then it topped out at 350RPM at about 330 counts and further counts had no significant effect. Very unexpected to be so non-linear and in such a bizarre way.

But wait, there’s more. I measured with a DMM and the high side was consistently at 11.3V (as expected). The low side seemed to be as non-linear as the speed (i.e. the speed seems linear with the voltage across the motor but the voltage doesn’t seem linear with the “speed” setting (PWM count). Note that I don’t trust any DMM to read the voltage as it doesn’t necessarily read properly with PWM waveforms.

And another thing. At some count increases, it indicated the motor slowed down. This corresponded to a sound of lower speed (lower frequency motor whirr) and a lower voltage across the motor. Now I might not trust the DMM to give an accurate reading, but I would expect the reading to monotonically increase and I trust my ears!!!

So what is going on? Does it have anything to do with drive-coast vs drive-brake? Does it have anything to do with the inductance and, perhaps, resonance? What the dickens?

I will rerun tests and collect the current reading from the driver, but perhaps someone knows what is going on? Perhaps someone knows another test I could run?

Keith

Hello, Keith.

The VNH5019 uses a drive-coast cycle, which can result in this type of non-linearity. The advice in this forum post might be helpful for you.

-Nathan