I’m using the VNH5019 to drive a tracked vehicle with two motors. The control works, but eventually the motors get stuck at full speed forward or backwards without giving the command. I then have to repower the entire system.
On the vehicle I use a arduino uno and the VNH5019 to control the two motors. The data comes from a HC-12 rf module. The entire unit is powered by a 11.1 V Lipo battery. I have already installed three 100nF caps on each motor without any improvement.
On the transmitter I use a arduino mini pro, which gets the commands from a x/y joystick and sends it with another HC-12 module. The unit is powered by 4x 1.5V batteries (regulated down to 5V).
For the code I used the original library from pololu.
Any help is very much appreciated!
The VNH5019 shield connects the current sense feedback pins (M1CS and M2CS) to Arduino pins A0 and A1, which your script uses for SoftwareSerial. This might explain the behavior you are seeing. Can you try initializing SoftwareSerial on an unused pair of pins and see if that changes anything? You can see what Arduino pins are being used by the shield in this diagram:
If that does not work, you might try investigating your transmitted signals to determine under what conditions they are sending your full speed forward and full speed reverse commands to see if that matches your expectations. For that, you could try disconnecting your motors from the VNH5019 shield, connecting the Arduino that is connected to that shield to your computer, and reading what commands are being sent with the Serial Monitor.
Thanks for your reply! I managed to change the SoftwareSerial to pin A2 and A3, but the motors still get stuck at full speed. I also checked the received characters on the receiver side. These commands are fine, the transmitters sends all characters according to the movement of the joystick. Also, the motors keep running even when I turn off the transmitter…
In general when troubleshooting, it is good to simplify your system as much as possible and make sure each part is working before incrementally adding back in components to figure out where the issue is. To try that with your system, and verify that there is not a problem with the driver, can you load the VNH5019 Arduino Demo.ino sketch to the Arduino connected to the VNH5019 shield and let it run for a while to see if you ever get the same full-speed forward or full-speed backward behavior?
Also, can you describe the behavior you are getting and the data you saw more? It sounds like your system works normally for some time, then after a while, the robot begins to go full-speed forward or full-speed reverse (which sounds like either the ‘A’ or ‘E’ case in your code). When the robot is stuck rotating at those speeds, are you saying that on the Arduino IDE Serial Monitor you can see the
cmd value updating as you expect from manipulating your transmitter, but the robot ignores the new
cmd values? Or are you seeing only your full-speed values at the receiving Arduino, regardless of what commands you are transmitting?
I kind of solved my problem. I found out that the strange behaviour resultet from noise (probably from the motors) that found a way into the rf receiver. I had the ground from the rf receiver antenna connected to the chassis of the tracked vehicle. So I assume the noise went from the motors, which are of course connected to the chassis, into ground of the rf. Therefore I decoupled the rf receiver ground from the chassis. For now the motors behaive according to the commands given via rf.
I am glad you figured out what the issue was; thanks for letting us know.