Skip to content
MCU Atlas
ARDUINOSTM32ESP32UNOSTM32F4ESP32

SimpleFOC Arduino balancer: BLDC two-wheel balancing robot

A modular two-wheel balancing robot using gimbal BLDC motors and the SimpleFOC library on Arduino-class boards.

Difficulty:AdvancedCost:Source available

Photos

SimpleFOC Arduino balancer: BLDC two-wheel balancing robot photo 1
SimpleFOC Arduino balancer: BLDC two-wheel balancing robot photo 2
SimpleFOC Arduino balancer: BLDC two-wheel balancing robot photo 3
SimpleFOC Arduino balancer: BLDC two-wheel balancing robot photo 4

Photos: simplefoc/Arduino-FOC-balancer

Key Facts

  • Motors: gimbal BLDCs
  • Control: SimpleFOC FOC library
  • Sensors: magnetic encoders + IMU
  • MCU: Arduino-compatible (often STM32/ESP32)

About This Project

This SimpleFOC project builds a balancing robot around gimbal BLDC motors instead of brushed DC or steppers, which gives smoother and more dynamic control. Position is sensed with magnetic encoders, an IMU provides tilt, and the SimpleFOC library runs field-oriented control on an Arduino-compatible MCU (often STM32 or ESP32 in practice). Mechanical parts are 3D printed and the design is modular so you can swap motors, drivers and boards.

Source & Attribution

Source: GitHub
License: MIT
Last verified: 10/16/2026
SimpleFOC Arduino balancer: BLDC two-wheel balancing robot
How to Build It
A modular two-wheel balancing robot driven by gimbal BLDC motors through the SimpleFOC library. Field-oriented control gives smooth, quiet torque, and the frame is 3D-printed and designed to be easy to adapt to other motors, drivers and sensors.

Parts Needed

  • Arduino-compatible MCU (Uno, Nucleo/STM32 or ESP32)
  • 2x gimbal BLDC motors
  • 2x BLDC drivers (the author used SimpleFOCShield v2.0.3)
  • 2x magnetic encoders (e.g. AS5600/AS5048) or another SimpleFOC-supported sensor
  • IMU (MPU6050)
  • 3D-printed parts (STEP/Solidworks in CAD folder), RC car tyres, screws
  • 3S LiPo or 12V supply
  • Optional: HC-05 Bluetooth for remote control

Steps

  1. 1

    Print and build the frame

    Print the parts from the CAD folder and assemble them with the motors, wheels and tyres. Mount the encoder magnets on the motor shafts.

  2. 2

    Wire the electronics

    Stack the two SimpleFOC shields on the MCU (with different pin configurations), then connect the motor phases, encoders and the I2C IMU.

  3. 3

    Install libraries

    In the Arduino IDE, install Simple FOC and the IMU library the sketch uses.

  4. 4

    Tune each motor first

    Run the SimpleFOC example sketches to check each motor and sensor pair works in velocity mode before you try balancing.

  5. 5

    Flash the balancer

    Upload the balancer sketch. Adjust the stabilisation PID and velocity controller gains until it holds upright, then add Bluetooth remote control if you like.

Parts List (BOM)
Partial parts list
partial
PartQtyRoleEst. PriceBuy
Arduino-compatible MCU (Uno / STM32 / ESP32)
1controller——
2motors$15–$35View
2drivers$5–$15View
2encoders$2–$5View
1IMU$2–$5View
Estimated Total$46–$115 USD

Not included: 3D-printed case, wire, solder, USB cable

Download CSV

Related Projects

Watchy: open-source ESP32 e-ink smartwatch
Illustration
ESP32
An open-source smartwatch with a 1.54in e-paper screen and ESP32, hackable watch faces in Arduino.
Beginner·Under $15·Code
2 parts listed
Low-power ESP32 e-paper weather display (7.5in)
Illustration
ESP32
A wall-mounted 7.5in e-paper weather display on an ESP32 that runs for months on one battery charge.
Intermediate·Cost varies·Code
5 parts listed
OpenEPaperLink: reuse e-ink shelf labels with an ESP32 access point
Illustration
ESP32ESP32-S3
Turns cheap second-hand electronic shelf labels into a Wi-Fi-managed e-ink display fleet via an ESP32 access point.
Advanced·Under $15·Code
3 parts listed