Firmware
The Robomates firmware runs on an ESP32-MINI and handles everything from self-balancing to wireless communication. Built with PlatformIO using the Arduino framework.
View on GitHub →Features
Self-Balancing
PID-based pitch stabilization using an MPU6050 IMU and field-oriented control (FOC) of two BLDC motors
Sub-GHz Radio
CC1101 transceiver at 869.525 MHz for inter-robot communication (UK + Europe, US under development)
BLE Connectivity
Connects to the web app and gamepads simultaneously via Bluepad32 dual-mode stack
Hardware Crypto
ATECC508A chip gives each robot a unique ECDSA P-256 identity for authentication
Fall Detection
Automatic detection when a robot tips over, with 150 ms debounce for reliable triggering
Proximity Scanning
RSSI-based close-range detection between robots for games like Zombie Tag
Temperature Monitoring
Three TMP117 sensors on main and motor boards with automatic overheat protection
Gamepad Support
PS5, PS4, Xbox, Switch Pro, Joy-Con, and more via Bluetooth Classic
Build Targets
Robot firmware variants
| Target | Description | Region |
|---|---|---|
robomate_868 |
Robot firmware with 868 MHz sub-GHz radio | Europe & UK |
robomate_subghz_disabled |
Robot firmware with sub-GHz radio disabled | US (interim) |
robomate_915 for the US market, which will use 915 MHz sub-GHz radio.
Architecture
FreeRTOS Tasks
| Task | Core | Priority | Purpose |
|---|---|---|---|
| BalanceControl | 1 | 5 | IMU reading, PID loops, motor output, fall detection |
| CC1101Task | 0 | 2 | RF receive/transmit, message processing |
| Arduino loop | 1 | 1 | BLE, serial, controller input, LED updates, battery/temp |
Balance Controller
The balance system uses cascaded PID controllers running at high priority on Core 1. The values below are the defaults and can be easily adjusted through the firmware config:
| Controller | P | I | D | Purpose |
|---|---|---|---|---|
| Stability | 0.46 | 1.3 | 0.009 | Primary pitch stabilization |
| Velocity | 0.015 | 0.001 | 0 | Forward / backward speed |
| Steering | 0.02 | 0 | 0 | Left / right turning |
| Crawl | 0.004 | 0 | 0 | Low-speed crawling when fallen |
Communication Protocol
All RF messages use a common frame: start canary 0xAB, payload, 16-bit checksum, end canary 0xCD.
| Message | ID | Size | Direction | Purpose |
|---|---|---|---|---|
| PING | 0x01 | 57 B | Robot → all | Status broadcast every 750 ms |
| UPDATE_STATUS | 0x02 | 18–243 B | HQ → robots | LED / speed / torque commands |
| SCAN | 0x03 | 11 B | Robot → nearby | Proximity detection burst |
UPDATE_STATUS carries per-robot LED colors and speed/torque coefficients for up to 16 robots in a single packet.
Timing
Libraries
| Library | Version | Purpose |
|---|---|---|
| SimpleFOC | latest | BLDC field-oriented control |
| FastLED | 3.10.1 | WS2812B LED control |
| SparkFun ATECCX08a | 1.3.1 | Crypto chip driver |
| Adafruit TMP117 | 1.0.3 | Temperature sensor driver |
| RadioLib | bundled | CC1101 radio driver |
| Bluepad32 | bundled | Bluetooth gamepad stack |
LED Indication
| Condition | LED Position | Color |
|---|---|---|
| Normal operation | Bottom LEDs | Off |
| Low battery | Bottom LEDs | Yellow |
| Overheating | Bottom LEDs | White |
| Motors disabled | Bottom LEDs | Red |
| Temp sensor failure | Bottom LEDs | Pink |
| Scan detected | Eyes | Magenta (1.5 s) |
Flashing
Via USB (HQ Serial Dev Tool)
- Open Robomates HQ → Serial Dev page
- Connect the robot via USB
- Select the firmware file and flash
Via PlatformIO CLI
git clone https://github.com/art-rbmates/robomates-firmware.git
cd robomates-firmware
pio run -e robot -t upload
Via PlatformIO in VS Code
- Install the PlatformIO IDE extension in VS Code
- Open the
robomates-firmwareproject folder - Select the build target from the PlatformIO toolbar
- Click Upload