Hi everybody!
Ok so recently I received my SN75441ONE h-bridge chip (SN754410NE datasheet(1/7 Pages) TI | QUADRUPLE HALF-H DRIVER) and so begun to immanently play with it. At first I wired it to my Arduino and powered a small motor off it using the Arduinos +5v, then I added to small motors and they worked fine. Then I added 2 push buttons and some more complicated code as shown below:
int leftEnable = 12;
int out1 = 11;
int out2 = 10;
int button1 = 9;
int button2 = 8;
int rightEnable = 7;
int out3 = 6;
int out4 = 5;
int val1;
int val2;
void setup(){
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(leftEnable, OUTPUT);
pinMode(rightEnable, OUTPUT);
pinMode(out1, OUTPUT);
pinMode(out2, OUTPUT);
pinMode(out3, OUTPUT);
pinMode(out4, OUTPUT);
}
void loop(){
val1 = digitalRead(button1);
val2 = digitalRead(button2);
if (val1 == HIGH && val2 != HIGH){
leftForward();
rightForward();
}
else
{
leftDisable();
rightDisable();
}
if (val2 == HIGH && val1 != HIGH){
leftReverse();
rightReverse();
}
else
{
leftDisable();
rightDisable();
}
if (val1 == HIGH && val2 == HIGH){
leftReverse();
rightForward();
}
else
{
leftDisable();
rightDisable();
}
}
void leftReverse(){
digitalWrite(leftEnable, HIGH);
digitalWrite(out1, HIGH);
digitalWrite(out2, LOW);
}
void rightReverse(){
digitalWrite(rightEnable, HIGH);
digitalWrite(out4, HIGH);
digitalWrite(out3, LOW);
}
void leftForward(){
digitalWrite(leftEnable, HIGH);
digitalWrite(out1, LOW);
digitalWrite(out2, HIGH);
}
void rightForward(){
digitalWrite(rightEnable, HIGH);
digitalWrite(out4, LOW);
digitalWrite(out3, HIGH);
}
void leftDisable(){
digitalWrite(leftEnable, LOW);
}
void rightDisable(){
digitalWrite(rightEnable, LOW);
}
This code is made so that when one of the push buttons in pressed both motors drive forward, when the other is pushed they both drive backwards and finally if are both pushed then one motor drives forward and the other backwards. I uploaded the code and added the 2 small motors and it all went well now being externally powered with a +9v battery. Anyways I decided the motors where not powerful enough for what I wanted so I took 2 out an old R/C car which was powered by 5 AA batteries. I simply replaced the older smaller motors with the new bigger ones and added another +9v battery in serial to get 12v as shown in my picture.
My problem is that the motors no longer run unless spun at first by hand, also the left seems to run better than the right? Could somebody please tell me where I am going wrong? Amps? volts? wiring? coding?
Thanks, Sam.