Skip to main content

Results appear automatically as you type.

DIY Forum
Report

A PPO-Trained Balance Bot Runs Its Policy on an ESP32

Reading lead

Shawn Hymel’s guide in Make: Volume 99 describes training a two-wheeled balancing robot with reinforcement learning rather than a classical control loop. It uses PPO in Google Colab with MuJoCo, eight parallel environments and 500,000 timesteps per environment, progressing from basic balancing to randomized sensor, motor and physical conditions. The trained actor is exported as ONNX and a C header, then placed in an Arduino sketch for an M5Stack Bala2-Fire kit. Its ESP32 runs inference in a stated 5 ms control loop and maps two network outputs to motor PWM; the critic is not deployed. These are article-reported setup details, not independently verified performance results.

Article body

Image credit: Adafruit Blog

Shawn Hymel wrote a guide in Make: Volume 99 on training a two-wheeled balance bot with reinforcement learning instead of a classical control loop. The agent is trained with proximal policy optimization, or PPO, the algorithm OpenAI published in 2017 that is still used for robot control and for fine-tuning large language models.

Training was in Google Colab using MuJoCo as the physics simulator, no local install is needed. Eight parallel environments run 500,000 timesteps each. The actor and critic are separate networks with two hidden layers of 32 nodes. Training runs in three phases of curriculum learning: balance first, then domain randomization for sensor noise, action delay and motor torque, then randomized nudges, part masses and wheel friction.

The finished policy is exported as an ONNX file and as an actor.h C header. Hymel drops that header into an Arduino sketch for the M5Stack Bala2-Fire kit, where the ESP32 runs inference directly in a 5ms control loop and scales the network’s two outputs to PWM values for the motors. Only the actor is deployed. The critic is left behind after training.

See the video below and more at makezine.com and content on GitHub.

video · makezine.com · GitHub

Source: Anne Barela ·Adafruit Blog · 2026-10-28T16:13:21.000Z · Read the original article

Why read this

The guide gives a concrete simulation-to-hardware workflow for robot control, including deployment on an ESP32. No independent test results are supplied.

AI score 61 · View scoring rationale

Two-model scores assess source reading value, not factual accuracy. Check this editorial article against the original.

  1. gpt-6-luna-2026-09-22 · 65

    The guide gives a concrete simulation-to-hardware workflow for robot control, including deployment on an ESP32. No independent test results are supplied.

  2. deepseek-flash · 58

    Describes a concrete RL-to-hardware pipeline: PPO training in MuJoCo with curriculum and domain randomization, ONNX and header export, and ESP32 inference in a 5ms loop on an M5Stack kit. Useful method, but no independent performance evidence.

Analyzed: 2026.10.28 17:22 UTC

Arranged / reviewed on Zoowai · 2026.10.28 17:30

Reviewed and arranged by Zoowai editors. Original content and views belong to the source author.

0

Comments & answers 0

Sign in, rate or reply

VISA Mastercard Maestro JCB American Express Diners Club Discover