I want to drive two DC motors using DRV8835 with Adruino pro-mini.
Sometimes, two motors don’t work according to PWM signals.
I am using a PHASE/ENABLE mode.
My pin setting is as follows:
Driver <-------> Arduino pro-mini
BENBL pin <------> PWM pin 11
BPHASE pin <------> pin 12
AENBL pin <------> PWM pin 3
APHASE pin <------> pin 7
I am using 1s lipo battery and directly supply to VIN pin of the driver and Arduino raw pin together.
For powering to moter driver, I connect Vcc pin of Arduino with Vcc pin of driver.
Although HIGH signal should be transmitted to MODE pin in manual picture, I don’t transmit any signal to MODE pin.
When two motors work properly, the voltages in Bout1+Bout2 and Aout1+Aout2 are reasonable by PWM signals.
However, when two motors don’t work, although PWM signals are measured properly in Arudino pin,
the voltages in Bout1+Bout2 and Aout1+Aout2 are nearly zero and it starts beeping.
Am I missing something?
Thank you for your consideration.
Piecewise code:
int left_motor_in = 3;
int left_motor_out = 7;
int right_motor_in = 11;
int right_motor_out = 12;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void setup() {
init_motor();
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void loop(){
left_motor_go(200);
right_motor_go(200);
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void init_motor(){
pinMode(left_motor_in, OUTPUT);
pinMode(left_motor_out, OUTPUT);
pinMode(right_motor_in, OUTPUT);
pinMode(right_motor_out, OUTPUT);
}
//range:0<value<=255
void left_motor_go(int motor_speed){
analogWrite(left_motor_in, motor_speed);
digitalWrite(left_motor_out, LOW);
}
//range:0<value<=255
void right_motor_go(int motor_speed){
analogWrite(right_motor_in, motor_speed);
digitalWrite(right_motor_out, LOW);
}