IBT-2 H-Bridge with Arduino

The IBT-2 H-bridge module from wingxin is an inexpensive, high power motor driver based on two BTS7960 chips and is readily available from various ebay vendors; see e.g. here.


The link provides more details but here are a few key parameters.

  • Input voltage : 6V-27V
  • Maximum Current : 43A
  • Input level : 3.3V-5V

I am not sure whether the heat sink is sufficient for handling 43A but even if one does not drive the unit to its limits the specifications are still impressive given the typical price point of this module (currently between $13 and $17 including free shipping from China). There is relatively little information available about how to hook up the module with an Arduino controller. This thread on the Arduino forum was useful but the solution wastes a few pins and does not demonstrate bidirectional motor control. In this post I describe a slightly more complete solution that uses an Arduino controller with connected potentiometer to drive a motor via the IBT-2 module from full reverse speed to full forward speed.

For reference here is the description of the input ports and the two supported usage modes (image taken from one of the ebay postings). In this post I leverage usage mode one.


Here is the associated Arduino sketch:

IBT-2 Motor Control Board driven by Arduino.

Speed and direction controlled by a potentiometer attached to analog input 0.
One side pin of the potentiometer (either one) to ground; the other side pin to +5V

Connection to the IBT-2 board:
IBT-2 pin 1 (RPWM) to Arduino pin 5(PWM)
IBT-2 pin 2 (LPWM) to Arduino pin 6(PWM)
IBT-2 pins 3 (R_EN), 4 (L_EN), 7 (VCC) to Arduino 5V pin
IBT-2 pin 8 (GND) to Arduino GND
IBT-2 pins 5 (R_IS) and 6 (L_IS) not connected

int SENSOR_PIN = 0; // center pin of the potentiometer

int RPWM_Output = 5; // Arduino PWM output pin 5; connect to IBT-2 pin 1 (RPWM)
int LPWM_Output = 6; // Arduino PWM output pin 6; connect to IBT-2 pin 2 (LPWM)

void setup()
  pinMode(RPWM_Output, OUTPUT);
  pinMode(LPWM_Output, OUTPUT);

void loop()
  int sensorValue = analogRead(SENSOR_PIN);

  // sensor value is in the range 0 to 1023
  // the lower half of it we use for reverse rotation; the upper half for forward rotation
  if (sensorValue < 512)
    // reverse rotation
    int reversePWM = -(sensorValue - 511) / 2;
    analogWrite(LPWM_Output, 0);
    analogWrite(RPWM_Output, reversePWM);
    // forward rotation
    int forwardPWM = (sensorValue - 512) / 2;
    analogWrite(RPWM_Output, 0);
    analogWrite(LPWM_Output, forwardPWM);

The following Fritzing diagram illustrates the wiring. B+ and B- at the top of the diagram represent the power supply for the motor. A 5k or 10k potentiometer is used to control the speed.


98 thoughts on “IBT-2 H-Bridge with Arduino”

  1. Is there any reason why the two sides require a dedicated PWM pin? Could you tie those together to the one PWM output from the Arduino and use R_EN and L_EN to select direction? Even better, if one is always the inversion of the other, could a NOT gate be used so that to drive a motor forward and reverse, only one PWM pin and one non-PWM pin are required? (Possibly meaning as many as 6 motors could be driven from the one Arduino)

    … Actually, writing that gives me an inkling as to why two PWM inputs are available…

    Similarly, could two of these bridges be used to drive a high current stepper motor?

    1. Thse boards definitely can’t be used with a single PWM pin. The half-wit chinese board torturer who designed this thing named the enable pins R and L but there is no relation to the driving direction. They are just the enable pins for each of the two half-bridges on the board. (The L pin for the right of them and vice versa) Unless you activate them both, there is no function at all.
      Therefore, it is not possible using only one PWM pin without further parts. With some additional logic you could easily use one PWM pin and one direction select pin.

      I can’t even articulate my anger against such people. This board must have consumed thousands of hours of good people trying to figure out why dhe directional enable pins do not enable any direction, bringing despair to beginners and spoiling a nice hobby for so many.

      Best Regards and good luck.

  2. is it possible to ad a feedback potentiometer to the dc motor. and code in arduino so it will act like 180 degree servo.
    Kind regards
    Tom Jensen

  3. Dr. Hessmer,
    I plan to use a similar (higher power) single H bridge to control a DC brushed motor.
    The bridge has a similar connection schema, including an ENABLE and LPWM and RPWM.
    I am worried about cross-conduction (shoot-through) protection when changing direction. My guess is that the bridge does not provide it.
    In that case, would such protection not be provided by always taking the xPWM pin that was fed until now to zero and ONLY THEN feeding the other?
    In other words, in the code above, have the “forward rotation” coded thus:
    // forward rotation
    int forwardPWM = (sensorValue – 512) / 2;
    analogWrite(RPWM_Output, 0);
    analogWrite(LPWM_Output, forwardPWM);
    Many thanks for your opinions and advice,

    1. Late reply, I know (better late then never in this case).

      Yes this is an issue with these H-bridge models and high power uses.
      The H-bridge does provide a delay (switch on/off delay / slew rate), which would prevent the cross-conduction issue if you could send both PWM signals at the same time. But because of the time arduino takes to process the line of code (analogWrite in this case) it will still cause cross-conduction.
      I don’t have the exact numbers anymore, but the build-in delay is about 4/6 ms (depending on resistance and temerature) and the delay time between the 2 lines of code is about 4-8 ms. This sometimes causes an overlap, resulting in crossconduction.
      I broke about 2/3 h-bridges before I found out about this issue. The code you provides in your comment does solve the issue and no h-bridges have broken down since.
      Someone also suggested using digitalWrite(pin, LOW), instead of analogWrite(pin, 0). But I don’t know if this makes much difference.

  4. Hi Thanks for the post. Very useful.
    May I know IBT-2 can control the Bipolar Stepper Motor, if so, how to connect the motor.

    1. It is possible to drive a steeper motor with these bridges, however it is not recommended.

      First you will need two as there are two sets of winding’s in the stepper and this bridge will only handle 1 set of winding’s
      If you are using the IBT-2 I will assume you are planning to run a high power stepper.
      In most cases, dedicated stepper drivers will not only control the voltage to the stepper motors, but also limit the current.
      The voltage applied to the motor can be a lot higher than the nominal voltage of the winding’s.
      This is because at higher frequencies of phase reversal, the impedance of the winding’s increases, reducing the current flow and motor torque will drop off rapidly. To overcome this, a higher voltage is used and the current is then limited to prevent damage to the motor.
      This method allows motors that when stationary have a winding voltage of 6V to operate at up to 60V

      So while it is possible, these motor drivers do not have the precise current control that would be needed but high power stepper motors.

  5. Dr. Hessmer, thanks for sharing! Very informative and useful…I always learn something new and useful every time I visit your blog. Thx!

  6. Good morning
    This is exactly what I was looking for but would like to add rpm measurement via a slotted optical sensor board based on an LM393 chip and also an LCD display showing the measured rpm. Would you be able to provide some guidance on how to wire and program this additional equipment?
    Thanks a lot


  7. Thanks for the great info!! I thought I would share how I controlled this with one PWM pin. I “drove” both the enables with one PWM pin (Pin 44 goes to R_EN and L_EN). I then used the LPWM and RPWM pins to set the direction. I also use some digital pins to power/ground the logic of the IBT-2’s (46,47,52, 53).

    The following code is for the Mega-2560 and can control two IBT-2’s

    int pwmpin1=44; // 8-bit pwm 0-255 timer 5 for motor 1
    int pwmpin2=45; // 8-bit pwm 0-255 for motor 2
    int mcgnd1=46; // ground for motor control 1
    int mcpwr1=47; // power for motor control 1
    int pwmdirection2r=48; // digital motor control direction 2
    int pwmdirection2l=49; // digital motor control direction 2
    int pwmdirection1r=50; // digital motor control direction 1
    int pwmdirection1l=51; // digital motor control direction 1
    int mcgnd2=52; // ground for motor control 2
    int mcpwr2=53; // power for motor control 2

    //Code snippet for two motors on 2 IBT-2’s using just two pwm pins.

    //set h-bridge to reverse or CCW


    //else CW

    //set h-bridge to reverse or CCW motor 2


    //else CW

    Jim K says:
    November 30, 2014 at 4:51 pm
    Could you share the fritzing part for the IBT-2?



    1. hello, thanks for providing this code..
      but the question is how did you use 4 pins to determine the direction of the two motors on this driver? or did you use relays or what?
      can you send the connections please!

  8. Hej dr.Hessmer do you now if its possible to run a segway on two ibt2 motor controller instead
    Of the sabertooth motor controller with arduino.i am a newbee to arduino. if you can run it on
    Ibt2 do you then got some exsampel code for that.
    Kind Regards
    Tom jensen

  9. Hola.
    Estoy buscando un código de Arduino para controlar un motor de corriente continua utilizando un puente, H 43 A BTS 7960B,

  10. Hola,
    Estoy intentando programar,ARDUINO UNO,con el puente H 43A BTS 7960 B, y no consigo que funcione el motor,estoy, con el código, IBT-2, el código me lo acepta bien pero no funciona el motor,agradecería que alguien me pasara un código.

  11. HELLO SIR:
    if (sensorValue < 512)
    if (sensorValue = 512)


  12. Hi Dr. Rainer,

    I used these motor drivers and your recommendation to run a golf cart.

    After nine holes, the cart reduced in power. It seems the battery running out of juice. Yet when I measured the voltage of the battery, it is at 13v. And the heat sink is not even warm.

    Yet, when I get home, it was running fine again.

    Can you offer some insight to solve this problem?

    Thank you,

  13. This chip won’t switch higher than 40Hz. Just tried using it as the DC->AC component in a step up transformer and it can’t handle signals over 40Hz and still deliver the power it claims to deliver.

    1. Sorry for the late response. You are right, the motor and battery connections in my diagram were wrong. I hope I did not cause any harm. I just uploaded a corrected image.

  14. Hi.
    I used the same drivers with electrical model cars – wondering if anyone has an idea how to get it in wifi version?

  15. hi.
    How much voltaje is the maximum for the VCC pin in the IBT-2 H-BRIDGE because i have been connecting 9V to that pin and the IBT2 stop working, I am not sure if I burn it or the arduino is the one damage.

      1. Hi Daniel,

        i hooked up a wiper motor and it is still doing fine
        so 10 to 15 amps is still fine after wrong connection

      2. I was reading your pages while on a boat. This stuff is great. This website is like the cookies to my tasty soy milk. I just shared your article on Google Plus. When I started my browser this page was running.

  16. Dear Mr
    Dr Rainer Hessmer
    I want to make a sun tracker dual axis
    * I have arduino mega 2560 R3
    * I have 2 pcs BTS7960 (my motors are 24Vdc power suplly)
    * Analog sensors 4 photodiots array ( 4 serial for east-4 serial for west- 4 serial up -4 serial down)
    * 4 push button for manuel control (east-west-up-down)
    * 1 pcs wind speed sensor (output 0-5Vdc)
    * when sun set sistem will park in EAST
    need your help for codes
    Best regards

    1. did you ever get this figured out, if so would you please share your code, I’m trying to do the same thing.

  17. Dear Dr Rainer Hessmer,
    Can you please kindly help me for my project?
    Especially I would like to drive peltier with this motor driver. I only need to control voltage of peltier from 0 to 12 volts. What should be the pins (input pins) wiring. I dont need any reverse current. I would like to only give some pwm signals from raspberry pi with python and control output voltage. Thanks for your kind help.

  18. Good morning Mr Hessmer

    I have a strong doubt on the IBT-2, that is:

    I have a 12V DC motor which absorbs a current of 30A in S1 service (max 38A in S2 service).
    Can I safely use IBT-2 to operate the motor 30A?
    Someone said that IBT-2 is small for this use.

    I would use Arduino + potentiometer for feedback control.

    Thanks in advance and waiting for your answer

  19. Hi

    Im using the Motor Driver BTS7960 43A for a 24v dc motor 200watt, im using a raspberry pi to control the pwm. When I first set up I was using a frequency of 100htz, but when running the motor and motor controller got extremely hot!. So I change the frequency to 800htz. Its now running cool and smooth but could anyone tell me if this a good setting please?.

    Many thanks


  20. Thanks ! Can you give a clue on using the IS pin for current limiting/monitoring ?
    I don’t understand the datasheet for that pin.
    Thanks in advance

  21. Hi everybody!

    Thanks in advance for your attention
    I think i connected all OK, and burn the arduino UNO with the described code.

    But, I can’t get to move the motor.

    I have any doubt aboout the GND of 12 battery and the GND of arduino.
    Can I connect all GND?

    Thanks in advance!!


  22. Dear Dr Hessmer ,

    Thanks for your effort . IBT-2 was working in minutes and your explanation made things very easy to understand….

  23. How can I get the BTS6070 in the Fritzing software? I have been trying but I cant seem to find it.

  24. Dear Dr Hessmer,
    I have try this program code and its works fine…but how to change the input from VR (sensor A0) to read signal from the RC receiver…so i can control from the rc controller…tq.

  25. pourriez-vous me donner le code et le schema de branchement de deux ibt-2 avec arduino uno et commander par un joystick

  26. Hi Dr Hessmer
    Is power supply need to be same voltage as DC motor? Is there any step down module. What I mean is I have a 18v DC motor and 24v power supply will that burn the motor?

    1. There is no step down module. You could run the 18vdc motor on 24vdc for a while, but it’s not recommended. I’ve ran a 12vdc motor on 24vdc for a while (on accident) and it did not break down. Granted, it never recieved any pwm signal higher then 120 or so, but that’s still 24v peaks going trough it.
      These documents are also usefull if you want to take a closer look at how the h-bridge works:

      1. I signed up for your mailing list last week and I was wondering how often I’ll be receiving Emails from you. I really enjoyed your page. I amofficially impressed, I need to say. I have just learned new insights because of your article. Funny thing I thought I was a pro before reading your site but it turns out I am a dummy. This is helpful to everyone who reads it.

  27. Hello Dr. Hessmer

    Could you please tell me how to get the IBT-2 part to add it to a fritzing diagram?


  28. Hii I m Smith Mia, If you need guidance for and Roku issues then we are
    here to serve best and optima lsolution to solve your issues.

  29. I need to control a 12v DC motor using a BTS7960 motor driver on the basis of a digital input.
    such as the motor have to run clock wise when a digital pin is high and when that digital pin is low , the motor should run counter clock wise.

    what would be the code for performing this operation…?

  30. Hi,
    I can’t find on the web how to use side current alarm pins R_IS and L_IS.
    Is someone able to help me ?

  31. I get an error at line 27 when I Verify or Upload the code above as follows:
    “a function-definition is not allowed here before ‘{‘ token”
    (at the line after void loop)
    I am using Arduino IDE 1.8.5 with Windows 10
    Can anyone advise the problem, & how to fix this please?

  32. my arduino bts7960 connect with ibt-2 and hall sensor .problem i having with out moving hall sensor motor start working slowly please hellp me

    Kumara Fernando

  33. my arduino bts7960 connect with ibt-2 and hall sensor .problem i having with out moving hall sensor motor start working slowly please hellp me no im not

    Kumara Fernando

  34. hi…i connected this drive to a 12 v battery suddenly the battery burned with fire and smoke!!!!why this thing happened?i should say that the was no consumer attached to drive…no motors no actuator…dose reverse polarity connection of battery cause this?B+ of battery to B- of driver..and B- of battery to B+ of driver.is my driver burn down too?

  35. This product is much useful for drive motor. I just want to one thing that is Can I use this drive with JOYSTICK? If yes can you send code for that. Now I am using Arduino uno microcontroller. Please help me.

  36. hello, need to work with 2 dc motors, already done with wiring by following the posted diagram above but when I try to turn on (forward or reverse) motor 1, motor 2 GND pin is heating causing wire melt. how can this possibly be fix? please answer Thanks

  37. vorrei usare Using Motor Driver BTS7960 per sostituire una board L298N che è limitata in corrente e si blocca!!
    Nel mio esempio in arduino piloto il motorino dc con due interruttori NA per le due direzioni e un potenziometro per vel.
    Tuttavia uso solo tre pint di Arduino due digitali IN ad uno per il PWM!
    Ho appena comprato la nuova scheda ho cercato su internet ma non trovo risposte, come posso usare il Motor Driver BTS7960 per sostituire il L298N ?
    lo schetch è ottimizzato per i tre pin….
    ! grazie!

  38. what is the right board?I did not have it.I will change the IBM_2 board.
    I only have a IBM-2 and a arduino.

  39. I believe there is a typo in the image above for “Usage two:”
    I think what they are trying to say is:

    Usage 1:
    VCC to 5V power
    GND to arduino ground
    R_EN and L_EN shorted to 5V
    L_PWM connected to PWM signal for forward speed
    R_PWM connected to PWM signal for reverse speed

    Usage 2:
    VCC to 5V power
    GND to arduino ground
    L_EN to digital arduino pin for forweard
    R_EN to digital arduino pin for reverse
    L_PWM and R_PWM shorted to PWM signal for forward or reverse speed

    (Your choice would depend on if you wanted to use up 2 PWM pins + 1 digital pin, or 2 digital pins and 1 PWM pin on your arduino)

    1. Dear Mr. McWhinney,

      Much to my regret, I must inform you, usage 2 is not possible. The two enable-pins do not correspond to directions but to the two half bridge ICs (And then R and L are swapped). Unless both are activated, it won’t do anything. (Well, except changing the Voltage of the output to B- or to B+but there is no current flowing)

  40. hi my question is can i control two motors using single IBT-2 driver? i am making a wheel chair ,in order to rotate i must stop 1 and run the other one .any info about that??

  41. Hi, I followed your instructions to use IBT-2 to control a motor, used the same arduino sketch and circuit. 12V battery connected to -B&+B, arduino UNO/Nano VCC reads 4.75V (Chinese clone) connected to VCC and GND, but not success,

    Tested with an multimeter and found the the below
    When sensorValue0V to 10V.

    but (-B & +M )and (-B & -M) reads >0 to 10V, (changes according to pot value)

    and (+B & +M) or (+B & -M) reads 0v.

    I assume that +10V comes in both +M & -M.

    While sensorValue>512 voltage across
    +M & -M is 0V only, suppose to be >0 to 10v.

    but +B & -M or +B & -M reads >0 to 10V,
    I assume that both +M and -M is now negative or 0v.

    And further
    I used some simple sketch to make L_EN and R_EN HIGH and RPWM HIGH and LPWM LOW. The voltage reads same as above. Please note that while using 12V battery BTS9600 gets too hot, hence I used a 7.5lipo.

    Any advise please.


  42. Hi, please delete my previous post as it mistyped some info,
    I followed This instructions to use IBT-2 to control a motor, used the same arduino sketch and circuit. 12V battery connected to -B&+B, arduino UNO/Nano VCC reads 4.75V (Chinese clone) connected to VCC and GND, but not success,

    Tested with an multimeter and found the the below
    When sensorValue0V to 10V.

    but (-B & +M )and (-B & -M) reads >0 to 10V, (changes according to pot value)

    and (+B & +M) or (+B & -M) reads 0v.

    I assume that +10V comes in both +M & -M.

    While sensorValue>512 voltage across
    +M & -M is 0V only, suppose to be >0 to 10v.

    but +B & -M or +B & -M reads >0 to 10V,
    I assume that both +M and -M is now negative or 0v.

    And further
    I used some simple sketch to make L_EN and R_EN HIGH and RPWM HIGH and LPWM LOW. The voltage reads same as above.

    Any advise please.

  43. I’ll subscribe to that writer and his future books. The post is well organized, reminded me about
    https://usagrantsforsinglemothers.com/. I see the author has a real knack
    for this topic. I like that theme, and I’m in constant search of new bits and the most
    recent news. I really enjoyed that one, because
    it is filled with interesting facts and it is a kind of easygoing article.
    I spent only a few minutes reading and due to well-structured text, I understand
    it completely. Thanks!

  44. Yes, it certainly IS possible to use TWO of these half bridges to drive the TWO coils of a BIPOLAR (4 wire) STEPPER MOTOR. You can use EXISTING Arduino code without ANY editting (from the site below), if you use the same 4 Arduino DIGITAL pins as inputs to the TWO half bridges.

    See the excellent tutorial here: https://www.arduino.cc/en/Tutorial/StepperOneStepAtATime
    and specifically

    Wiring from the Arduino UNO to the TWO half bridge boards is as follows

    NOTE: this is to connect to a single BIPOLAR STEPPER MOTOR Bipolar (4 wire, 2 coils)
    Polarity of connection the coils doesn’t matter, so long as ONE coil is connected to M- and M+ on ONE half bridge output terminal, and the OTHER coil is connected M- and M+ on the OTHER half bridge output terminal. Inverting the polarity on either coil simply changes the motor rotation direction for a given stepper pulse. (and the stepper motor can be stepped in EITHER direction by changing the sign of the number of steps in the Arduino sketch.)

    suffixes _1, _2 indicate which of TWO half bridge boards (and which stepper coil) is involved

    CONNECTIONS to FIRST IBT-2 H-bridge module half bridge:

    VCC_1 to arduino +5V power (from Arduino UNO or similar)
    GND_1 to arduino ground
    L_EN_1 to arduino +5V power (ENABLE= TRUE)
    R_EN_1 to arduino +5V power (ENABLE= TRUE)
    L_PWM_1 = arduino digital pin 8
    R_PWM_1 = arduino digital pin 9

    B+_1 = Vm of STEPPER MOTOR SUPPLY (note Vm can be DIFFERENT from Arduino Vcc
    and supply needs enough current for motor (1A or more))
    M-_1 = one end of STEPPER MOTOR COIL_1
    M+_1 = other end of STEPPER MOTOR COIL_1 (invert M- & M+ still works but direction reverses)

    CONNECTIONS to SECOND IBT-2 H-bridge module half bridge:

    VCC_2 to arduino +5V power (from Arduino UNO or similar)
    GND_2 to arduino ground
    L_EN_2 to arduino +5V power (ENABLE= TRUE)
    R_EN_2 to arduino +5V power (ENABLE= TRUE)
    L_PWM_2 = arduino digital pin 10
    R_PWM_2 = arduino digital pin 11

    B+_2 = Vm of STEPPER MOTOR SUPPLY (note Vm can be DIFFERENT from Arduino Vcc
    and supply needs enough current for motor (1A or more))
    M-_2 = one end of STEPPER MOTOR COIL_2
    M+_2 = other end of STEPPER MOTOR COIL_2 (invert M- & M+ still works but direction reverses)

    NOTE: you can provide a suitably LOW voltage and HIGH current power supply to run the stepper motor (connected to B- and B+ on the half bridge output terminal). This supply is **separate** from the small +5V supply coming from the Arduino into each Vcc pin on each half bridge. You may need to insert a suitable high power low Ohm value resistor Rs (e.g., say a 1 Ohm 5 Watt resistor), in series with the stepper motor supply to limit the current, depending on the stepper motor coil resistance (and inductance, if you are running it fast).

    In my case, I was able to omit the Rs current limit, and simply use a direct connection of my particular motor to a **separate** high current Vm supply (which coincidentally ALSO was at +5V, but could have been chosen otherwise, depending on motor specs and torque requirements.)

  45. Dear Dr Hessmer ,

    Thanks for your effort and support. I am working on the design of a robot with 2 24V motors. I would like control motor speed remotely, using NODEMCU and smartphone BLYNK application. If I wire DC Motors with L298N driver, they works better but they stop when I give full PWM. If I replace L298N with IBT-2 its worst. Could you give me some help?

    1. code for motor Left , Right , reverse and stop using push botton for IBT2 driver
      I can’t understand how I can do my wheel chair right,left,stop and reverse It is going forward only.

  46. Code for motor Left , Right , reverse and stop using push botton for IBT2 driver
    I can’t understand how I can do my wheel chair right,left,stop and reverse It is going forward only.

Leave a Reply

Your email address will not be published. Required fields are marked *