BTS7960 43 A motor driver (IBT-2) with ESP32

Supply 5 V Bus GPIO
RPWMLPWMR_ENL_ENR_ISL_ISVCCGNDB+B-M+M-

Pins and ESP32 wiring

PinRoleESP32 pinNotes
RPWMInput (the ESP32 drives it)D25Forward PWM
LPWMInput (the ESP32 drives it)D26Reverse PWM
R_ENInput (the ESP32 drives it)D27HIGH to enable. Often tied to L_EN
L_ENInput (the ESP32 drives it)D32HIGH to enable
R_ISAnalog outputD34Current sense. Can exceed 3.3 V on a fault: add a divider before an ADC pin
L_ISAnalog outputD35Current sense. Can exceed 3.3 V on a fault: add a divider before an ADC pin
VCCPowerVIN5 V logic supply: use VIN. Inputs via a 74HC244 buffer: 3.3 V is below spec, often works
GNDGroundGND
B+Not wired to the ESP32—Motor supply + 6 to 27 V (screw terminal)
B-Not wired to the ESP32—Motor supply - (screw terminal)
M+Not wired to the ESP32—Motor
M-Not wired to the ESP32—Motor

Suggested wiring for the 30-pin ESP32 DevKit, avoiding flash, input-only and strapping pins. BoardPilot checks it for you as you wire.

This module is sold for 5 V. Its outputs may be 5 V: use a level shifter or a voltage divider on ESP32 inputs.

Starter code (Arduino)

void setup() { Serial.begin(115200); }

void loop() {
  int mv = analogReadMilliVolts(34);  // R_IS on GPIO 34
  Serial.println(mv);
  delay(200);
}

Sources

Try it in 3D in BoardPilot

BoardPilot Part data (JSON)

Related parts

Part data: CC BY 4.0, free to reuse with credit to BoardPilot.