Introduction: Dual Motor Driver With Arduino Using a SN754410NE Quad Half H-Bridge

Picture of Dual Motor Driver With Arduino Using a SN754410NE Quad Half H-Bridge

A step by step project guide by ArduinoFun


With this Instructable I am going to show you how to use a SN754410NE Quad H-Bridge IC to control two 12 volt DC Motors.

I have added a video so that you can see the Dual Motor in action.  As you can see in the video, all the wires can be a little confusing to look at.  To make things easier to view and understand as we go along, I have also created an illustration for you to refer to.  You may also download a printable PDF file of this illustration.  I have depicted an Arduino board in the illustration, if you already have one you are good to go, if not... you can do like I have and Build Your Own Arduino following another one of my instructables.



Breadboard Illustration - You may also download a printable PDF file of this illustration
Duel Motor H-Bridge Setup


Step 1: Parts List

Picture of Parts List
Here is the recommended parts you will need in order to complete this project. I have provided sources where you can purchase items from and their prices.  These parts are available at others sites as well.
  1. Arduino board - $29.95 at CuriousInventor.comor...
  2. Build Your Own Arduino - Total build cost $15.95 at ArduinoFun.com
  3. SN754410 Quad Half H-Bridge - $2.50 available at ArduinoFun.com
  4. 840 Tie Point Breadboard - $6.95 available at ArduinoFun.com
  5. Wire Jumper Kit - $12.95 available at ArduinoFun.com
  6. Two DC Motors - $3.99 ea. available at ArduinoFun.com
DISCOUNT: 10% OFF Your Total Order at ArduinoFun.com when you use coupon code "INSTRUCTABLES" at time of checkout.

Step 2: Build the H-Bridge Driver

Picture of Build the H-Bridge Driver

As you are looking at the SN754410NE chip, you will notice a u-shaped notch at one end.  This will help to identify pin 1.



Pins 1, 9, and 16 are +5V
Pin 8 is +12V and will run the +12V DC motors.
Pins 4, 5, 12, and 13 are for GND

DC Motors have two hook ups on them.  If you hooked one up straight to the source power you would have one lead going to positive and one lead going to GND. 

For our H-Bridge driver, you will hook the left motor leads to pin 3 & 6.  The right motor leads will hook up to pins 11 & 14.

Connect h-bridge pin 2 to the Arduino digital pin 2, and h-bridge pin 7 to Arduino digital pin 3.
Connect h-bridge pin 10 to Arduino digital pin 8, and h-bridge pin 15 to Arduino digital pin 7



Step 3: Arduino Sketch

Picture of Arduino Sketch

Once you have your h-bridge circuit completed, you can upload the sketch to your Arduino.  The sketch will cycle back and forth on the dc motors driving them forward and backwards and then light an led connected to pin 13 on the arduino.

// Use this code to test your motor with the Arduino board:

// if you need PWM, just use the PWM outputs on the Arduino
// and instead of digitalWrite, you should use the analogWrite command

// —————————————————————————  Motors
int motor_left[] = {2, 3};
int motor_right[] = {7, 8};
int ledPin =  13;    // LED connected to digital pin 13

// ————————————————————————— Setup
void setup() {
Serial.begin(9600);

// Setup motors
int i;
for(i = 0; i < 2; i++){
pinMode(motor_left[i], OUTPUT);
pinMode(motor_right[i], OUTPUT);
pinMode(ledPin, OUTPUT);
}

}

// ————————————————————————— Loop
void loop() {

drive_forward();
delay(1000);
motor_stop();
Serial.println("1");

drive_backward();
delay(1000);
motor_stop();
Serial.println("2");

turn_left();
delay(1000);
motor_stop();
Serial.println("3");

turn_right();
delay(1000);
motor_stop();
Serial.println("4");

motor_stop();
delay(1000);
motor_stop();
Serial.println("5");

digitalWrite(ledPin, HIGH);   // set the LED on
  delay(1000);                  // wait for a second
  digitalWrite(ledPin, LOW);    // set the LED off
  delay(1000);                  // wait for a second

}

// ————————————————————————— Drive

void motor_stop(){
digitalWrite(motor_left[0], LOW);
digitalWrite(motor_left[1], LOW);

digitalWrite(motor_right[0], LOW);
digitalWrite(motor_right[1], LOW);
delay(25);
}

void drive_forward(){
digitalWrite(motor_left[0], HIGH);
digitalWrite(motor_left[1], LOW);

digitalWrite(motor_right[0], HIGH);
digitalWrite(motor_right[1], LOW);
}

void drive_backward(){
digitalWrite(motor_left[0], LOW);
digitalWrite(motor_left[1], HIGH);

digitalWrite(motor_right[0], LOW);
digitalWrite(motor_right[1], HIGH);
}

void turn_left(){
digitalWrite(motor_left[0], LOW);
digitalWrite(motor_left[1], HIGH);

digitalWrite(motor_right[0], HIGH);
digitalWrite(motor_right[1], LOW);
}

void turn_right(){
digitalWrite(motor_left[0], HIGH);
digitalWrite(motor_left[1], LOW);

digitalWrite(motor_right[0], LOW);
digitalWrite(motor_right[1], HIGH);
}



Comments

yakeen4u (author)2014-09-28

this project include joystick?

huyle (author)2014-04-13

good

deshawnbw (author)2013-12-17

link to "You may also download a printable PDF file of this illustration." isn't working, anybody have this?

charlely (author)2013-05-26

Good instructable, I would like to have had a schematic however.

mhcgusto (author)2012-12-22

Can the 5V pin on the Hbridge be powered by the 5V power from the arduino? Also for PWM do we just use analogWrite(pin,0-255) on the digitalWrite() that is HIGH or can we just analogWrite() to the enable pin on the Hbridge?

supercapacitor (author)2012-03-18

oshondrom,
1) You obviously don't understand the purpose of an H-bridge.
2) You are wrong, you could not drive the motors depicted in AruinoFun's instructable with only 2 transistors. Trying to do so would put strain on the arduino board. Even then, the arduino does not source enough current to fully saturate a high current MOSFET w/o preamp transistors .
3) "This is stupid!" violates the "be nice" policy...

bdughi (author)2012-01-02

Your links to the diagrams are dead. other than that you have a good instrucable. your code is good and simple.

hughligen (author)2010-09-06

I'm confused as to why you have in the parts list, the Arduino as well as the build your own arduino.

Is it a choice? as in either a off the shelf arduino or a homebuilt one?

johnnyhellfire (author)2010-07-07

So can you control the direction the motors go or is it only single directional circute

amando96 (author)2010-02-07

 I really don't understand anything of your code.

About This Instructable

93,106views

74favorites

License:

More by ArduinoFun:Arduino Lilypad Interactive Passion Sensing ScarfCreating Printed Circuit Boards with a INKJET PrinterDual Motor Driver with Arduino using a SN754410NE Quad Half H-Bridge
Add instructable to: