Balancing Robot

My take on a balancing robot because... why not?

Similar projects worth following
This project is a 2 wheeled balancing robot. The brains of the robot is a Sparkfun SAMD21 Mini Breakout board. The robot uses an IMU module to measure the tilt and used PID controllers to maintain balance. The robot uses geared DC motors with encoders for locomotion. The robot has a bluetooth module to allow for wireless communication with a PC or controller. The robot structure is made out of 3D printed components.

Here is a quick video:
Another video:


This is a passion project. I have always wanted to build a balancing robot. I made an attempt years ago but it never really got the attention that it needed. Plus, life has a way of steering your attention away. Now with new found motivation, 1 or 2 hours a day, and a 3D printer, I have decided to give it another go. 

Currently the main goal of the robot is for it to balance on it's own and to be controllable via a bluetooth controller. The robot itself uses similar components found on the many balancing robots scattered across the internet. An arduino platform for the brains, an IMU module to sense the robots tilt, motor drivers and motor. A list of all components used on this robot can be found in the Components section, but I will use this Project Details section to show and explain some of the components and design decisions.


The brains of the robot is a Sparkfun SAMD21 Mini Breakout board.

This module is compatible with the Arduino IDE, has a relatively small footprint and has a higher performance microcontroller compared to some of the other Arduino platforms available.

Motor and Motor Driver

The motors that were selected is the 6.3:1 Metal Gearmotor 37Dx65L mm 12V with 64 CPR Encoder (Helical Pinion) from Pololu.

The specs for this motor can be found on their website so I will not repeat it here. Originally, stepper motors were chosen but I did not like the amount current needed by stepper motors and the heat that they can generate. Since the structure of the robot will be made with 3D printed parts, DC motor were selected instead. Plus the DC motors have encoders which is used by the robot.

To drive the motors, I have selected the G2 High-Power Motor Driver 18v17 from Pololu.

Again, specs are available on their website. Now these drivers are more than capable to drive the DC motors that I have selected. I could have chosen other drivers that are cheaper and lower power, but these were selected in case I wanted to recycle them for other projects that may need more power.


The Inertial Measurement Unit selected is the AltIMU-10 v5 from Pololu.

This module has gyro, accelerometer, compass and altimeter on board. For this robot, only the gyro and accelerometer are used. Again, definitely more than is needed for this robot. It is also helpful that there is an arduino library for the LSM6DS33 3-axis gyroscope and 3-axis accelerometer IC that is on this module.


For wireless communication, a generic HC-06 Bluetooth module was selected.

This module allows wireless serial communication via Bluetooth. The robot uses this to send telemetry data and receive commands to and from a PC or controller.

Voltage Regulator

The robot is powered by a 9.6v NiMH battery. Most of the components need a 5V supply, so a voltage regulator is needed. The voltage regulator selected is the 5V Step-Up/Step-Down Voltage Regulator S9V11F5 from Pololu.

This was selected for it's high efficiency and relatively high current output. An additional 33uF capacitor was added to the input of the regulator module to handle any initial voltage spikes. This is based on Pololu's recommendation for this module.

Custom Carrier Board

A custom carrier board was designed in KiCad to hold all these modules.

The carrier board contains some support circuits needed by the different modules:

  • Capacitors for the motor drivers
  • Logic level translators for the encoder inputs. The encoder signals from the DC motor is 5V and the IO on the Sparkfun SAMD21 Mini Breakout Board is not 5V tolerant.
  • Reverse voltage protection.
  • Voltage divider for the battery voltage measurement circuit.
  • Filter capacitor for voltage regulator module
  • Pull-up resistors for some motor driver signals.

Here is the carrier board with modules populated:

3D Printed Components
As mentioned earlier, the structure of the robot is made out of 3D printed parts. All 3D components are available on Thingiverse:

Read more »

  • 1 × Sparkfun SAMD21 Mini Breakout Board Microcontroller Module
  • 1 × HC-06 Bluetooth Module Bluetooth Module
  • 2 × Pololu G2 High-Power Motor Driver 18v17 Motor Driver
  • 1 × Pololu AltIMU-10 v5 IMU Module
  • 1 × Pololu S9V11F5 5V Step-Up/Step-Down Voltage Regulator

View all 38 components

  • New Video Demonstrating Position Mode

    ncabalos12/29/2020 at 16:41 0 comments

    Uploaded a new video demonstrating the robot's balance and position mode.

  • Added to Details Section

    ncabalos12/28/2020 at 21:02 0 comments

    Added the following sections to the project details section:

    • Software
      • PIDs - Information about the PID architecture implemented in the robot.
      • Motor Deadzone Calibration

  • First Entry

    ncabalos12/23/2020 at 04:06 0 comments

    This is the first project log entry since I posted this project on here. I have added to the following sections:

    • Details
    • Components
    • Instructions

    Things that still need to be done:

    • Add missing details in the Instruction section
    • Add information about the robot's firmware
    • Develop a bluetooth controller using a PS2 Dualshock contoller. This is already in progress. I am still waiting for parts to come in so I can finalize the design of. it This may go into its own project. Here is a sneak peak:
    • Explore changing the 64 count magnetic encoder to an optical encoder with higher resolution. This is also in progress as well. Here is a sneak peak:

View all 3 project logs

  • 1
    Download and print 3D components

    All 3D printed parts are available on Thingiverse:

  • 2
    Install heat-set inserts into 3D printed components

    Install the 94180A333 Brass heat-set inserts into the following:

    • Wheel Base: 8
    • Deck Riser: 4
    • Battery Deck: 8
    • Handle Brackets: 1 in each
  • 3
    Install the motors and Fenders

    Insert one of the motors into the Wheel Base. Align the motor with the mounting holes.

    Make sure the motor wires are fed through the rectangular hole in the Wheel Base.

    With one of the Fenders, align the mounting holes to the motor mounting holes on the Wheel Base.

    Attach the Fender and motor to the Wheel Base with 4 M3x12mm screws.

    Repeat for the other side.

View all 20 instructions

Enjoy this project?


Discussions wrote 12/28/2020 at 09:34 point

I really like this robot. We did the opposite: we tested DC motors but the lack of precision made us choose stepper motors instead (regular NEMA17 in this case). The current drained is controlled via the A4988. This is the stepper motor self-balancing robot: (And assembly guide if anyone interested:

  Are you sure? yes | no

Mike Szczys wrote 12/21/2020 at 23:29 point

Looks great! Usually these are kind of strapped together and look like one good fall will break the electronics, but you've not only enclosed everything, but made it look quite nice (the lighted button is a nice touch!). Snappy response when you push it out of balance... looks like those PID loops are tuned just right.

  Are you sure? yes | no

ncabalos wrote 12/22/2020 at 02:49 point

Thank you for your kind words!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates