Self Balancing Robot Algorithm?

Thread Starter


Joined Dec 29, 2010
Does anyone know the trick in programming a self balancing robot? The only thing I could find in my search is other people's self balancing robot projects.


Joined Apr 24, 2011
AFAIK Microchip has a 2 dimension self-balancing demo, 2 dimensions as it just spins in place to balance the arm vertical. I don't have a link so you'll have to search them yourself.


Joined Jan 28, 2005
One approach would be to use PID algorithm as a means of controlling the robots balance.

The most primitive mechanism I have seen used to determine the robots vertical orientation was an ultrasonic distance measuring scheme.

I would be inclined to use a tilt sensor with an analog output.

There are quite a few examples of balancing robots on youtube. You can get some ideas there.



Joined Jan 6, 2004
I recall reading an article appearing in Elektor magazine (in Spanish or maybe English language).

The whole theory behind the solution was clearly explained.

That was about two years ago IIRC.


Joined Jan 6, 2004
Now, I recall another more recent issue, also from Elektor, where there is a design that involves kind of a ruler with a small metallic ball always kept in balance. In the basics it is the same problem. It was properly explained as well.
Last edited: