This document provides detailed wiring instructions for connecting the ESP32, HC-06 Bluetooth module, BTS7960 motor drivers, and 12V motors for the robot car project.
| HC-06 Pin | ESP32 Pin | Description |
|---|---|---|
| VCC | 3.3V | Power supply (3.3V) |
| GND | GND | Ground (common) |
| TXD | GPIO 16 | Transmit data (HC-06 TX → ESP32 RX) |
| RXD | GPIO 17 | Receive data (HC-06 RX → ESP32 TX) |
Note: HC-06 operates at 3.3V logic level, which is compatible with ESP32.
This driver controls the left side motors (2 motors connected in parallel).
| BTS7960 Pin | ESP32 Pin | Description |
|---|---|---|
| VCC | 5V | Logic power supply |
| GND | GND | Ground (common) |
| L_EN | GPIO 25 | Left enable pin |
| R_EN | GPIO 26 | Right enable pin |
| LPWM | GPIO 27 | Left PWM signal (forward) |
| RPWM | GPIO 14 | Right PWM signal (backward) |
| M+ | Motor + | Positive terminal (2 left motors in parallel) |
| M- | Motor - | Negative terminal (2 left motors in parallel) |
| B+ | 12V + | Motor power supply positive |
| B- | 12V - | Motor power supply negative (common ground) |
Motor Connection:
- Connect both left motors in parallel: Motor1+ and Motor2+ → M+
- Connect both left motors in parallel: Motor1- and Motor2- → M-
This driver controls the right side motors (2 motors connected in parallel).
| BTS7960 Pin | ESP32 Pin | Description |
|---|---|---|
| VCC | 5V | Logic power supply |
| GND | GND | Ground (common) |
| L_EN | GPIO 33 | Left enable pin |
| R_EN | GPIO 32 | Right enable pin |
| LPWM | GPIO 13 | Left PWM signal (forward) |
| RPWM | GPIO 12 | Right PWM signal (backward) |
| M+ | Motor + | Positive terminal (2 right motors in parallel) |
| M- | Motor - | Negative terminal (2 right motors in parallel) |
| B+ | 12V + | Motor power supply positive (shared with left driver) |
| B- | 12V - | Motor power supply negative (common ground) |
Motor Connection:
- Connect both right motors in parallel: Motor3+ and Motor4+ → M+
- Connect both right motors in parallel: Motor3- and Motor4- → M-
- Option 1: USB cable connected to computer or USB power adapter (5V)
- Option 2: 5V regulated power supply connected to 5V and GND pins
- Current requirement: ~500mA typical
- Voltage: 12V DC
- Current requirement: Depends on motor specifications (typically 2-5A per motor at full load)
- Connection:
- 12V battery positive (+) → B+ on both BTS7960 modules
- 12V battery negative (-) → B- on both BTS7960 modules
- IMPORTANT: Also connect 12V battery negative (-) to common GND
| GPIO Pin | Function | Component |
|---|---|---|
| 16 | RX | HC-06 Bluetooth |
| 17 | TX | HC-06 Bluetooth |
| 12 | RPWM | Right BTS7960 |
| 13 | LPWM | Right BTS7960 |
| 14 | RPWM | Left BTS7960 |
| 25 | L_EN | Left BTS7960 |
| 26 | R_EN | Left BTS7960 |
| 27 | LPWM | Left BTS7960 |
| 32 | R_EN | Right BTS7960 |
| 33 | L_EN | Right BTS7960 |
ESP32
┌─────┐
│ │
3.3V ───────┤VCC │
GND ────────┤GND │
│ │
│GPIO │
│ 16 │◄─── TXD (HC-06)
│ 17 │───► RXD (HC-06)
│ │
│ 25 │───► L_EN (Left BTS7960)
│ 26 │───► R_EN (Left BTS7960)
│ 27 │───► LPWM (Left BTS7960)
│ 14 │───► RPWM (Left BTS7960)
│ │
│ 33 │───► L_EN (Right BTS7960)
│ 32 │───► R_EN (Right BTS7960)
│ 13 │───► LPWM (Right BTS7960)
│ 12 │───► RPWM (Right BTS7960)
│ │
│ 5V │───► VCC (Both BTS7960)
└─────┘
Left BTS7960 Right BTS7960
┌──────────┐ ┌──────────┐
│ M+ M- │ │ M+ M- │
│ │ │ │ │ │ │ │
│ └───┴───┼─── Left │ └───┴───┼─── Right
│ │ Motors │ │ Motors
│ B+ B- │ │ B+ B- │
│ │ │ │ │ │ │ │
└──┼───┼───┘ └──┼───┼───┘
│ │ │ │
│ └─────────────────────┘ │
│ │
12V Battery Pack │
┌──────────┐ │
│ + - │─────────────────────┘
└──────────┘
│
└───────────────────────────► Common GND
Before powering on, verify:
- HC-06 VCC connected to ESP32 3.3V
- HC-06 GND connected to ESP32 GND
- HC-06 TXD connected to ESP32 GPIO 16
- HC-06 RXD connected to ESP32 GPIO 17
- Left BTS7960 VCC connected to ESP32 5V
- Left BTS7960 GND connected to ESP32 GND
- Left BTS7960 L_EN connected to ESP32 GPIO 25
- Left BTS7960 R_EN connected to ESP32 GPIO 26
- Left BTS7960 LPWM connected to ESP32 GPIO 27
- Left BTS7960 RPWM connected to ESP32 GPIO 14
- Right BTS7960 VCC connected to ESP32 5V
- Right BTS7960 GND connected to ESP32 GND
- Right BTS7960 L_EN connected to ESP32 GPIO 33
- Right BTS7960 R_EN connected to ESP32 GPIO 32
- Right BTS7960 LPWM connected to ESP32 GPIO 13
- Right BTS7960 RPWM connected to ESP32 GPIO 12
- Left motors (2) connected in parallel to Left BTS7960 M+ and M-
- Right motors (2) connected in parallel to Right BTS7960 M+ and M-
- 12V battery positive connected to B+ on both BTS7960 modules
- 12V battery negative connected to B- on both BTS7960 modules
- All GND connections are common (connected together)
- ESP32 powered via USB or 5V supply
- All connections are secure and properly insulated
- Check if 12V battery is connected and has sufficient charge
- Verify B+ and B- connections on BTS7960 modules
- Check motor connections to M+ and M- terminals
- Ensure common ground is properly connected
- Swap the M+ and M- connections on the affected motor driver
- Or modify the code to reverse the direction logic
- Verify HC-06 VCC is connected to 3.3V (not 5V)
- Check TXD/RXD connections (they should be crossed: TXD→RX, RXD→TX)
- Ensure HC-06 is powered and LED is blinking
- Check 5V/USB power supply
- Verify all GND connections are common
- Check for short circuits
- The BTS7960 modules require both enable pins (L_EN and R_EN) to be HIGH for the motors to operate
- PWM signals control motor speed (0-255 = 0-100% speed)
- Motor direction is controlled by which PWM channel is active (LPWM for forward, RPWM for backward)
- Always power off before making or changing connections
- Use appropriate wire gauge for motor power connections (18-20 AWG recommended)