Let's Make Robots! | RobotShop

DIY 2-wheel balancing robot


The epic:


  • Build a robot-car with ‘a certain level of autonomy’.
  • Explore possible options for computer vision control.
  • Explore simple options for mapping and localization.
  • Preferably build a 2-wheeled differential robot.


In Reading Signs you’ll find a first exercise with computer vision control.

In turn this post offers a very basic approach to build a balancer and covers:


  • My experiences with different sorts of hardware components
  • A simple control logic
  • Control loop timing experiences and semi-automatic tuning


The video shows the first 3 versions of the balancing robot:


  • The basic balancer ran by an Arduino Uno and controlled by an Android app
  • Two extended versions loaded with ultrasonic sensors and controlled by a Raspberry Pi


(The appearance of the bot is constantly changing due to my experiments)

A future post will cover distance reading, obstacle avoiding and odometry experiments.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

It's fast and works great. I also like that you are looking forward to do odometry experiments and SLAM implementation. Also probably you need to adjust the differential gain as the bot keeps vibrating. Looking forward to updates!

The weird COG (lot of weight at the front) and compensation by the derivative gain, caused the violent vibration. FOr the same reason it took a long time before coming to a final rest. I changed the position and attachment of the ultrasonic sensors in the version I'm working with now. Re-tuning with just the twiddle-script gave a much better result (hardly no virbration any more).    

Looking forward to your updates here as the project proogresses.

This article is just in time. Questions:

1. In your writeup you mention that a tall machine with the weight up high is "inert". Please elaborate.
2. You placed the IMU at the bottom. Wouldn't the acceleration forces in X be maximum.

Thanks for posting!!


With a bigger mass at the top, It takes more time before the bot starts tumbling. So it ‘feels’ more stable, but once the bot is falling, it’s much harder to correct.

I'm not sure. You're probably right as the inertness is bigger at the top.  As part of my approach (work with the vertical angle) it doesn't matter as long as it's placed on the motor axis.