Using VNH5019 motor drivers with matlab

Hi everyone,

I would like to control my 4 dc motors using matlab instead of arduino ide. I am planning to use 2 arduinos and 2 vnh5019 dual motor drivers. It looks like the library of VNH5019 is designed for arduino ide. Is it possible to somehow use this library in matlab? If not, is it possible to somehow drive the motors via VNH 5019 over matlab?

Thank you,
Mr. Kaan Yılmaz

Hello.

Yes, our Arduino VNH5019 library is written for the Arduino IDE, so it has no features that help people use MATLAB. However, you could still use it in a system that sends commands to an Arduino from MATLAB. (We do not have any examples for doing that.)

By the way, if you just want to control your motors over a USB interface, you might consider using four of our Simple Motor Controllers. You could write MATLAB code to send serial commands to the Simple Motor Controller’s virtual serial port over USB.

-Jon

1 Like

Thank you for your answer.

Actually, we changed the way we are planning to drive the dc motor. We have 2 VNH5019 and 1 Arduino due. Is it possible to connect 2 VNH5019 to 1 Arduino Due and drive the all 4 motors (Because of all VNH5019’s pwm1 and pwm2 use the timer 1 of Arduino)?

This same setup was asked about elsewhere on the forum, and I agree with JeremyT’s response: [quote=“JeremyT, post:2, topic:7100”]
You should be able to control four DC motors with two VNH5019 shields using your Arduino Due. However, I am not sure how easy it would be to stack them and remap the pins. It might be easier to use the pins that are broken out on the left side of the board…
[/quote]

That is an older post, so you might also try searching our forum to see if anyone else has posted about their experience stacking the shields. One phrase you can search for is two VNH5019.

-Jon

Thank you Jon. To make it clear, you think that it would be possible to use VNH5019 library with Arduino Due even if I used only 1 VNH5019 but if using two then it requires library editing? I am asking this because it seems like Arduino Due requires different libraries than Mega.

Kaan Yılmaz

The VNH5019 shield and the Arduino library we wrote for it should work with an Arduino Due and the only thing you might be concerned about is the Due’s ability to read the current sense pins. You can learn more about this in the “Note for Due users” box under the “What You Will Need” section of the VNH5019 shield’s user’s guide, which can be found under the “Resources” tab of the shield’s product page.

-Jon