Development Setup
The RoArm-M2-S runs on an ESP32 MCU. To modify or reflash the firmware, you need Arduino IDE configured with the ESP32 board support package.
Prerequisites
Section titled “Prerequisites”- Arduino IDE 2.x (or 1.8.x)
- USB-C cable
- CP2102 or CH340 USB-serial driver (usually included with your OS)
Arduino IDE Setup
Section titled “Arduino IDE Setup”-
Install Arduino IDE from arduino.cc
-
Add ESP32 board support
Open File → Preferences and add this URL to “Additional boards manager URLs”:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json -
Install the ESP32 package
Go to Tools → Board → Boards Manager, search for “esp32”, and install esp32 by Espressif Systems (version 2.x recommended).
-
Select the board
Tools → Board → ESP32 Arduino → ESP32 Dev Module
-
Configure upload settings
Setting Value Board ESP32 Dev Module Upload Speed 921600 Flash Frequency 80MHz Flash Size 4MB (32Mb) Partition Scheme Default 4MB with spiffs Port (your USB-serial port)
Required Libraries
Section titled “Required Libraries”Install these through Sketch → Include Library → Manage Libraries:
| Library | Purpose |
|---|---|
| ArduinoJson | JSON command parsing |
| ESP32Servo | Servo PWM control |
| SCServo | Serial bus servo protocol |
| ESPAsyncWebServer | HTTP server for web control |
| AsyncTCP | Async TCP for the web server |
| SPIFFS | Flash file system (built-in) |
Firmware Structure
Section titled “Firmware Structure”The main firmware sketch is organized around the JSON command dispatcher in json_cmd.h. Each command type (T code) maps to a handler function:
RoArm-M2_example/├── RoArm-M2_example.ino # Main sketch, setup/loop├── json_cmd.h # Command type definitions├── ctrl.h # Motion control & kinematics├── wifi_ctrl.h # WiFi AP/STA configuration├── esp_now_ctrl.h # ESP-NOW peer-to-peer├── file_ctrl.h # SPIFFS file operations└── mission_ctrl.h # Step recording & playbackFlashing Firmware
Section titled “Flashing Firmware”-
Connect the ESP32 board via USB-C
-
Select the correct port in Tools → Port
-
Hold the BOOT button on the ESP32 board, click Upload in Arduino IDE, then release BOOT when you see “Connecting…”
-
Wait for upload to complete. The serial monitor (115200 baud) will show startup messages.
Verifying the Flash
Section titled “Verifying the Flash”Open the Serial Monitor at 115200 baud. You should see boot messages and the WiFi configuration. Send a test command:
{"T":105}This requests position feedback. A working arm will respond with current joint positions and XYZ coordinates.
Alternative: PlatformIO
Section titled “Alternative: PlatformIO”If you prefer PlatformIO over Arduino IDE, create a platformio.ini:
[env:esp32dev]platform = espressif32board = esp32devframework = arduinomonitor_speed = 115200upload_speed = 921600lib_deps = bblanchon/ArduinoJson madhephaestus/ESP32Servo ESPAsyncWebServer AsyncTCPDevelopment workflow based on the Waveshare Secondary Development Tool guide. Firmware: waveshareteam/roarm_m2.