Controlling Multiple DC Motors Using a BTS7960 Module with Arduino
In this tutorial, we will explore how to control multiple DC motors using the BTS7960 module with an Arduino. The BTS7960 is a powerful motor driver capable of handling high currents and allows for precise control of motor direction and speed through PWM (Pulse Width Modulation). By the end of this project, you will have a working setup that can control two DC motors, rotating them in both clockwise and counterclockwise directions. This tutorial will guide you through the hardware setup, wiring instructions, and the code needed to operate the motors. For a clearer understanding of the entire process, make sure to check out the accompanying video (in video at 00:00).
Hardware Explained
The primary component of this project is the BTS7960 motor driver module. This module includes two H-bridge drivers that can control the direction of the motors by switching the polarity of the voltage applied to the motor. Each driver can handle up to 43A of current, which makes it suitable for high-power applications. The module also features built-in protection against over-temperature and over-current situations. In addition to the BTS7960, you will need an Arduino board for controlling the motors. The Arduino sends PWM signals to the motor driver, allowing you to adjust the speed and direction of the motors. The connections between the Arduino and the BTS7960 module are crucial, as they dictate how the motors will respond to the signals.
Datasheet Details
| Manufacturer | Infineon Technologies |
|---|---|
| Part number | BTS7960 |
| Logic/IO voltage | 3.3 V to 5 V |
| Supply voltage | 5–40 V |
| Output current (per channel) | 43 A max |
| Peak current (per channel) | 60 A |
| PWM frequency guidance | 5–25 kHz |
| Input logic thresholds | 0.8 V (high), 0.3 V (low) |
| Voltage drop / RDS(on) / saturation | 16 mΩ |
| Thermal limits | 150 °C max |
| Package | TO-263 |
| Notes / variants | Dual H-bridge configuration |
- Ensure proper heat sinking when operating at high currents.
- Use appropriate wire gauge for power connections.
- Double-check pin mappings between the Arduino and BTS7960.
- Implement current limiting to prevent damage to the module.
- Use decoupling capacitors near the power supply for stability.
Wiring Instructions

To wire the BTS7960 module to the Arduino, follow these connections carefully: 1. **Power Connections**: Connect the positive terminal of your power source to the B+ terminal on the BTS7960 module, and the negative terminal to the B- terminal. Ensure that the power source matches the voltage requirements of your motors. 2. **Motor Connections**: Connect the motor wires to the M+ and M- terminals on the module. This will enable the module to control the motor. 3. **Arduino Pins**: Connect the following pins on the Arduino to the BTS7960 module: - Pin 3 (RPWM) to the RPWM pin on the module. - Pin 4 (R_EN) to the R_EN pin on the module. - Pin 5 (R_IS) to the R_IS pin on the module. - Pin 6 (LPWM) to the LPWM pin on the module. - Pin 7 (L_EN) to the L_EN pin on the module. - Pin 8 (L_IS) to the L_IS pin on the module. 4. **Ground Connections**: Connect the ground pin of the Arduino to the ground pin on the BTS7960 module to ensure a common reference for the signals. Make sure all connections are secure to prevent any unexpected behavior during operation.
Install required library
To install the robojax_BTS7960_motor_driver_library in the Arduino IDE, first download the library's ZIP file from the provided link. With the file saved, open your Arduino IDE and navigate to Sketch > Include Library > Add .ZIP Library.... In the file selection dialog, browse to the downloaded ZIP file, select it, and click "Open". The IDE will then install the library. You can confirm a successful installation by checking the File > Examples menu, where a new category named "Robojax BTS7960 Motor Driver Library" should appear. You can now include the library header in your code with #include <RobojaxBTS7960.h>.
Code Examples & Walkthrough
The following code snippets demonstrate how to set up and control the motors using the BTS7960 module. The initial setup defines the pins connected to the motors and initializes the motor objects:
// pins for motor 1
#define RPWM_1 3
#define R_EN_1 4
#define R_IS_1 5
#define LPWM_1 6
#define L_EN_1 7
#define L_IS_1 8
// pins for motor 2
#define RPWM_2 9
#define R_EN_2 10
#define R_IS_2 12
#define LPWM_2 11
#define L_EN_2 A0
#define L_IS_2 A1
#include
RobojaxBTS7960 motor1(R_EN_1, RPWM_1, R_IS_1, L_EN_1, LPWM_1, L_IS_1, debug);
RobojaxBTS7960 motor2(R_EN_2, RPWM_2, R_IS_2, L_EN_2, LPWM_2, L_IS_2, debug);
This section of code sets up the pin definitions and creates instances of the `RobojaxBTS7960` class for both motors. The `setup()` function initializes the motors and the serial monitor:
void setup() {
Serial.begin(9600); // setup Serial Monitor
motor1.begin();
motor2.begin();
}
Here, the `motor.begin()` method prepares each motor for operation, allowing you to control them in the `loop()` function. In the `loop()` function, you can control the motors with commands like this:
void loop() {
motor1.rotate(100, CW); // run motor 1 at 100% speed CW
delay(5000); // run for 5 seconds
motor1.stop(); // stop motor 1
delay(3000); // stop for 3 seconds
motor2.rotate(100, CCW); // run motor 2 at 100% speed CCW
delay(5000); // run for 5 seconds
motor2.stop(); // stop motor 2
delay(3000); // stop for 3 seconds
}
This section shows how to rotate the motors in both directions and control their speed. The full code is loaded below the article for your reference.
Demonstration / What to Expect
Upon completing the wiring and uploading the code, you should observe the motors rotating in both clockwise and counterclockwise directions. The code will run each motor at full speed for five seconds, stop for three seconds, and repeat the process. Watch for any potential issues such as reversed connections or insufficient power supply. If you encounter problems, double-check your wiring and ensure that the power source is adequate (in video at 00:00).
Video Timestamps
- 00:00 Start
- 00:48 Hardware Explained
- 04:06 Datasheet viewed
- 07:07 Wiring Explained
- 09:00 Code explained
- 14:33 Demonstration
- 16:47 Maximum current test
- 19:25 Thermal image
- 19:27 Different code test
Ресурсы и ссылки
-
ВнешнийBTS7960 Амазон Японияamzn.to
-
ВнешнийBTS7960 на Amazon Italiaamzn.to
-
ВнешнийBTS7960 на Amazon Испанияamzn.to
-
ВнешнийBTS7960 на Amazon Францияamzn.to
-
ВнешнийBTS7960, Amazon Германияamzn.to
-
ВнешнийКупите BTS7960 на Amazonamzn.to
-
ВнешнийКупите BTS7960 на Amazon Канадаamzn.to
-
ВнешнийКупить BTS7960, Amazon UKamzn.to
-
ВнешнийТехнические данные модуля BTS7960 (PDF)handsontec.com
Файлы📁
Библиотеки Arduino (zip)
-
robojax_BTS7960_motor_driver_library
robojax_BTS7960_motor_driver_library.zip0.10 MB
Технический паспорт (pdf)
-
BTS7960_datasheet
BTS7960_datasheet.pdf0.45 MB
Файл Fritzing
-
BTS7960_driver
BTS7960_driver.fzpz0.01 MB