Skip to content
MCU Atlas

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:AdvancedSource 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/15/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.

Bill of Materials

Parts list

5 parts · 1 linked

Heads up: some Buy links are affiliate links. If you buy through one, MCU Atlas may earn a small commission at no extra cost to you. It never changes which parts we list. How this works

No verified link — check the original project
No verified link — check the original project
No verified link — check the original project
No verified link — check the original project

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

Download CSV

Learn

Docs & guides

Read these before you buy. These pages explain things; they don't sell anything.

Related Projects

3D-printed ESP32 self-balancing robot with steppers
Illustration
ESP32
A 3D-printed two-wheel balancing robot: an ESP32 reads an MPU6050 IMU and drives two stepper motors through DRV8825 drivers to keep itself upright.
Intermediate·Code
5 parts listed
ESP-Drone: Espressif's open mini quadcopter on ESP32
Illustration
ESP32ESP32-S2
ESP-Drone is Espressif's open-source mini quadcopter firmware for ESP32, ESP32-S2 and S3 boards — build the drone, connect over Wi-Fi and fly it from a phone app.
Advanced·Code
4 parts listed
Waveshare RoArm-M2: ESP32 desktop robot arm firmware
Illustration
ESP32
Open firmware for the Waveshare RoArm-M2, a 4-DOF desktop robot arm driven by an ESP32: web control, position teaching and ROS2 support.
Intermediate·Code
1 part listed