Overview
The IBT-2 motor driver (based on BTS7960 chip) is a high-current H-bridge that allows bidirectional control of DC motors. Understanding how it works is essential for motor control.IBT-2 Specifications
Key Features
- Chip: BTS7960 dual H-bridge
- Supply Voltage: 5.5V - 27V
- Motor Voltage: 6V - 27V
- Max Current: 43A continuous (per motor)
- Peak Current: ~100A (brief surges)
- PWM Frequency: Up to 25kHz
- Logic Voltage: 3.3V or 5V compatible
- Protection: Over-current, over-temperature, under-voltage
How H-Bridges Work
An H-bridge allows motor direction control by switching which motor terminal is connected to power/ground:IBT-2 Pin Configuration
Power Pins
| Pin | Function | Connection |
|---|---|---|
| B+ | Motor Power (+) | 12V battery positive |
| B- | Motor Ground (-) | 12V battery negative / GND |
| M+ | Motor Terminal + | Motor wire 1 |
| M- | Motor Terminal - | Motor wire 2 |
Logic Pins
| Pin | Function | Connection | Notes |
|---|---|---|---|
| RPWM | Right PWM | ESP32 GPIO (e.g., GPIO 4) | Forward direction PWM |
| LPWM | Left PWM | ESP32 GPIO (e.g., GPIO 16) | Reverse direction PWM |
| R_EN | Right Enable | 3.3V or 5V | Enable right side (can connect to GPIO for enable/disable) |
| L_EN | Left Enable | 3.3V or 5V | Enable left side |
| R_IS | Right Current Sense | Optional | Analog output proportional to current |
| L_IS | Left Current Sense | Optional | Analog output proportional to current |
| VCC | Logic Power | 5V from ESP32 | Powers control logic |
| GND | Logic Ground | ESP32 GND | MUST connect to ESP32 GND |
Wiring Diagram
Basic Connection
With Enable Control (Optional)
Control Methods
Method 1: Dual PWM (Recommended)
Control speed AND direction with two PWM signals: Forward:- RPWM: PWM signal (0-255)
- LPWM: 0 (LOW)
- RPWM: 0 (LOW)
- LPWM: PWM signal (0-255)
- RPWM: 0
- LPWM: 0
Method 2: Sign-Magnitude (Alternative)
- One PWM for speed (magnitude)
- One digital pin for direction (sign)
Example Code
Complete Motor Control
PWM Frequency Selection
Frequency Trade-offs
| Frequency | Pros | Cons | Use Case |
|---|---|---|---|
| 1-5 kHz | Quiet motor | Visible PWM flicker | Good default |
| 10-20 kHz | Very smooth | Audible whine | Silent operation |
| 25+ kHz | Ultrasonic (silent) | Higher switching losses | Professional |
Current Sensing (Optional)
IBT-2 has R_IS and L_IS pins that output voltage proportional to current:Current sensing calibration varies by board. Measure with multimeter to verify.
Thermal Management
Heat Dissipation
BTS7960 chips can get HOT (60-80°C) during operation: Cooling Methods:- Ensure airflow around drivers
- Don’t enclose in sealed box
- Add heatsinks if running high current
- Monitor temperature during testing
- BTS7960 has built-in thermal protection
- Shuts down if overheating (~150°C junction temp)
- Automatically recovers when cooled
Protection Features
Over-Current Protection
- Automatic current limiting
- No external fuse needed
- Protects both motor and battery
Under-Voltage Lockout
- Prevents operation below ~5.5V
- Protects against brownout conditions
Diagnostic Outputs
- R_IS and L_IS can indicate faults
- Very high voltage = over-current event
Troubleshooting
Motor doesn't spin
Motor doesn't spin
Check:
- Power connected (B+, B-)
- Motor connected (M+, M-)
- Enable pins HIGH (R_EN, L_EN)
- PWM signal present (measure with oscilloscope or LED)
- Common ground ESP32 ↔ IBT-2
Motor spins wrong direction
Motor spins wrong direction
Solution:
- Swap M+ and M- motor wires
- OR swap RPWM/LPWM in code
Motor stutters or jerks
Motor stutters or jerks
Causes:
- PWM frequency too low
- Voltage drop under load
- Loose connections
- Increase PWM frequency (10-20kHz)
- Use thicker wires for power
- Add bulk capacitor near driver (1000µF, 16V+)
- Check all connections
Driver gets very hot
Driver gets very hot
Normal if:
- Running high current (>2A)
- Continuous operation
- Add heatsink
- Improve airflow
- Reduce motor load
- Use lower PWM frequency (reduces switching loss)
Driver shuts down
Driver shuts down
Causes:
- Over-current protection triggered
- Over-temperature protection
- Under-voltage
- Reduce motor load
- Improve cooling
- Check battery voltage (should be >11V under load)
- Wait for driver to cool, then retry
Safety Practices
- Never connect/disconnect while powered
- Verify polarity before applying power
- Start with low PWM (20-30%) for testing
- Monitor current draw (should be <3A per motor typically)
- Have emergency stop method ready
- Keep clear of moving parts during testing
Comparison with Other Drivers
| Driver | Max Current | Voltage | Cost | Notes |
|---|---|---|---|---|
| IBT-2 (BTS7960) | 43A | 5.5-27V | ~$7 | Best for this project |
| L298N | 2A | 5-35V | ~$3 | Too weak for 12V motors |
| DRV8833 | 1.2A per channel | 2.7-10.8V | ~$5 | Too weak |
| VNH5019 | 12A | 5.5-24V | ~$15 | Good alternative |
| ESC (Electronic Speed Controller) | Varies | Varies | $10-30 | For brushless motors only |
Next Steps
DC Motor Control
Implement closed-loop motor control with PID
Unit Testing
Test motor driver systematically
Hardware Reference
Detailed motor driver specifications
Code Examples
Complete PID controller code