Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

VNH5019 not linear


Dear all,

I bought the Dual VNH5019 motor driver shield for Arduino and I’m currently trying to use it on the Arduino Mega.
I did the recommended hardware modifications (Modified VNH5019 shield library for 20kHz PWM with Mega) and use the modified library.
The shield works so far and I also get correct values for setSpeed(0) and setSpeed(400). However, the curve between these points is not linear at all. I took some measures and it looks like a log function.
The Arduino outputs are fine, but it seems that the shield does not work in a proportional way when translating the input into the output voltage.

Is that the correct behaviour? Or do I miss something there?

Thanks very much for your help!



In general, the relationship between PWM duty cycle and motor speed can depend on a number of factors, including the PWM frequency, the details of how the driver operates (e.g. fast decay or slow decay), and even the motor itself. This old forum thread gives some examples:

What motors are you using? How are you measuring the speed? I expect what you are seeing is normal for your particular setup, but if you post a plot that shows the speed you are observing as a function of duty cycle, I can see if anything looks obviously amiss.



Hi Jon

Thanks very much for your response.
I use a Maxon DC motor RE25 (www.maxonmotor.com/maxon/view/product/118751).

The plot shows the measured output voltage (with the attached motor, but without any load) on the y axis in reference to the input :

Do you know how I could change to “brake mode” instead of “coast mode”?

Thanks very much.


Thanks for the graph; I think that is just normal behavior for the combination of the VNH5019 and your motor. Unfortunately, it is not practical for the VNH5019 to operate in drive-brake mode since the inputs required to do that are not capable of high-speed switching, so there is not much that can be done besides trying to compensate for the nonlinearity in software or using closed-loop feedback to control the speed. One thing you could try is playing around with the PWM frequency to see if that has any effect on linearity, and you could try applying some load to see if that changes anything.


PWM behaving oddly for Dual VNH5019