Triple8 H bridge (from Lawnbot 400) wiring

I built the triple8 H bridge from the lawnbot400 project ( http://www.instructables.com/id/Arduino-RC-Lawnmower/?&sort=ACTIVE&limit=40#DISCUSS the Motor driver is in step 2) and was hoping someone could answer some basic questions for me.

  1. i finished the build with the limited instructions available and think i have it right. when i connect the bridge to my 12v power supply the power LED lights, and the connected motors both turn on. Not sure if the default state is for the motors to be be on or off, as that info is not mentioned. at least they are both doing the same thing. lol
  2. How would I connect this to my arduino. Most designs i can find feature an enable pin and 2 control pins per motor. would i pick enable and 1st control (or 2nd) or the pair of control pins?
  3. related to item 2. i connect the wires as indicated in the following sketch and power up the h-bridge. motor(s) start and I will hear a blip and feel a change in the motor but it does not stop or seem to change direction (unless that happens in a blink of an eye). i have tried pins 2,3, and 2,9 but do not see much of a change.
  4. i would like to have an inexpensive h-bridge that can do motor direction and speed, as well as differential steering. as this bridge is only 2 wires I do not think i can alter speeds unless i accomplished via changing power from battery.

//Code by Reichenstein7 (thejamerson.com)

//Keyboard Controls:
//
// 1 -Motor 1 Left
// 2 -Motor 1 Stop
// 3 -Motor 1 Right
//
// 4 -Motor 2 Left
// 5 -Motor 2 Stop
// 6 -Motor 2 Right

// Declare L298N Dual H-Bridge Motor Controller directly since there is not a library to load.

// Motor 1
int dir1PinA = 2;
int dir2PinA = 3;
int speedPinA = 9; // Needs to be a PWM pin to be able to control motor speed

// Motor 2
int dir1PinB = 4;
int dir2PinB = 5;
int speedPinB = 10; // Needs to be a PWM pin to be able to control motor speed

void setup() { // Setup runs once per reset
// initialize serial communication @ 9600 baud:
Serial.begin(9600);

//Define L298N Dual H-Bridge Motor Controller Pins

pinMode(dir1PinA,OUTPUT);
pinMode(dir2PinA,OUTPUT);
pinMode(speedPinA,OUTPUT);
pinMode(dir1PinB,OUTPUT);
pinMode(dir2PinB,OUTPUT);
pinMode(speedPinB,OUTPUT);

}

void loop() {

// Initialize the Serial interface:

if (Serial.available() > 0) {
int inByte = Serial.read();
int speed; // Local variable

switch (inByte) {

//Motor 1

case ‘1’: // Motor 1 Forward
analogWrite(speedPinA, 255);//Sets speed variable via PWM
digitalWrite(dir1PinA, LOW);
digitalWrite(dir2PinA, HIGH);
Serial.println(“Motor 1 Forward”); // Prints out “Motor 1 Forward” on the serial monitor
Serial.println(" "); // Creates a blank line printed on the serial monitor
break;

case ‘2’: // Motor 1 Stop (Freespin)
analogWrite(speedPinA, 0);
digitalWrite(dir1PinA, LOW);
digitalWrite(dir2PinA, HIGH);
Serial.println(“Motor 1 Stop”);
Serial.println(" ");
break;

case ‘3’: // Motor 1 Reverse
analogWrite(speedPinA, 255);
digitalWrite(dir1PinA, HIGH);
digitalWrite(dir2PinA, LOW);
Serial.println(“Motor 1 Reverse”);
Serial.println(" ");
break;

//Motor 2

case ‘4’: // Motor 2 Forward
analogWrite(speedPinB, 255);
digitalWrite(dir1PinB, LOW);
digitalWrite(dir2PinB, HIGH);
Serial.println(“Motor 2 Forward”);
Serial.println(" ");
break;

case ‘5’: // Motor 1 Stop (Freespin)
analogWrite(speedPinB, 0);
digitalWrite(dir1PinB, LOW);
digitalWrite(dir2PinB, HIGH);
Serial.println(“Motor 2 Stop”);
Serial.println(" ");
break;

case ‘6’: // Motor 2 Reverse
analogWrite(speedPinB, 255);
digitalWrite(dir1PinB, HIGH);
digitalWrite(dir2PinB, LOW);
Serial.println(“Motor 2 Reverse”);
Serial.println(" ");
break;

default:
// turn all the connections off if an unmapped key is pressed:
for (int thisPin = 2; thisPin < 11; thisPin++) {
digitalWrite(thisPin, LOW);
}
}
}
}

Rule - Instructables are crap, do not follow them unless you know exactly what you are doing and can correct the inevitable errors. Have you taken into account this comment.

lucassiglo215 years agoReply i am seeing your schematic, and, sorry to say, it's wrong. All the P-channel mosfets are reversed, you have a pair of p-channel mosfets on each H-bridge disconnected from the power. But apparently you fixed those two things on your PCB, it's a trap for beginners, you should fix it.

You have no back EM protection, not even a diode, and the mosfets are too small in voltage, i used 100v mosfets with a 24vdc motor, 12A and they just exploded, all the protection died, and the microcontroller died. We measured the inductive peaks in approximately 200v, and you have 2 times the current here. You have no hardware protection to prevent both sides of the H-bridge from turning on at the same time. We even used toric transformers and 100uf capacitors next to the motor and, even then, it exploded, with fire and everything.

The only solution that worked, after a year of trying (we didn't find something like a BTS7960 in my city, we looked for it) was to use a double inverter relay in series with 2 500v 8A mosfets in parallel, plus all the usual diode based protections, thermistor based protections, capacitor based protections, and, of course, optoisolated from the control logic.

that was for an electric wheelchair.

so, if your circuit worked, the motors are almost magic, you are extremely lucky, or you are omitting something.

Read the how to use this forum sticky, and modify that first post so it complies with the rules on posting.

Then post your question properly showing the schematic of what you made.

4) i would like to have an inexpensive h-bridge

DIY h-bridges from internet schematics rarely actually work as expected. Perhaps you should try an h-bridge like below.

http://www.ebay.com/sch/i.html?_odkw=43a+driver&_sop=15&LH_BIN=1&_osacat=0&_from=R40&_trksid=p2045573.m570.l1313.TR0.TRC0.H0.X+43a+driver.TRS0&_nkw=+43a+driver&_sacat=0

The H-bridge in that instructable will only work with synchronous rectification or fast-decay, note, so you can't park it in braking mode. If you want dynamic braking you'll need to close a servo loop.

Many H-bridges allow all 4 switches to be independently controlled so you can use any mode.

This one is 2 wire, and you'll have to ensure enough dead-time between driving one wire and the other to avoid shoot-through. The schematic and layout aren't in step, note, the schematic is definitely wrong BTW (p-channel source/drain confused)