A friend and I decided to build a two-wheeled balancing robot similar to the Segway transport vehicle for our Electrical Engineering senior design project. A professor mentioned an inverted pendulum would be a very impressive senior design project. Years previously, a student of his did his master’s thesis on the inverted pendulum problem and built an impressive robot using analog circuitry–we thought it would be fun to build the modern equivalent. We obviously drew inspiration from the Segway transporter and other robotic inverted pendulums that had been appearing with the arrival of inexpensive MEMS gyroscopes and accelerometers.
A two-wheeled inverted pendulum is somewhat more challenging to stabilize than a four-wheeled moving platform with an inverted pendulum and seems to typically require the use of wheel encoders. One of my primary goals was to make the robot as inexpensively as possible and forgo the use of encoders. I used two accelerometers at right angles to each other (in-fact there are three inside a small MEMS chip) and basic trigonometry to sense the robot’s angle to vertical. This angle will have error any time the robot is accelerating–I compensate for this by using a angular rate gyro. The rate gyro cannot be used alone because it is subject to drift and would require manual calibration, but combined, the two sensors work great.
Jude Collins hacked a Nintendo 64 controller with a bluetooth transmitter to control the robot. Previous to this the robot was ridiculously boring as it just stood there. It turns out if an inverted pendulum stands doing absolutely nothing it is totally unimpressive. Here is the earliest video with remote-control.
Another design-goal was the ability for the robot to stand itself up. Previously to this we had not seen this done and a lot of robots seem to require to be placed in the upright position to calibrate–ours self calibrates in any position.
The robot has been crashed plenty of times and somehow has not been significantly damaged. In part to see how well the robot balances itself in free-fall we staged a mini robot high dive:
Driving this inverted pendulum can take a little practice. Braking has to be done by leaning backwards. This means when the robot is moving forwards the wheels have to speed up enough to cause the robot to lean backwards and then slow down. This is all done automatically of course but seems a little tricky for new drivers. I suspect the addition of wheel encoders could make this easier, but after 5-10 minutes driving becomes almost second-nature. Turning is very sensitive/easy and can be skillfully used to do some impressive drifting.
How did the robot balance? Did it use the conservation of momentum of the rotating motors to counter-act the rotation forward of your lever arm?
The conservation of momentum partially balances the robot. Additionally, the lateral acceleration of the bottom of the robot caused by the motors and wheels keeps it balanced. In a traditional inverted pendulum where the base is a fixed (often four-wheeled platform) the conservation of rotational momentum plays no part, but with two-wheeled robots where the entire platform is allowed to move, it plays a significant role. This conservation of rotational momentum allows the robot to be somewhat self-stabilizing even when its wheels are off the ground.