RSS:
Publications
Comments

Dual Motor Driver with Arduino using a SN754410NE Quad Half H-Bridge

H-Bridge Setup

H-Bridge Setup

With this post I am going to show you how to use a SN754410NE Quad Half 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 tutorials.

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.

  1. Arduino board – $29.95 at CuriousInventor.com or…
  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

H-Bridge Pinout

H-Bridge Pinout

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

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.

Arduino Sketch

  1. // Use this code to test your motor with the Arduino board:
  2.  
  3. // if you need PWM, just use the PWM outputs on the Arduino
  4. // and instead of digitalWrite, you should use the analogWrite command
  5.  
  6. // —————————————————————————  Motors
  7. int motor_left[] = {2, 3};
  8. int motor_right[] = {7, 8};
  9. int ledPin =  13;    // LED connected to digital pin 13
  10.  
  11. // ————————————————————————— Setup
  12. void setup() {
  13. Serial.begin(9600);
  14.  
  15. // Setup motors
  16. int i;
  17. for(i = 0; i < 2; i++){
  18. pinMode(motor_left[i], OUTPUT);
  19. pinMode(motor_right[i], OUTPUT);
  20. pinMode(ledPin, OUTPUT);
  21. }
  22.  
  23. }
  24.  
  25. // ————————————————————————— Loop
  26. void loop() {
  27.  
  28. drive_forward();
  29. delay(1000);
  30. motor_stop();
  31. Serial.println("1");
  32.  
  33. drive_backward();
  34. delay(1000);
  35. motor_stop();
  36. Serial.println("2");
  37.  
  38. turn_left();
  39. delay(1000);
  40. motor_stop();
  41. Serial.println("3");
  42.  
  43. turn_right();
  44. delay(1000);
  45. motor_stop();
  46. Serial.println("4");
  47.  
  48. motor_stop();
  49. delay(1000);
  50. motor_stop();
  51. Serial.println("5");
  52.  
  53. digitalWrite(ledPin, HIGH);   // set the LED on
  54.   delay(1000);                  // wait for a second
  55.   digitalWrite(ledPin, LOW);    // set the LED off
  56.   delay(1000);                  // wait for a second
  57.  
  58. }
  59.  
  60. // ————————————————————————— Drive
  61.  
  62. void motor_stop(){
  63. digitalWrite(motor_left[0], LOW);
  64. digitalWrite(motor_left[1], LOW);
  65.  
  66. digitalWrite(motor_right[0], LOW);
  67. digitalWrite(motor_right[1], LOW);
  68. delay(25);
  69. }
  70.  
  71. void drive_forward(){
  72. digitalWrite(motor_left[0], HIGH);
  73. digitalWrite(motor_left[1], LOW);
  74.  
  75. digitalWrite(motor_right[0], HIGH);
  76. digitalWrite(motor_right[1], LOW);
  77. }
  78.  
  79. void drive_backward(){
  80. digitalWrite(motor_left[0], LOW);
  81. digitalWrite(motor_left[1], HIGH);
  82.  
  83. digitalWrite(motor_right[0], LOW);
  84. digitalWrite(motor_right[1], HIGH);
  85. }
  86.  
  87. void turn_left(){
  88. digitalWrite(motor_left[0], LOW);
  89. digitalWrite(motor_left[1], HIGH);
  90.  
  91. digitalWrite(motor_right[0], HIGH);
  92. digitalWrite(motor_right[1], LOW);
  93. }
  94.  
  95. void turn_right(){
  96. digitalWrite(motor_left[0], HIGH);
  97. digitalWrite(motor_left[1], LOW);
  98.  
  99. digitalWrite(motor_right[0], LOW);
  100. digitalWrite(motor_right[1], HIGH);
  101. }
  • Share/Bookmark

5 Comments to Dual Motor Driver with Arduino using a SN754410NE Quad Half H-Bridge

  1. October 28, 2009 at 12:48 pm | Permalink

    Nice post. Thanks.

  2. blake11's Gravatar blake11
    October 29, 2009 at 5:26 pm | Permalink

    Do you need a capacitor from the 12v power supply? I am very new to electronics and trying to figure out exactly how to hook this up. I don’t want to fry anything. So, all I have to do for the external 12v to power the motors is to hook up a 12v wall plug power supply to a barrel jack on my board and feed that to the h-bridge? Does the h-bridge handle the emf from the motor, or do I have to build to anticipate that? Also, what about the constant voltage going to the h-bridge, do I need a flyback diode to keep it from overheating?

  3. aarondbaron's Gravatar aarondbaron
    June 2, 2010 at 4:08 pm | Permalink

    Hey there..
    I tried this experiment and got it to work. I used a 9v supply instead of 12.

    I think I burnt out the chip though because I might have accidentally switched the positive and negative leads on the supply. When I try to connect the battery now in the correct way, the chip heats up, very hot and the circuit does not work.

    I just want to know where I might have gone wrong. Obviously switching the positive and negative can’t be good, but I just want to make sure it was that, and not something else.

    Does the supply need to be 12 at a minimum? It looks like it could be a max of about 24V. The datasheet says that per drivier, the chip can handle about 1A of current. Is it possible that running two motors would burn the chip out? Or should it be able to handle this?

  1. By on November 25, 2009 at 4:59 pm

Leave a Reply

You must be logged in to post a comment.