So, what does it take to balance a robot on two
wheels? First, let me start by saying patience and, in
my case, time. Second, let me add attention to tiny details.
If you want a quick way, you could just add a third wheel and
life would be simple again, but, I guess that if you are
reading this, this is not your desire.
It is not a difficult thing to do; it is, however, challenging
and tricky, especially if you want to do it reliably and safely.
It will take a lot of trial and error, but, once you are up and
running, you will feel great about having made such an
accomplishment and it will keep you working toward perfection.
Also, it is a jaw dropper for friends and family. Your loved
ones will at least know you are doing something cool while
in the darkness of an
inspired late night in your
garage. Perfection is what
makes this project tricky. Once you
understand the basics — and after a
couple of ahhs, ohhs, and wows — you
will see how easy the actual balancing
act is and how alive your robot will look.
Beware — this is not a scooter or a
toy intended for commercial use; the
platform I built is big and powerful, so, if
you are trying to build something of this
scale, please use extreme caution and
think twice before switching it on. The
use of an emergency stop switch is a
must and some sort of test bed where
the wheels don’t touch the ground is
highly recommended, especially in the
first few tests and when big changes in
code are required that may compromise
the safe operation of the system.
A note for you geometry
26 SERVO 07.2004
lovers: “zero angle” does not means “zero degrees,” it
means the rest angle or the angle at which the platform is
stable (desired angle) and the wheels are located right under
the center of gravity and everything is in balance. It’s important
to remember that this is what zero means in this article.
Platform balance is achieved in the same way you
balance a broom or a stick in your palm, only, in this case, the
problem is constrained in one single axis. As a result, if the
balancing object tilts forward, your hand needs to move
forward to kick the object’s tip back; if it goes the other way,
you do the same thing in the opposite direction. The difficult
part of balancing a broom or a stick is over- or undercorrecting; the same principle applies to balancing a robot,
only the brain is an MCU or some sort of computer and the
sensors are not visual (your eyes), but an IMU (Inertial
Measuring Unit), which consists of inclinometers and other
sensors that read a dynamic behavior of the system.
Think of a balancing robot as one that keeps its wheels
under its mass weight or center of gravity. You push it one
way and the wheels will have to move in to that same
direction to keep its weight supported over the mass center.
To make the robot move forward, you just set an offset to
the zero angle that is a bit off to the desired direction and,
since it has to keep the platform on that angle to prevent
tipping it, the robot has to keep moving forward to sustain
the desired angle, not allowing the platform to tilt more.
If you were trying to balance a broom on your hand at,
say, 10° of center, you would have to constantly move
forward to keep it at that angle. Since the broom does not
have a counterweight to keep it from