Wireless control of differential wheeled robot using PS3 Bluetooth controller with ESP32
This project combines:
- PS3 Bluetooth Control - Wireless communication between PS3 controller and ESP32
- STM32 Firmware Hack - Modified hoverboard motherboard firmware for custom motor control
- Safety System - Automatic stop on controller disconnect
| Component | Role | Source |
|---|---|---|
| PS3 Controller Layer | Handles Bluetooth communication | PS3-ESP32 |
| STM32 Hack | Motor control logic | Hoverboard-Firmware-Hack |
- Bluetooth Control
- Latency: <20ms
- Range: Up to 10m
- Auto-stop safety: Halts motors on controller disconnect
- STM32 Modifications
- Custom speed/acceleration profiles
- Deadband filtering
- Safety cutoffs
- Analog stick calibration support
Source: hoverboard-firmware-hack-FOC
Modified Files:
firmware_mods/
├── main.c # Motor control logic
├── config.h # Critical parameters
└── platformio.ini
Flashing Steps:
- Connect ST-Link V2 to hoverboard mainboard
- Use STM32CubeProgrammer:
Full guide: Original Instructions
- Upload ESP32 controller code with PS3 MAC address
- Put PS3 controller in pairing mode (PS button)
- ESP32 automatically connects when powered
- Solid LED = Connected, Blinking LED = Searching
Safety Feature: Motors immediately stop if connection drops
| Component | Quantity | Notes |
|---|---|---|
| Hoverboard Motherboard | 1 | STM32F103 based |
| ESP32 | 1 | Bluetooth enabled |
| PS3 Controller | 1 | DualShock 3 compatible |
| ST-Link Programmer | 1 | For STM32 flashing |
| 36V Battery | 1 | Hoverboard main power |
Wiring:
graph LR
PS3_Controller -->|Bluetooth| ESP32
ESP32 -->|DAC| STM32
STM32 -->|PWM| Motor_Driver
- Connection Safety:
- Robot automatically stops if:
- Controller battery low
- Bluetooth signal lost
- Emergency stop button pressed
- Robot automatically stops if:
- Configuration Parameters:
// esp32_controller.ino
#define acc 50 //acceleration step if you don't need acceleration and dceleration you can make it equal to maxspeed
#define accDelay 250 //acceleration delay
#define maxspeed 100 // max value frome the center (between 0 and 126)
#define deadband 5 // Ignore stick drift
- Motor Control Logic (STM32):
// main.c modifications
steer *= 0.12; // PS3 analog stick scaling
speed *= 0.12; // Adjust for sensitivity-
STM32 Firmware: hoverboard-firmware-hack-FOC (GPLv3)
-
Modifications: achref-ak
The ESP32 continuously monitors controller connection status:
Motors remain disabled until controller reconnects