monster moto shield VNH2SP30 and matlab

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!

Moderator: phalanx

Post Reply
koronus
Posts: 6
Joined: Mon Dec 24, 2018 1:05 am

monster moto shield VNH2SP30 and matlab

Post by koronus » Sat Jan 05, 2019 12:55 am

hi
how I could programming for controlling a dc motor with monster moto shield and Matlab?
I use:

Code: Select all

a=arduino('com9','uno');
writeDigitalPin(a,'D7',1);
writeDigitalPin(a,'D8',0);
but nothing happened!
and the dc motor does not run

paulvha
Posts: 302
Joined: Sat Nov 11, 2017 2:39 am

Re: monster moto shield VNH2SP30 and matlab

Post by paulvha » Sat Jan 05, 2019 5:43 am

That code will do nothing. look at https://www.sparkfun.com/products/10182, documents-tab, and look for sample code (download directly or on github) It will be a good starting point

koronus
Posts: 6
Joined: Mon Dec 24, 2018 1:05 am

Re: monster moto shield VNH2SP30 and matlab

Post by koronus » Sun Jan 06, 2019 1:27 am

paulvha wrote:
Sat Jan 05, 2019 5:43 am
That code will do nothing. look at https://www.sparkfun.com/products/10182, documents-tab, and look for sample code (download directly or on github) It will be a good starting point
I know that but this code is just for Arduino and its format is PDE but I want to run the motor with Matlab and as the datasheet of the monster moto shield the digital pins 7 and 8 are used to run the dc motor but why it does not work?

BLH
Posts: 20
Joined: Tue May 29, 2018 4:50 am

Re: monster moto shield VNH2SP30 and matlab

Post by BLH » Sun Jan 06, 2019 7:00 am

Are you inputting the other signals that maybe needed to run the motor or are you expecting D7 and D8 signals alone will run the motor?
Although for Arduino. The example code also shows what other signals are used.

koronus
Posts: 6
Joined: Mon Dec 24, 2018 1:05 am

Re: monster moto shield VNH2SP30 and matlab

Post by koronus » Sun Jan 06, 2019 9:34 am

BLH wrote:
Sun Jan 06, 2019 7:00 am
Are you inputting the other signals that maybe needed to run the motor or are you expecting D7 and D8 signals alone will run the motor?
Although for Arduino. The example code also shows what other signals are used.
No, I just used D7 and D8 signals

BLH
Posts: 20
Joined: Tue May 29, 2018 4:50 am

Re: monster moto shield VNH2SP30 and matlab

Post by BLH » Sun Jan 06, 2019 11:51 am

It will not run with only D7 and D8 being used

Other signals are needed to enable the IC's. I can't say exactly all that will be needed. As I have no experience with the IC's or the board. Just what the schematic and data sheet provided.

The enable, PWM determines speed. INA, INB determine which direction the motor runs. According to the data sheet.
The schematic shows some of the signals pulled low by resistors. So they can't be unconnected and need to be used for a signal input.

I hope you can get someone with actual use of the board to give you more definite information.

koronus
Posts: 6
Joined: Mon Dec 24, 2018 1:05 am

Re: monster moto shield VNH2SP30 and matlab

Post by koronus » Sun Jan 06, 2019 11:57 am

BLH wrote:
Sun Jan 06, 2019 11:51 am
It will not run with only D7 and D8 being used

Other signals are needed to enable the IC's. I can't say exactly all that will be needed. As I have no experience with the IC's or the board. Just what the schematic and data sheet provided.

The enable, PWM determines speed. INA, INB determine which direction the motor runs. According to the data sheet.
The schematic shows some of the signals pulled low by resistors. So they can't be unconnected and need to be used for a signal input.

I hope you can get someone with actual use of the board to give you more definite information.
ok thank you so much

koronus
Posts: 6
Joined: Mon Dec 24, 2018 1:05 am

Re: monster moto shield VNH2SP30 and matlab

Post by koronus » Mon Jan 07, 2019 12:56 pm

BLH, thank you so much, you were right it will not run only with D7 and D8 and it needs the speed (PWM D5)
and the correct code is:

Code: Select all

a=arduino('com9','uno');
writePWMVoltage(a,'D5',3);
writeDigitalPin(a,'D7',1);
writeDigitalPin(a,'D8',0);

Post Reply