Arduino Nano - BTS7960 Motor Driver

This tutorial instructs you how to use Arduino Nano with the BTS7960 motor driver to run a large 12V DC motor in both directions. Picture a small test bench on your desk for a 12V windshield wiper motor from a car. Such a motor wants far more current than a tiny driver chip can give, and this is the job the BTS7960 was built for. In detail, we will learn:

Arduino Nano runs a 12V motor both ways with a BTS7960 43A driver

We suggest:

Hardware Preparation

1×Official Arduino Nano
1×Alternatively, DIYables Nano V3.0 Development Board
1×USB A to Mini-B USB cable
1×BTS7960 Motor Driver Module
1×12V DC Motor
1×12V Power Adapter
1×DC Power Jack
1×Jumper Wires
1×Breadboard
1×Recommended: Screw Terminal Expansion Board for Arduino Nano
1×Recommended: Breakout Expansion Board for Arduino Nano
1×Recommended: Power Splitter for Arduino Nano

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of BTS7960 Motor Driver

The BTS7960 module is often sold under the names IBT-2 or HW-039. The board carries two Infineon BTS7960B chips, cooled by a big heat sink. Each chip is one half-bridge, and the pair works as one full H-bridge. That means one module runs one brushed DC motor, forward or backward, and the Arduino Nano sets the speed with a PWM signal. Compared with the L298N and the DRV8833, this board is the heavy-duty option. People use it for wiper motors, winches, large gear motors, electric scooters, wheelchair motors and heavy robots.

BTS7960 Module (IBT-2)
Power chips 2 x Infineon BTS7960B half-bridge (one H-bridge together)
Motors driven 1 brushed DC motor, forward and reverse
Motor voltage on B+ / B- 5.5V to 27V DC (fits 6V, 12V and 24V motors)
Current up to 43A (the current-limit level of the chip)
Highest PWM frequency (RPWM, LPWM) 25 kHz
Logic chip 74HC14 buffer, powered from the VCC pin
Logic voltage with Arduino Nano 5V
Protection current limiting and over-temperature protection

Read the 43A figure as a peak. It is the level where the chip starts to limit the current. If your motor has to run for a long time, keep its current far below that number. In the end, the heat sink decides how much current the board can carry for minutes or hours.

The BTS7960 Motor Driver Pinout

BTS7960 motor driver module pinout with the 8-pin control header and the B+, B-, M+, M- screw terminal

The board is split into a signal part and a power part. The signal part is a header of 2 x 4 male pins that talks to the Arduino Nano. RPWM is pin 1 and LPWM is pin 2 at one end, and VCC is pin 7 and GND is pin 8 at the other end. The power part is a screw terminal for the supply and the motor.

Control header:

  • RPWM pin: must be connected to a PWM pin of Arduino Nano. PWM here drives the motor forward (right half-bridge)
  • LPWM pin: must be connected to a second PWM pin. PWM here drives the motor in reverse (left half-bridge)
  • R_EN pin: must be connected to a digital pin. HIGH turns the right half-bridge on
  • L_EN pin: must be connected to a digital pin. HIGH turns the left half-bridge on
  • R_IS and L_IS pins: they report the motor current and faults. This tutorial does not use them, so they stay unconnected
  • VCC pin: must be connected to 5V on the Arduino Nano. It powers only the 74HC14 logic chip and the power LED, never the motor
  • GND pin: must be connected to a GND pin of Arduino Nano. On the module, this pin is already joined to B-

Screw terminal:

  • B+ terminal: must be connected to the + side of the motor supply (12V here)
  • B- terminal: must be connected to the - side of the motor supply
  • M+ and M- terminals: must be connected to the two wires of the DC motor

※ NOTE THAT:

The labels on your module are the ones to trust. The silkscreen of many boards prints R_IS and L_IS as "R_S" and "L_S", and the header order may change from one maker to another. Check the small text next to each pin before you push a wire on it.

How RPWM, LPWM, R_EN and L_EN Move the Motor

Each half-bridge works like a very fast switch for one motor wire. When one side pulses its wire to the supply and the other side holds its wire at ground, current flows through the motor one way. Swap the two roles and the motor turns the other way. The PWM duty cycle sets how long the switch stays on in each pulse, and so how fast the motor spins.

With R_EN and L_EN both HIGH, the two PWM pins choose what happens:

RPWM LPWM Result
PWM (0 to 255) 0 forward, a higher duty cycle means a higher speed
0 PWM (0 to 255) reverse, a higher duty cycle means a higher speed
0 0 brake, the driver joins the two motor wires and the motor stops fast

Now set R_EN and L_EN LOW. Both half-bridges switch off and nothing holds the motor any more, so it coasts and rolls to a stop by itself. Brake gives a short, hard stop. Coast gives a long, soft one.

There is one firm rule: at least one of RPWM and LPWM is always 0. The two PWM pins must never be active together.

Where the Motor Gets Its Power

The motor does not take any power from the Arduino Nano. A 12V power adapter feeds the module through a DC power jack: adapter + goes to B+, and adapter - goes to B-. Choose an adapter that can give more current than your motor needs. A wiper motor, for example, pulls much more than a small hobby motor.

On the module, GND and B- are joined together. So the single GND wire from the Nano to the module already gives the common ground with the 12V supply. B+ must never touch any pin of the Nano.

Why 5V for VCC? VCC sets the logic level of the 74HC14 buffer, and the Arduino Nano is a 5V board, so its HIGH signals match that level. No signal travels back from the module to the Nano, because R_IS and L_IS are left free.

Wiring Diagram

Six wires run from the control header to the Arduino Nano, and the 12V supply and the motor go only to the screw terminal. RPWM and LPWM need PWM, so they use D9 and D10; the two enable pins only need HIGH and LOW, so R_EN uses D12 and L_EN uses D11.

The wiring diagram between Arduino Nano and BTS7960 motor driver

This image is created using Fritzing. Click to enlarge image

BTS7960 Pin Connect To
RPWM Arduino Nano D9
LPWM Arduino Nano D10
R_EN Arduino Nano D12
L_EN Arduino Nano D11
VCC Arduino Nano 5V
GND Arduino Nano GND
R_IS, L_IS nothing (leave free)
B+ 12V adapter + (via the DC power jack)
B- 12V adapter - (via the DC power jack)
M+, M- motor wire 1 and motor wire 2

Want a stronger connection than jumper wires? You can plug the Arduino Nano into a Screw Terminal Expansion Board for Arduino Nano and connect the wires to its screw terminals. See the diagram below for the screw terminal version.

The wiring diagram between Arduino Nano and BTS7960 motor driver Screw Terminal

This image is created using Fritzing. Click to enlarge image

See The best way to supply power to the Arduino Nano and other components.

※ NOTE THAT:

  • Do all the wiring while the 12V adapter is unplugged. Plug it in only at the very end.
  • Look at the + and - of the DC power jack twice before you plug in the adapter. Reversed polarity can damage the module.
  • A big motor makes the module and its wires warm. Use thick wires for B+, B-, M+ and M-, and tighten the screws well.

How To Program For BTS7960 Motor Driver

No library is required. Two functions that come with Arduino do all the work: analogWrite() sets the speed and digitalWrite() switches the driver on and off.

  • The first step is to give the four control pins a name:
const int RPWM_PIN = 9; // D9 const int LPWM_PIN = 10; // D10 const int L_EN_PIN = 11; // D11 const int R_EN_PIN = 12; // D12
  • In setup(), set the four pins as outputs. Put both PWM inputs at 0 first, and only then pull the two enable pins HIGH:
pinMode(RPWM_PIN, OUTPUT); pinMode(LPWM_PIN, OUTPUT); pinMode(R_EN_PIN, OUTPUT); pinMode(L_EN_PIN, OUTPUT); analogWrite(RPWM_PIN, 0); analogWrite(LPWM_PIN, 0); digitalWrite(R_EN_PIN, HIGH); digitalWrite(L_EN_PIN, HIGH);
  • To turn forward at a speed from 0 to 255, clear LPWM and then write the speed to RPWM:
analogWrite(LPWM_PIN, 0); analogWrite(RPWM_PIN, speed);
  • To turn in reverse, do the mirror image:
analogWrite(RPWM_PIN, 0); analogWrite(LPWM_PIN, speed);
  • To brake, write 0 to both PWM pins and keep the enable pins HIGH. To coast, also pull R_EN and L_EN LOW:
analogWrite(RPWM_PIN, 0); // brake (enable pins still HIGH) analogWrite(LPWM_PIN, 0); digitalWrite(R_EN_PIN, LOW); // add these two lines to coast digitalWrite(L_EN_PIN, LOW);

Arduino Nano Code for BTS7960 Motor Driver

This sketch runs the same six-step test again and again, like a bench check for a wiper motor. The motor speeds up forward, holds full speed, slows down, brakes, turns backward at about half speed, and finally coasts with the driver off. Small helper functions keep the loop easy to read, and each step prints one line to the Serial Monitor.

/* * This Arduino Nano code was developed by newbiely.com * * This Arduino Nano code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-nano/arduino-nano-bts7960-motor-driver */ // Arduino Nano + BTS7960 (IBT-2) motor driver: run ONE big DC motor in both directions // No library is needed: analogWrite() sets the speed, digitalWrite() turns the driver on or off const int RPWM_PIN = 9; // Arduino Nano pin D9 -> RPWM of BTS7960 (PWM pin, forward) const int LPWM_PIN = 10; // Arduino Nano pin D10 -> LPWM of BTS7960 (PWM pin, reverse) const int L_EN_PIN = 11; // Arduino Nano pin D11 -> L_EN of BTS7960 (left half-bridge on/off) const int R_EN_PIN = 12; // Arduino Nano pin D12 -> R_EN of BTS7960 (right half-bridge on/off) const int RAMP_STEP = 5; // how much the duty cycle changes in one step const int RAMP_DELAY = 30; // milliseconds between two steps const int HALF_SPEED = 128; // about 50% duty cycle void setup() { Serial.begin(9600); pinMode(RPWM_PIN, OUTPUT); pinMode(LPWM_PIN, OUTPUT); pinMode(R_EN_PIN, OUTPUT); pinMode(L_EN_PIN, OUTPUT); // both PWM inputs at 0 BEFORE the driver is switched on analogWrite(RPWM_PIN, 0); analogWrite(LPWM_PIN, 0); driverOn(); Serial.println("BTS7960 bench test - driver enabled"); } void loop() { // [1] forward: duty cycle climbs from 0 to 255 Serial.println("[1] Forward: ramp 0 -> 255"); for (int duty = 0; duty <= 255; duty += RAMP_STEP) { motorForward(duty); delay(RAMP_DELAY); } // [2] keep full speed forward for 2 seconds Serial.println("[2] Forward: hold full speed"); delay(2000); // [3] forward: duty cycle falls from 255 back to 0 Serial.println("[3] Forward: ramp 255 -> 0"); for (int duty = 255; duty >= 0; duty -= RAMP_STEP) { motorForward(duty); delay(RAMP_DELAY); } // [4] brake for 1 second: driver on, both PWM inputs 0 Serial.println("[4] Brake"); motorBrake(); delay(1000); // [5] reverse at about half speed for 2 seconds Serial.println("[5] Reverse: duty 128 (about 50%)"); motorReverse(HALF_SPEED); delay(2000); // [6] coast for 2 seconds: driver off, the motor rolls to a stop Serial.println("[6] Coast: R_EN and L_EN LOW"); motorCoast(); delay(2000); driverOn(); // switch the driver back on before the next forward run } // R_EN = HIGH and L_EN = HIGH: both half-bridges can work void driverOn() { digitalWrite(R_EN_PIN, HIGH); digitalWrite(L_EN_PIN, HIGH); } // forward: LPWM stays 0, PWM on RPWM. duty = 0..255 void motorForward(int duty) { analogWrite(LPWM_PIN, 0); analogWrite(RPWM_PIN, duty); } // reverse: RPWM stays 0, PWM on LPWM. duty = 0..255 void motorReverse(int duty) { analogWrite(RPWM_PIN, 0); analogWrite(LPWM_PIN, duty); } // brake: RPWM = 0 and LPWM = 0 while the driver is on // the driver joins the two motor wires together, so the motor stops fast void motorBrake() { analogWrite(RPWM_PIN, 0); analogWrite(LPWM_PIN, 0); } // coast: both PWM inputs 0 and both half-bridges off // nothing holds the motor, so it slows down by itself void motorCoast() { analogWrite(RPWM_PIN, 0); analogWrite(LPWM_PIN, 0); digitalWrite(R_EN_PIN, LOW); digitalWrite(L_EN_PIN, LOW); }

Detailed Instructions

  • If this is your first project with Arduino Nano, set up Arduino IDE first with the Arduino Nano software installation guide.
  • Make every connection from the wiring diagram, but keep the 12V adapter out of the socket for now.
  • Plug the Arduino Nano into your computer with the Mini-B USB cable.
  • Start Arduino IDE, choose Arduino Nano as the board and pick the COM port it uses.
  • Copy the sketch above into Arduino IDE.
  • Press Upload and wait until the IDE reports that the upload is done.
  • Now plug the 12V adapter into the DC power jack.
  • Open the Serial Monitor and pick 9600 baud in its drop-down list.
  • Watch the motor while the steps scroll by:
∞
Newbiely | Arduino IDE 2.3.8
──
☐
✕
File
Edit
Sketch
Tools
Help
Arduino Nano
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'Arduino Nano' on 'COM15')
New Line
9600 baud
BTS7960 bench test - driver enabled [1] Forward: ramp 0 -> 255 [2] Forward: hold full speed [3] Forward: ramp 255 -> 0 [4] Brake [5] Reverse: duty 128 (about 50%) [6] Coast: R_EN and L_EN LOW [1] Forward: ramp 0 -> 255 [2] Forward: hold full speed [3] Forward: ramp 255 -> 0
Ln 11, Col 1
Arduino Nano on COM15
2

During steps 1 to 3 the motor climbs to full speed and comes back down. At step 4 it stops almost at once. Step 5 spins it the other way, more slowly. At step 6 it keeps turning for a moment and then winds down on its own. With a heavy motor, the gap between the brake stop and the coast stop is easy to see.

Does the motor turn backward at step 1? Swap the M+ and M- wires on the screw terminal. Hear a soft hum or whine at low speed? That is normal. The Nano's PWM on D9 and D10 runs at about 490 Hz, which is low enough for the ear to pick up.

Additional Knowledge

BTS7960 vs L298N vs DRV8833

BTS7960 L298N DRV8833
Motors per board 1 2 2
Motor supply 5.5V to 27V 5V to 35V 2.7V to 10.8V
Current up to 43A (peak, chip limit) about 2A per motor about 1.5A per motor (2A peak)
Voltage lost inside the driver very little about 2V small
Typical motors wiper motors, winches, heavy robots medium gear motors small battery robots

It is evident that the BTS7960 wins on current, but it drives only one motor per board. For a robot with two big wheels, use two BTS7960 modules. For small motors, the DRV8833 is the smaller and simpler choice. The L298N loses about 2V inside, so a 12V motor gets only about 10V from it.

Project Ideas

  • A wiper motor tester with a potentiometer for speed and two buttons for direction
  • An electric winch that pulls a small cart up a ramp and stops at a limit switch
  • An automatic chicken coop door that opens in the morning and closes at night
  • A heavy robot base with two BTS7960 modules, one for each drive wheel

Video Tutorial

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!