Hello guys,
I´ve got a problem with the VNH5019 dual motor driver shield. I´m using it on an Arduino Mega2560 powering two brushed 12V DC gear-motors. The power source I use is a 11.1V LiPo pack.
My setup is as simple as possible: Arduino + VNH5019 shield + 2 motors + LiPo pack
Now here´s the thing: When I use the demo program for the shield, everything works just fine. Both motors run as they should. No problems. But when I try to power both motors at the same time (the code I used can be found below), some weird stuff happens.
You can see the run of the two motors over the time in the picture I attached to this post.
Basically spoken, when both motors should run forward, motor2 does nothing while motor1 is running as it should. When both motors should go backwards, motor2 is running as it should while motor1 is going backwards at full speed without the increasing and decreasing the program tells it to do. Then motor2 does nothing again and so on.
This problem keeps existing when I change the motors and even when I disconnect one of them.
Because the motors work fine when powered separately or one after another and I don´t think the code to be the problem, there has to be something wrong with the shield.
Here is the code I used:
#include "DualVNH5019MotorShield.h"
DualVNH5019MotorShield md;
void stopIfFault()
{
if (md.getM1Fault())
{
Serial.println("M1 fault");
while(1);
}
if (md.getM2Fault())
{
Serial.println("M2 fault");
while(1);
}
}
void setup()
{
Serial.begin(115200);
Serial.println("Dual VNH5019 Motor Shield");
md.init();
}
void loop()
{
for (int i = 0; i <= 400; i++)
{
md.setSpeeds(i,i);
stopIfFault();
delay(2);
}
for (int i = 400; i >= -400; i--)
{
md.setSpeeds(i,i);
stopIfFault();
delay(2);
}
for (int i = -400; i <= 0; i++)
{
md.setSpeeds(i,i);
stopIfFault();
delay(2);
}
}
I hope anyone can help me. I really don´t know what to do next.
This seems all pretty weird to me.
Thank you for every answer.
Greetings
Phil