A 4-motor robot car controlled via Bluetooth using ESP32, HC-06 Bluetooth module, and BTS7960 motor drivers. Features variable speed control (0-100%) and 8-direction movement capabilities.
This project implements a fully functional Bluetooth-controlled robot car with:
- 4x 12V 500 RPM DC Gear Motors - Two motors per side (left and right)
- 2x BTS7960 Motor Drivers - One driver for left side, one for right side
- ESP32 Microcontroller - Main control unit
- HC-06 Bluetooth Module - Wireless communication interface
- Variable Speed Control - 0-100% in 10% increments
- 8-Direction Movement - Forward, backward, left, right, and 4 diagonal directions
| Component | Quantity | Specifications |
|---|---|---|
| ESP32 Development Board | 1 | Any ESP32 variant (ESP32-WROOM, ESP32-DevKit, etc.) |
| HC-06 Bluetooth Module | 1 | 3.3V logic, 9600 baud default |
| BTS7960 Motor Driver | 2 | High-current H-bridge driver |
| 12V DC Gear Motor | 4 | 500 RPM, suitable current rating |
| 12V Battery Pack | 1 | Sufficient capacity for motors (2-5A per motor) |
| 5V Power Supply | 1 | For ESP32 (USB or regulated supply) |
| Jumper Wires | As needed | 22-24 AWG for signals, 18-20 AWG for motor power |
| Breadboard/PCB | 1 | For prototyping or permanent mounting |
- ✅ Bluetooth wireless control via HC-06 module
- ✅ Variable speed control (0-100% in 10% steps)
- ✅ 8-direction movement (forward, back, left, right, 4 diagonals)
- ✅ Smooth PWM-based motor control
- ✅ Emergency stop function
- ✅ Real-time command processing
- ✅ Serial debugging support
-
Review Connections
- Read
CONNECTIONS.mdfor detailed wiring instructions - Ensure all components are properly connected
- Verify all GND connections are common (shared ground)
- Read
-
Power Supplies
- Connect ESP32 via USB or 5V regulated supply
- Connect 12V battery pack to both BTS7960 modules (B+ and B-)
- Critical: Connect 12V battery negative to common GND
-
Initial Check
- Power on ESP32 and verify it initializes
- Check Serial Monitor (115200 baud) for startup messages
- Verify HC-06 LED is blinking
-
Install Arduino IDE
- Download from arduino.cc
- Install ESP32 board support:
- File → Preferences → Additional Board Manager URLs
- Add:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json - Tools → Board → Boards Manager → Search "ESP32" → Install
-
Upload Code
- Open
robot_car.inoin Arduino IDE - Select board: Tools → Board → ESP32 Arduino → Your ESP32 board
- Select port: Tools → Port → (your ESP32 port)
- Click Upload button
- Wait for "Done uploading" message
- Open
-
Verify Upload
- Open Serial Monitor (Tools → Serial Monitor)
- Set baud rate to 115200
- You should see initialization messages
- Enable Bluetooth on your smartphone/tablet
- Scan for devices - Look for "ESP32_RobotCar"
- Pair - Default PIN is usually "1234" or "0000"
- Verify connection - Device should show as "Connected"
Recommended Android apps:
- Arduino Bluetooth Controller (by Mightyohm)
- Bluetooth RC Controller (by SimpleSoft)
See TESTING.md for detailed app configuration and button mapping.
- Start with wheels off ground (safety first!)
- Test basic movements: Forward (F), Backward (B), Left (L), Right (R)
- Test speed control: Set speed to 20% (2), then try movements
- Test on ground at low speed, then gradually increase
See TESTING.md for comprehensive testing procedures.
| Command | Function | Description |
|---|---|---|
| F | Forward | Both sides move forward |
| B | Backward | Both sides move backward |
| L | Turn Left | Right forward, left backward (spin left) |
| R | Turn Right | Left forward, right backward (spin right) |
| G | Forward Left | Right full speed, left reduced (diagonal) |
| 1 | Forward Right | Left full speed, right reduced (diagonal) |
| H | Back Left | Right backward full, left backward reduced |
| J | Back Right | Left backward full, right backward reduced |
| S | Stop | Stop all motors |
| Command | Speed | PWM Value |
|---|---|---|
| 0 | 0% | 0 |
| 2 | 20% | 51 |
| 3 | 30% | 77 |
| 4 | 40% | 102 |
| 5 | 50% | 128 (default) |
| 6 | 60% | 153 |
| 7 | 70% | 179 |
| 8 | 80% | 204 |
| 9 | 90% | 230 |
| q | 100% | 255 |
Note: Speed 10% (command '1') conflicts with Forward Right movement. In current implementation, '1' triggers Forward Right. To achieve 10% speed, use speed 0% and gradually increase, or modify the code.
| Command | Function | Description |
|---|---|---|
| D | Stop All | Emergency stop - stops motors and resets speed to default |
Robo car racing/
├── README.md # This file - project overview and quick start
├── CONNECTIONS.md # Detailed wiring diagram and connections
├── TESTING.md # Comprehensive testing guide and troubleshooting
└── robot_car.ino # Main Arduino code for ESP32
- Microcontroller: ESP32 (240 MHz dual-core, WiFi/Bluetooth)
- Bluetooth Module: HC-06 (Classic Bluetooth, 9600 baud)
- Motor Drivers: BTS7960 (43A peak, H-bridge)
- Motors: 12V DC Gear Motors, 500 RPM
- PWM Frequency: 1000 Hz
- PWM Resolution: 8-bit (0-255)
- Platform: Arduino IDE with ESP32 support
- Bluetooth Library: BluetoothSerial (built-in)
- Communication: Serial over Bluetooth (9600 baud)
- Command Protocol: Single ASCII character commands
-
Power Supply Isolation
- ESP32 and motors use separate power supplies
- Never connect motor power (12V) directly to ESP32
- Always use common ground connection
-
Current Requirements
- Motors can draw 2-5A each at full load
- Ensure battery pack can supply sufficient current
- Use appropriate wire gauge for motor connections (18-20 AWG)
-
Testing Safety
- Always test with wheels off ground first
- Start with low speeds
- Keep hands away from moving parts
- Have emergency stop ready (D command)
-
Battery Safety
- Use appropriate battery type (LiPo, NiMH, etc.)
- Monitor battery voltage - don't over-discharge
- Use proper battery protection circuits if needed
- Charge batteries in safe location
-
Electrical Safety
- Disconnect power before making wiring changes
- Check for short circuits before powering on
- Use proper insulation on all connections
- Ensure no loose wires
Common issues and solutions:
- Check 12V battery connection and charge
- Verify BTS7960 enable pins (L_EN, R_EN) are HIGH
- Check motor connections to M+ and M- terminals
- Verify common ground connection
- Check HC-06 VCC is 3.3V (not 5V)
- Verify TXD/RXD connections (crossed: TX→RX, RX→TX)
- Try different pairing codes: "1234", "0000"
- Ensure device is within range (10 meters)
- Swap M+ and M- connections on affected driver
- Or modify code to reverse direction logic
- Check power supply quality and current capacity
- Verify no short circuits
- Check for overheating
For detailed troubleshooting, see TESTING.md.
In robot_car.ino, modify:
int currentSpeed = 128; // Change this value (0-255)In robot_car.ino, modify:
#define PWM_FREQUENCY 1000 // Change frequency in HzIn diagonal movement functions, modify the speed reduction:
int leftSpeed = currentSpeed / 2; // Change /2 to /3, /4, etc.In robot_car.ino, modify:
SerialBT.begin("ESP32_RobotCar"); // Change device name✅ Hardware connections documented
✅ Arduino code implemented
✅ Testing procedures documented
✅ Command protocol defined
✅ Safety guidelines provided
Possible improvements:
- Add obstacle avoidance sensors
- Implement speed ramping for smoother acceleration
- Add battery voltage monitoring
- Implement PID control for precise movement
- Add LED indicators for status
- Create custom mobile app
- Add IMU for orientation control
- Implement autonomous navigation modes
This project is provided as-is for educational and hobby purposes.
For issues or questions:
- Review
CONNECTIONS.mdfor wiring issues - Review
TESTING.mdfor testing and troubleshooting - Check Serial Monitor output for error messages
- Verify all connections match the documentation
- ESP32 Arduino Core developers
- BTS7960 motor driver documentation
- HC-06 Bluetooth module community
Happy Building! 🚗💨
Remember: Safety first, test thoroughly, and have fun!