Hi,
I am using an arduino UNO clone I made which is working fine, got the same problem with official Arduino.
See attached the full schematic.
Here is a simple code :
//motors
int motor_Right = 5; // PIN n°11
int motor_Left = 6; // PIN n°12
int enable_motor_Right = 8; // PIN n°14
int enable_motor_Left = 9; // PIN n°15
//Const
const int motor_Stop = 127; //PWM at 1/2 to stop motors
//INITIALISATION
void setup() {
// Set PWM to 62500 Hz
TCCR0B = TCCR0B & 0b11111000 | 1;
pinMode(motor_Right, OUTPUT); //motor_Right as output
pinMode(motor_Left, OUTPUT); //motor_Left as output
pinMode(enable_motor_Right, OUTPUT); //motor_Right as output
pinMode(enable_motor_Left, OUTPUT); //motor_Left as output
digitalWrite(enable_motor_Right, LOW);
digitalWrite(enable_motor_Left, LOW);
analogWrite(motor_Right, motor_Stop); //motor_Right OFF
analogWrite(motor_Left, motor_Stop); //motor_Left OFF
}
//MAIN
void loop()
{
}
I am using a 14.8 V, Lithium-ion, 3.45 Ah battery and 12 V, 18 t/min, 8 N-cm motors. I know 15V is a little bit hard for my 12V motors but this, I think, is not the problem.
I am controlling the motors with a simple L293D H bridge and I have even tried with a H bridge based on a HIP4080AIPZ.
My problem is at power ON. Before the Arduino gets totally setup my motors spins and sometimes I have to switch on and off multiple times the board before it gets really on.
I believe this is what is happening : at cold power ON, capacitor C35 and C23 are discharged, so the peaks current from the two motors (spinning at power ON even though they shouldn't) are dropping the battery current so the system can't start, but after a few tries the caps are charged so they can absorb the peaks current.
I tried pull-down resistors on enable and command pins but nothing changed.
What am I doing wrong ? What should I do to prevent the motors from spinning at power ON ?
Hope I made myself understandable.
Thank you for your help.