Arduino SimpleFOC Balancer
A modular two-wheel self-balancing robot driven by gimbal BLDC motors and the SimpleFOC library.
- Other
- Open source
- arduino
- 3D printable
Suggested by Robotheca, created by @simplefoc (opens in a new tab), from github.com/simplefoc/Arduino-FOC-balancer (opens in a new tab). Pinned to commit ec0e896 (opens in a new tab).
- Hardware license
- MIT (opens in a new tab)
- Software license
- MIT (opens in a new tab)
- Commercial use
- Allowed
Photo and 3D model

3D preview converted from github.com/simplefoc/Arduino-FOC-balancer at ec0e896, under MIT. View the original files from GitHub (613 KB) (opens in a new tab)
What it can do
Written by Robotheca from the project's documents.
- Balances on two wheels using a cascaded pair of PID controllers driving two gimbal BLDC motors with FOC.
- Can be driven forward or backward at a user-set throttle and turned via a steering command.
- Can be switched on and off remotely.
- Commands are sent over Bluetooth from a mobile joystick app, with the app's byte protocol decoded in the sketch.
Bill of materials
This repository has no parts list Robotheca can read yet.
Build guide
The creator's steps, each with its instructions.
- 1Print the 3D printed parts (center frame, wheels, MCU mount, top plate)
- 2Acquire the hardware screws and RC car tires
- 3Assemble the mechanical structure with the BLDC motors and encoders
- 4Mount the SimpleFOC Shield and microcontroller
- 5Connect the MPU6050 IMU and Bluetooth module
- 6Upload the Arduino sketch and tune the PID controllers
The guide appears here as you scroll.
Guide by @simplefoc (README.md), under MIT.
Wiring and electronics
Notes written by Robotheca from the project's documents.
Main parts
- Two gimbal BLDC motors (iPower GM4108H-120T or similar), each driving one wheel.
- Two AMT103 encoders as position sensors, one per motor (other sensors supported by Simple FOC may be used).
- Simple FOC Shield v2.0.3 as the BLDC driver, though other supported gimbal drivers may be used.
- MPU6050 IMU with integrated DMP for measuring pitch.
- Microcontroller: ESP32-based board (e.g. WeMos D1 R32) or STM32 Nucleo-64, or a gimbal controller board with integrated MCU.
- HC-06 or HC-05 Bluetooth module when a non-ESP32 microcontroller is used.
Connections
- The Simple FOC Shield plugs directly onto the Arduino-compatible microcontroller as an Arduino shield.
- The gimbal motor driver is connected to the motors and encoders in the setup described in the documents.
- The MPU6050 IMU is connected to the microcontroller to supply pitch readings.
- The Bluetooth module, if used, is connected to the microcontroller serial port; the ESP32 needs no separate module.