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

TargetDescriptionRegion
robomate_868 Robot firmware with 868 MHz sub-GHz radio Europe & UK
robomate_subghz_disabled Robot firmware with sub-GHz radio disabled US (interim)
We are working on robomate_915 for the US market, which will use 915 MHz sub-GHz radio.

Architecture

FreeRTOS Tasks

TaskCorePriorityPurpose
BalanceControl 15 IMU reading, PID loops, motor output, fall detection
CC1101Task 02 RF receive/transmit, message processing
Arduino loop 11 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:

ControllerPIDPurpose
Stability0.461.30.009Primary pitch stabilization
Velocity0.0150.0010Forward / backward speed
Steering0.0200Left / right turning
Crawl0.00400Low-speed crawling when fallen
Target pitch-0.61 rad
Fall threshold±0.8 rad
Max velocity30 (normal) / 40 (boost)
Motor controlFOC via SimpleFOC

Communication Protocol

All RF messages use a common frame: start canary 0xAB, payload, 16-bit checksum, end canary 0xCD.

MessageIDSizeDirectionPurpose
PING0x0157 BRobot → allStatus broadcast every 750 ms
UPDATE_STATUS0x0218–243 BHQ → robotsLED / speed / torque commands
SCAN0x0311 BRobot → nearbyProximity detection burst
PING carries: battery voltage, controller type, robot name, temperatures, firmware version, LED states, speed/torque, fall status, and nearby robot IDs.

UPDATE_STATUS carries per-robot LED colors and speed/torque coefficients for up to 16 robots in a single packet.

Timing

Ping interval750 ms + 20% jitter
Triggered ping<100 ms after update
TX retries3 per message
Scan burst1.5 s duration, 200 ms interval

Libraries

LibraryVersionPurpose
SimpleFOClatestBLDC field-oriented control
FastLED3.10.1WS2812B LED control
SparkFun ATECCX08a1.3.1Crypto chip driver
Adafruit TMP1171.0.3Temperature sensor driver
RadioLibbundledCC1101 radio driver
Bluepad32bundledBluetooth gamepad stack

LED Indication

ConditionLED PositionColor
Normal operationBottom LEDs Off
Low batteryBottom LEDs Yellow
OverheatingBottom LEDs White
Motors disabledBottom LEDs Red
Temp sensor failureBottom LEDs Pink
Scan detectedEyes Magenta (1.5 s)

Flashing

Via USB (HQ Serial Dev Tool)

  1. Open Robomates HQ → Serial Dev page
  2. Connect the robot via USB
  3. 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

  1. Install the PlatformIO IDE extension in VS Code
  2. Open the robomates-firmware project folder
  3. Select the build target from the PlatformIO toolbar
  4. Click Upload