nBot Balancing Robot
David P. Anderson
nBot: 27 January 2003
Update: 14 Sept 2013:
nBot Rev 6.0.
rebuilt as Version 6.0
disastrous LiPo Fire of 2012.
Update: 14 June 2012: nBot finally has
some avoidance and navigation sensors, two PING))) ultrasonic sonar sensors, and five SHARP IR distance detectors, in addition to the MicroStrain FAS-G IMU.
Here is a video of
nBot doing perimeter following (72M mpeg) in the basement of the building where I work.
I've been working on a two-wheeled balancing robot,
This robot was featured as NASA's
Cool Robot of the Week for 19 May 2003.
Thereafter Scientific American's online website,
SCI/Tech Web Awards, honored the NASA page as one of the top 10 engineering and technical web sites for 2003,
referencing nBot in its text. nBot is also featured in a new O'Reilly book spun off from Make Magazine in 2006,
The basic idea for a two-wheeled dynamically balancing robot is
pretty simple: drive the wheels in the direction that the
upper part of the robot is falling. If the wheels can be driven in such a way as to
stay under the robot's center of gravity, the robot remains balanced. In practice
this requires two feedback sensors: a tilt or angle sensor to measure the
tilt of the robot with respect to gravity, and wheel encoders to measure the position
of the base of the robot. Four terms are sufficient to define the motion and
position of this "inverted pendulum" and thereby balance the robot. These are 1) the
tilt angle and 2) its first
derivative, the angle velocity, and 3) the platform position and 4) its first derivative,
the platform velocity. These four measurements are summed and fed back to the
platform as a motor voltage, which is
proportional to torque, to balance and drive the robot.
Here is a diagram
of the algoithm with some code and implementation notes.
The robot hardware was built in my home machine shop. Here as some
views of the motor platform and drive components, as well as the
castering tailwheel, now removed, which was used for testing
and calibrating the motors and encoders before nBot was able to balance on two wheels.
The robot uses the
HC11 robot controller developed for the
M.I.T. 6.270 Robotics Course, the
same robot controller
used on the
Rev 1. This began as an experiment to learn to control an inverted pendulum.
I began with a three wheeled robot
with a ball-bearing pivot used to
attach a 3 foot wooden pole topped with an orange Nerf Ball. The pivot has a low-friction 5k potentiometer
used for measuring the tilt angle of the pole. I moved the
battery pack over the rear wheel to give
more stability. Here is an mpeg movie (10 Meg)
of the robot balancing the pole in my office.
Here (3.3 Meg) is a shorter version, and
here (3.7) is another.
Rev 2. After learning to balance the pole, the robot was re-built as a
two-wheel version, with the
battery mounted directly above the wheels. The ball-bearing pivot was attached to the
bottom of the robot with
a short aluminium feeler touching the floor. In this way the robot can sense it's angle to the
floor and, assuming the floor is level, to gravity as well. The aluminium feeler has a teflon pad
on the end to help it ride over cracks and joints in the floor.
For the third version a third deck was added and the batteries moved to the
top deck. This allows
the robot to generate more torque without having to tilt over as far.
The side view of the
platform shows the battery and user interface on the top deck, the microcontroller and
h-bridge on the middle deck, and the motors and axles on the lowest deck.
The ball-bearing pivot and angle sensor were replaced by a piezo-electric gyroscope and
ADXL202 accelerometer mounted just above the motor deck. Those sensors were eventually
replaced by a commerical inclinometer, the
FAS-G from MicroStrain, also consisting
of an ADXL202 accelerometer and a rate gyro, similar to the boards and kits available from
rear view shows the
New base and motors for nBot, using the
Pittman GM8712 DC gearhead motors with home-brew shaft encoders. These are
powered by 18 NiMH 1800 mAh rechargeable AA cells, at about 24 volts. They have a lot
more torque at very low rpm than the previous 12 volt motors, as well as higher maximum
rpm. The result is that the robot is more stable and can respond more quickly.
Additional detail pictures of the Rev4 modifications are
The gyroscope and accelerometer are combined with
to provide an inertial reference sensor. The ADXL202 accelerometer provides accurate static
tilt information, when the robot is not accelerating. The gyroscope can be integrated to
provide accurate dynamic tilt information, but the integration tends to
drift over time.
Combining the two sensors provides a robust inertial measurement. The
FAS-G IMU implements
a "Weiner" filter to combine the two sensors into a single measurement. The
sourceforge autopilot project. and the boards available from
rotomotion.com use a "Kalman" filter. Some really good information on
inertial measurement units is available from the
sourceforge autopilot project.
Here is a video
of the robot balancing.
It shows nBot being shoved
and regaining its balance, and being pushed off center and resisting.
If a constant offset voltage is added to one wheel and subtracted from the other wheel,
the robot balance is not altered.
In this way the robot can be steered while maintaining its balance.
Here is a video
of the robot spinning in place while balancing.
I'm using a knob on the robot to add a voltage offset to
one motor and subtract it from the other.
If a small offset is added to the tilt angle the robot must remain in motion to stay balanced.
This combined with a voltage offset added to one wheel and subtracted from the other will cause
the robot to drive in a circle.
This dark mpeg (2.9 Meg) shows the robot circling smoothly on a tile floor,
until it runs into my foot. Because of the PWM wheel offsets, it pivots away from the collsion
and continues; sort of a built in "bumper" behavior without an actual physical bumper. (It's
really too dark to see what's going on. I'll try to make a better one soon.)
Here's a better video
of the robot circling smoothly and bouncing off my leg, the walls and
nbot on gravel (1.3 Meg) shows the robot circling on a gravel driverway.
You can see the platform rock fore and aft as it tries to get enough torque to climb over rocks and maintain
its balance on the uneven surface.
other robots (except the
camera car), this is an autonomous robot. That is, it is not radio
controlled by a human and there is no R/C link. Instead it has an onboard computer
(MIT 6.270) that makes all of
its behavior decisions, in addition to balancing the robot.
In the following mpeg videos,
the robot is running a simple navigation
program that uses wheel odometry
to go forward 24 feet (or some arbitrary distance) and turn around and come back, looping endlessly.
Here is a video
of the robot running that program in a parking lot.
Most of the following videos are of the robot running this odometry program in different environments,
indoors and outdoors, etc.
Here is a video
of the robot running the same program
on an inclined driveway. Note the "pirouette" required to keep its balance while turning around
on the incline. The cicadas singing in nearby trees provide the soundtrack for a hot Texas
For outdoors perfomance in general, the robot's balance seems to be unaffected by uneven and irregular
surfaces, as this
outdoor mpeg (2.7 Meg)
is the Rev4 robot running
on uneven and rocky ground at Ilse DuBois State Park:
I think the two-wheel balancing robot will turn out to be more stable than my other three-wheeled robots.
Here is an mpeg movie
(3.3 Meg) of the balancing robot going up and down a loading ramp. Notice how it leans
backward as it goes down the ramp, and forward is it goes back up.
Notice also that it takes several trys to overcome the bump at the start
of the ramp. The robot initially bounces away, leaning further forward to get enough
torque to climb over the bump and start up the ramp.
At the top of the ramp the robot
touches the left wall. At this stage in development it has no sensors to detect collisions.
The balance algorithm bounces it along the wall until it is finally free at the corner. In
its final version it will have sensors and behaviors to avoid running into things, but note
that the robot does not lose its balance and fall over when it does collide.
Here is a video (5.2 Meg) that shows what happens when you try to run down-hill too fast without
wearing your helmet. In order to slow down the robot must first speed up, to get the wheels
underneath and eventually out ahead of the center of gravity. If the robot is going too fast, it
is unable to speed up, and hence unable to slow down. Also includes some successful attempts.
So I started the robot at the bottom of the ramp further away from the wall, hoping that
the odometery errors would be small enough that the 'bot could made several runs up and
down. Instead, it climbed the ramp smoothly and then
fell off the side (2.8 Meg mpeg)
coming back down. Ouch! Time to think about installing those sensors...
Update Rev 4: The two-wheel robot is indeed able to handle much more agressive slopes than my other robots.
(3.6 Mb mpeg) ,
(800K .wmv) ,
(400K .rm) ,
is the Rev 4 robot descending a very steep uneven grassy slope on
the campus of UNT. Note the bounce and recovery as it hits the concrete at the bottom.
Here (3.2 Mb mpeg) is another, with a more graceful dismount.
This one (2.7 Mb mpeg) got going too fast and took a tumble.
nBot's first step. I think it's possible that the two-wheel balancing robot may eventually
be able to descend stairs, even if it can never go up them.
Here (1.5 Meg) is nBot successfully negotiating a step. One
small step for a robot, one giant leap...
Here (1.6 Meg) is another attempt.
Here is an mpeg (5.3 M) of the robot obliquely descending a set of
canted stairs. Leaning left and right does not affect the robot's balance, unless the tilt angle is great
enough for the center of gravity to be outside of the base. Watch that last step!
Here is a video
of the robot set to go in a straight line
cross country, traversing the campus of UNT and more-or-less following a footpath.
This mpeg (5.3 M) is of the robot doing a 24 foot looping
pattern in a sloping couryard over a drain and some broken concrete.
Rocky Mountains: Here is video
of the robot navigating down a steep 4wheel drive access road in Ptarmigan Meadows in the
Colorado Rocky Mountains.
Here is another video
of the same descent from another angle which may give a better sense of the steepness of the slope.
Limit of the Envelope!.
Here is a video
of the robot attempting to
to descend a gravel road that is too steep/rough for it to handle. That's my mother in the background
talking encouragingly to the robot like she does to all small creatures.
nBot in Seattle
A tour of the Seattle Fairgrounds with nBot during the Seattle Robotics Society Robothon 2003.
Other two-wheel inverted pendulum balancing robots:
Joe le pendule, a radio-controlled 2 wheel robot that seems to work very well. Included are
some cool mpeg movies and documentation. They have a
pdf document in English which describes their project. They seem to be getting
all their sensor data from only 2 wheel encoders and a rate gyro.
Here is a local copy I've downloaded.
Steve Hassenplug has built a two-wheeled balancing robot from Legos he calls
LegWay that uses
IR proximity detectors to balance and also do line following. Pretty cool.
Ted Larson is working on a two-wheel balancer with Bob Allen. The web page includes some
videos of their robot in action (always the best!) as well as a link to their recent appearance
Bram Stolk is working on
a two-wheel robot using the
BaliBot is a two-wheel inverted pendulum robot built by Bill and Mark Sherman.
Matt Cross is working on a
two-wheeled firefighting robot for the
Trinty College Firefighting Contest. Matt uses the 68332 Mini Robo Minds controller board
running the RTEMS realtime multitasking operating system.
Larry Barello of the Seattle Robotics Society has done some excellent work on
GyroBot, a gyroscopically
Duane Gustavus is working on a balancing robot with the weight distribuition arranged so
that it can drive on three wheels or tip forward and balance on two. Very cool. Duane uses the
MRM board running RTEMS
Dan Piponi has a clever balancing robot
that uses a Sharp infrared sensor to measure
the distance to the floor and uses that information to deduce tilt angle.
Juan Pablo Angulo has developed a similar balancing robot using IR to measure
floor angle. There is a nice writeup of his work on the
Ron Grant of the
Dallas Personal Robotics Group
is working on a nifty balancing robot. He is currently using a "floor feeler" to determine tilt angle,
a potentiometer driven by a lever and ping pong ball that rests on the floor. Ron uses a home-brew
CPU board with an ATMEL controller and on-board H-bridge. [Ron, where did your site go?]
Jack Wu and Jim Bal at Carnegie Mellon University have constructed
BBot as a semester design project for the Fall of 2003,
"a self-balancing two-wheeled robot." Based on their 68 Meg mpeg video, it doesn't appear to actually
be balancing yet... (Note: link no longer working as of 07 July 04. I guess school's out)
Lee Magnusson at MIT is working on a
self-balancing unicycle. His page has links to some videos and a pdf report. From the videos
it looks like the human rider still has to do the side-to-side balancing. Cool nonetheless!
(This link also not working as of 07 July 04. The college sites must go down at the end of the semester.)
The Technology Department of the Bolton School in Manchester, England, has built this nifty single
wheel cycling robot which they call the
Loony-Cycle. I believe this design has to
stay in motion in order to maintain balance. It is steered with propellers that are arranged at 90 degrees
to the direction of travel.
Jormungand.net has a very nice two-wheel balancing robot design called
crunch along with a
few other robot projects.
Francisco Lobo de la Garza has an on-going development project for a two-wheel balancing robot
Spider. Web page includes photos, video, and some
Roderick Lee Mann is working on
ichibot, a two wheel balancer inspired,
I believe, by the nBot project. Way to go Roderick!
Sanghyuk Park, a recent graduate of M.I.T., has a fascinating group of robot control/navigation/guidance
projects including a two-wheel balancing robot named
Balance-bot I. Sanghyuk writes that he was
"deeply impressed" with the nBot website, which pleases me greatly! Be sure and check out his
unmanned air vehicles projects as well. Very intriquing.
[But, as of 04 Feb 2005, Mr. Park and all his nifty robots seemed to have vanished from the Internet.]
Four members of the The University of West Florida's Institute for Human and Machine Cognition have
built a self-described Joe le Pendule look-alike as a testing platform for autonomous agent software.
Real-time Linux and wireless ehternet! Some video and lots of links.
Their robot and a several others (including nBot) have been gathered together as
Joe's Relatives on the
Joe le Pendule website.
Joris Maervoet and friends have built a
Balancing LEGO Robot using Java and standard LEGO parts, including the LEGO light sensor,
that can balance while
standing on a mirror. Very nice web page: graphics, charts, graphs, and code.
Alistair Sutherland and Thomas Bräunl are working on a couple of two wheel balancing robots they call
based around the excellent
eyebot robot controller.
Edwin Dertien has among his many other robots a design for a
LEGO two-wheel balancer using a home-brew light sensor.
Blind Man is a fuzzy logic-based two wheel balancer that appears to be a class project of the
University of Alberta. The robot uses a floor feeler to sense it's angle, like a blind man's cane,
hence the name.
uBot from UMASS, Amherst, by Patrick Deegan and Robert Grupen, appears to be
an R/C controlled 2-wheel balancing platform using a
Rotomotion IMU and custom software. Nice site with descriptions and mpeg videos. Check out uBot standing up on its own from leaning on its kick stand in the 3rd movie.
Update: 03 March 2007: Patrick sends a new web page with more work completed on
several new two-wheel balancers including some with grippers and manipulators. Includes videos of various
lifting and pushing tasks while balancing.
Ballbot from the Microdynamic Systems Laboratory at Carnegie Mellon University balances on a single wheel, actually a ball.
Press release includes links to videos of the robot recovering from a disturbance and navigating across a room.
BBot, a balancing robot by Brody Radford, uses ADXL202 accelerometers and ENC-03J gyroscopes from Murata to create a nice
platform, inspired by nBot and Joe le Pendule. Nice work.
Nuts_and_volts Magazine for November and December 2006 have a two-part
Personal Robotics article
by Phil Davis and Brandon Heller, titled "Building a Balancing Bot on a Budget."
Their design is based around a
SparkFun 5DOF IMU and modified R/C servos, and the article includes a link
to their Kalman filter
and balancing code on the Nuts_and_Volts ftp server.
Brian Kuschak has a very nicely implemented
home-brew balancing robot based around an ARM7 processor and custom inertial measurement sensor.
Lots of good information and details, very nice webpage.
Dirk Uffmann from Munich, Germany, has developed a two-wheel balancing robot based on fischertechnik components, named ARTIST, with home-brew electonics and tilt sensor. Nice web-page with lots of links and videos.
Frits van Evert and colleagues at the
Wageningen University and Research Center in the Netherlands
have built a two-wheel balancing "field robot" to compete in the
field robot competition in June of 2007. Their web site has photos and videos of
the robot in action navigating autonomously through rows of corn, and they have sent
along a very nice note thanking nbot for "inspiration and lots of practical information."
Kazuo Yamafuji, Professor Emeritus at the University of Electro-Communications in Tokyo, built the first
two-wheel inverted pendulum robot
in 1986, according to this article in the
Here are some related links:
The source forge autopilot group
is working on
a home-brew three axis inertial measurement unit for an autonomous helicopter. They have
a single axis version suitable for a two-wheel balancing robot.
Carnegie Mellon University has some
online documentation and matlab code for balancing an inverted pendulum.
Some researchers at the
Max Planck Institute
in Germany can balance three inverted pendulums, one on top of another. Amazing!
Fuzzy logic tutorials seem to like inverted pendulum problems.
Here's one for a two stage
inverted pendulum and the fuzzy code used to solve it.
Here is an appnote (pdf) from Microchip on
using a pic chip to balance an inverted pendulum.
Segway Human Transport Vehicle
patent application describes the algorithm he is using for a
pendulum type of platform.
Trevor Blackwell has built a
home-brew balancing scooter out of the Rotomotion single axis IMU and
other off-the-shelf-parts. Nice webpage with pictures and videos. He has also built an very nice
unicycle version of the inverted pendulum.
UBC Electric Bike Club have designed and built a very cool senior project,
a two-wheel balancing skateboard using
sonar and IR sensors to measure angle. Website includes text, illustrations, photos, and videos of
the platform in action.
This company has a nice
on building a two wheel balancing robot like Steve's "Legway" using LEGO parts and
a couple of photo reflector sensors for measuring the angle to the floor.
These people from a company called "Balbots" offer a kit for a photo-reflective type balancer. Looks pretty nifty, lots of good documentation and a nice design.
Ted Larson has also developed some nice balancing robot components listed on his
CTG robotics website. I don't see any prices listed yet.
He show a very nice looking 3-axis inertial measurement unit, somewhat like the ones offered by
Stumpy is an inverted pendulum walker, or more accurately an inverted pendulum hopper.
was a two-person
single wheel vehicle that could cruise at speeds of 30 mph. Ok, it's not really the
same thing as a two-wheel dynamic balancer, but it's a very cool picture! I especially
like the 1930's geek driver, complete with suit and tie.
nBot and a friend hanging out together in the hallway of the SMU Heroy Building.
nBot tries to convince the Segway to go for a spin without its clumsy human occupant (2M mpeg).
Back to my robots homepage.
last update: 14 Sep 2013 dpa
SMU (c) 1993-2013 David P. Anderson
This work is licenced under a
Creative Commons License.