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

Cannot drive two motors at the same time using the Dual VNH5019 Motor Driver Shield for Arduino


I set it to 12V as the motors did not turn at all at 7.2V. Even a motor has no load and a motor is connected to a wheel, the problem remains. Do you have other shields that can provide more current for two DC motors?



Since the current draw of a DC motor is proportional to the operating voltage, your motor’s stall current would be upwards of 60A when running it at 12V. We generally recommend choosing a motor driver that has a continuous current rating equal to or greater than your motor’s stall current. The VNH5019 shield is the highest power motor driver we carry in an Arduino shield form factor. and the only motor controller we carry that has a continuous rating of 60A of higher is the RoboClaw 2x60A Motor Controller. Since this is a motor controller, it uses higher level interfaces than our motor drivers do and has a lot more features. I recommend reading through the product page and user’s guide found in the “Resources” tab of the product page to see if it seems appropriate for your application.



Hi Brandon,

Thanks for the suggestion. I did some more testings.

When there was no load, at 7.5V, commanding both motors to turn forward or backward led to strange “doooooooo” sounds. Sometimes one motor turned very very slowly and the other not turning at all. Sometimes both motors did not turn.

When there was no load, at 11V, commanding both motors to move forward led to both motors moving forward. However, commanding both motors to turn backward led to one motor turning only. Strange “dooooo” sound was heard.

When there was no load, at 12V, both motors turned forward or backward as commanded.

At 12V, both motors turned as desired even with loads.
This time even at 11V with load, both motors turned as desired.

Do you know what is going on?

It seems that the system is unstable and unpredictable depending on the day I tried. How come even the recommended operation voltage for the motor is 7.2V, I need to increased the voltage to 11V to see some turning.

How come without load, I needed 12V to make both motors turned as desired. However, with load, both motors turned as desired at 11V. Also, sometimes one motor turned much faster than the other.


Just to be clear, are you using the VNH5019 shield in all of these tests? If so, what value of “motor_speed” are you using with the md.setM1Speed and md.setM1Speed commands? If you are not sending 100% duty cycle (e.g. a value of 400), the motor might not be getting the full input voltage and not have enough torque to turn. However, as I mentioned in my previous post, the VNH5019 shield is quite underpowered for those motors (especially at 12V). If the motor draws too much current, it can trigger the over-current protection on the VNH5109 and cut off the outputs. It is also possible that some of the variations you are seeing are due to the motors heating up. I strongly recommend switching to a more appropriate driver, and I do not think it would be useful to keep troubleshooting issues with using those motors with the VNH5019 shield.



Hi Brandon, yes I am using the VNH5019 shield in all these tests. As for the value of “motor_speed”, I use either 100 or -100 depending on which direction I want the motor to turn. Do you mean I should have used 400 or -400? Motors did not get heated up in any situation.

I tried ±200 and ±400, the original issue is fixed. However, now I have a new problem. The motors moved more than required at each iteration of the loop. For example, pressing F button turned the motors forward while pressing the B button turned the motors backward. Using ±100, the motors turned by 20 degrees when I pressed F. Then, they turned by -20 degrees when I pressed B. When I increased the values to ±200, pressing F turned the motors by say, 50 degrees. Even I pressed button B immediately after button F, the motors continued to move forward for awhile before they moved backward. Is there a solution to this?


Yes, our Arduino library for the VNH5019 shield accepts speed values from -400 (full-speed reverse) to +400 (full-speed forward).

It sounds like you are doing open-loop position control of a DC motor using timing, which is typically inaccurate. If you need precise position control, you might consider looking into adding a potentiometer or encoder for doing closed-loop feedback control.



Thanks Brandon. Actually what does md.setM1Speed(speed_parameter) really do when Arduino encounters this statement? How long does such statement takes to complete? I suppose if it takes 500ms to complete, then the motor turns more if I use ±400 as the speed parameter. If I use ±100 as the speed parameter, then the motor turns less perhaps by 1/4. That might be why when I increased the value of the speed parameter, I got some kind of overshoot problem. Also, before the statement is completed (500ms in this example), whatever command I issue (e.g. changing the direction) is ignored. Am I correct? Is it true that when I use ±400, the board can generate more current to create more torque than when I use ±100?

Usually potentiometer or encoder came with some motors. Do you have ones that are generic for a wide variety of DC motors?


The VNH5019 (like most motor drivers) outputs a duty cycle-controlled PWM signal. The speed_parameter you are referring to specifies the duty cycle of the PWM, so a higher duty cycle increases the effective voltage to the motor (resulting in increased speed and torque). The delay between receiving the signal and changing the output should be on the order of miliseconds (e.g. a couple orders of magnitude less than 500ms), and it should not ignore any commands issued directly after it. The direction signal is on another input pin, so a change in this signal should always affect the driver (e.g. once you set the direction output on the Arduino, it will stay outputting that signal until it is changed again). I suspect the overshoot you are seeing is due to the motor coasting to a stop.

We do not carry any generic feedback solutions; the only encoders that we carry separately are the encoders intended for our micro metal gearmotors.



Thanks Brandon, is there a way to reduce or avoid the overshoot? Imagine I am controlling the spinning direction of the motor using a remote controller. Right now, it takes time for the motor to change direction. Sometimes it causes problems due to a delay in responding correctly from the motor.


My recommendation for avoiding overshoot with your motor would be to add some type of feedback, as I mentioned before.



Thanks Brandon. You mentioned that I should have used ±400 as the parameters since a higher duty cycle increases the effective voltage to the motor (more torque). I found that the problem of one motor turning while the other either turning very very slowly or not turning at all could be eliminated when I had large values as the parameters. So, it is good to use ±400. However, larger values also means motors turning faster. What if I want to have a lower speed motion? I suppose the reason md.setM1Speed(motor_speed); accepts values from -400 to 400 is to allow a wide range of speeds depending on the user’s need. I have already added a gear head to each motor.


The speed and torque of a DC motor is proportional to the operating voltage. Since the duty cycle controls the effective voltage to the motor, you can adjust the duty cycle to set the speed and torque your application needs, as you mentioned.



Hi Brandon, can I set the speed and the torque independently? From you replies, I use md.setM1Speed(400) to create high speed turning and high torque. What if I want lower speed but higher torque? Can adding a delay statement after each call of md.setM1Speed(400) achieve this?


Speed and torque of a brushed DC motor are both proportional to the operating voltage and are properties of the gearmotor you are using. The driver cannot adjust the parameters of the motor beyond the relationship they have with the operating voltage. Adding a delay statement after setting the duty cycle will simply run the motor at the specified duty cycle for the delay time before moving on to the rest of your code.

It sounds like you might not have tried to research or understand the problem before coming up with possible solutions. If the problem is still the same as you described before, I have already given you my recommendation of adding feedback. Beyond that, if you just need your motor to move slower with higher torque, you might consider switching to a higher gear ratio or adding an additional reduction.



Hi Brandon, thanks for your reply. I am not doing closed loop control in this application.

Just to clarify a few points before moving on. How many msec does each md.setM1Speed() statement run? Supposing 3 msec, does having a delay(2.5) statement after md.setM1Speed(400) allows the md.setM1Speed(400) command to execute for 3+5.5 msec? If that is the case:


will have more overshoot than:


The larger the delay value, the more overshoot. Am I right?


Once you call md.setM1Speed() the output of the motor channel will stay at the duty cycle you commanded until you change it again. For example, if you call md.setM1Speed(400), followed by delay(50), then md.setM1Speed(-400), the motor output will be at 100% duty cycle for 50ms, then switch to 100% duty cycle in the opposite direction. How this relates to overshoot depends on your motor and system. By the way, the parameter passed to the delay function in Arduino is in terms of milliseconds and is interpreted as an unsigned long, so I suspect it will truncate floats like 2.5.



Hi Brandon, thanks for the reply. What happen in the following two cases:

  1. md.setM1Speed(400) immediately followed by md.setM1Speed(-400).
    For how long will md.setM1Speed(400) be executed? From your example, it seems to be 1ms.

  2. md.setM1Speed(400) immediately followed by md.setM1Speed(-400) and repeat. If the output of the motor channel will stay at the duty cycle commanded until I change it again, will the motor oscillate back and forth by 1ms? Will the time be so short that it does not appear to be turning or just vibrate?

How come 50ms becomes 2.5ms?


It sounds like your questions are essentially asking how long it takes the Arduino to execute the commands and for the driver to react to the change in the signal. However, the motor is unlikely to respond to the output that fast, so knowing the intricate timing details is probably not going to solve the problem. Additionally, frequently switching from full-speed in one direction to full-speed in the other direction is likely to cause large current spikes, which as we have already discussed, could cause problems since the VNH5019 shield is underpowered for your motor.

Sorry about the confusion at the end of my last post; I was not saying that 50ms will become 2.5ms, I was referring to your example of 2.5ms. The delay command will likely not accept floating point numbers (e.g. numbers with decimal points), so if you use delay(2.5), it will likely be interpreted as delay(2).

Right now it sounds like you are new to working with microcontrollers and motors, and thus many of your questions do not seem like they would actually be very helpful in putting together your project. If you tell me what the larger project you want to control your motors for is, I might be able to suggest ways to get started and what types of things you will need to research for it.



A post was split to a new topic: Strange behavior from VNH5019 driver carrier


A post was split to a new topic: Arduino CNC Shield