Hello All,
I want to control two dc motors with a VMA03 and an arduino.
I have stacked the VMA03 on top of the arduino and wired an external 12V dc power supply and DC motor to the VMA03 as shown below
I ran the standard code show bellow. The motor makes noise but doesn’t move, I believe that it may be getting power from the arduino instead of the external power source, but I don’t know how to fix this
int pwm_b = 9; //PWM control for motor outputs 3 and 4
int dir_b = 8; //direction control for motor outputs 3 and 4
void setup()
{
//Set control pins to be outputs
pinMode(pwm_b, OUTPUT);
pinMode(dir_b, OUTPUT);
//set both motors to run at (100/255 = 39)% duty cycle (slow)
analogWrite(pwm_b, 100);
Hello,
Thank you for your advice, it has worked.
but I run into another problem, which is the motor only works in one direction even though it’s a bidirectional motor.
The code that works:
int pwm_a = 3; //PWM control for motor outputs 1 and 2
int pwm_b = 9; //PWM control for motor outputs 3 and 4
int dir_a = 2; //direction control for motor outputs 1 and 2
int dir_b = 8; //direction control for motor outputs 3 and 4
void setup()
{
pinMode(pwm_a, OUTPUT); //Set control pins to be outputs
pinMode(pwm_b, OUTPUT);
pinMode(dir_a, OUTPUT);
pinMode(dir_b, OUTPUT);
}
void loop()
{
delay(1000);
digitalWrite(dir_b, LOW);
analogWrite(pwm_b, 150);
}
The code that doesn’t work :
int pwm_a = 3; //PWM control for motor outputs 1 and 2
int pwm_b = 9; //PWM control for motor outputs 3 and 4
int dir_a = 2; //direction control for motor outputs 1 and 2
int dir_b = 8; //direction control for motor outputs 3 and 4
void setup()
{
pinMode(pwm_a, OUTPUT); //Set control pins to be outputs
pinMode(pwm_b, OUTPUT);
pinMode(dir_a, OUTPUT);
pinMode(dir_b, OUTPUT);
}
void loop()
{
delay(1000);
digitalWrite(dir_b, HIGH);
analogWrite(pwm_b, 150);
delay (2000);
}
It’s good that you sent a link to the motor.
I see a few problems.
The are the specs of the VMA03
2.5 A (max.) output current (each channel)
50 V (max.) external power supply input
used pins on an Arduino UNO board can be selected to accommodate for other stacked shields
dimensions: 68 x 53mm / 2.67 x 2.08"
The max current output the VMA03 can provide is 2.5 amps.
The current draw of the motor is 6 amps.
You may have damaged the B channel.
Thank you, It appears that you are right, as I tried it on another VMA03 controller and it worked.
One last question, do you think it is possible to use two VMA03 motor controllers to supplied higher current to the motor, if so how do you suggest I do it.
Sorry if the questions seem too basic, as I just started learning.
Just my opinion but this could cause an issue.
On two Arduinos if you are using a PWM while one pulse is going up the other may be going down and cancel each other out. If you are asking about stacking them in them on top of each other I really don’t know. I haven’t tried that.
Yes I mean stacking them on top of each other and connecting the output of the two channels to the same dc motor.
Theoretically I think it should be possible but I’m not sure.
I would have to check into it but I think the max current the outputs of the Arduino can provide is 40mA I don’t know how much current each pin of the VMA03 requires.
I have been playing with the Arduinos a lot but will admit I don’t know everything there is to know.
You may want to look at the VMA411 however if you go over 1 amp you will need a heat sink to go up to 5 amp. https://www.vellemanusa.com/products/view/?id=528446
Hi Worng_way,
I am an beginner and 1 want to drive 2 dc motors with this shield and a 7V 1500mah and i have the same problem. I tried your solution but it did not worked for me the arduino went fully silent . Wen i put the pin back to INT it goes back to driving the motor from the uno board.
Yes I have a 7.4 V battery pack connected to the shield, the uno is hooked up to 6v AA batteries , so when the pin is set to int the motors respond but weak when i put it to ext it goes fully silent incl the uno board.
From your picture I tell what’s going on.
You should check the polarity for both units from the batteries.
Also check the current draw of your motor it maybe more then the batteries can handle.