HOME
Balancer Machine

[balancerDual.JPG]

INTRODUCTION
This purpose of the Balancing Machine was to not fall down. It was also a fun way to learn about motor control electronics, computer interfacing, and controlling unstable physical systems.   

Balancing is something that animals usually do, but machines usually do not; and that's why a machine like this is fascinating.  In operation, this machine seems almost alive, constantly adjusting its wheels to stay stable.  It can stay up reliably, even if pushed, and can make forward / backward motions (as far as the tether allows).  The tether, which provides connections to the PC "brain", is normally limp and does not help the machine stand.     


PHYSICAL DESCRIPTION
[Balancer Bottom.JPG (left, text to right and bottom)]
The balancing machine is tall and top heavy for a good reason: the taller the center of gravity, the slower it will tip over (that's why it's easy to balance a rake on a finger but almost impossible to do it with a pencil). The main structural elements are bolted machined aluminum, and an aluminum pipe is the backbone.  A cordless drill was used as the powerplant (good, available gearmotor).  A timing belt and 2 matching pulleys form the transmission, and an optical encoder hooked to the drill axis keeps track of wheel rotation very accurately.  The solid metal wheels have o-ring tires, and are on a common ball bearing supported shaft (thus the machine can't turn).  Up top is a platform with the electronics and a battery.  The tether consists of a light cable for fall protection and a bundle of electrical wires which hook the machine up to and interface box and a PC.  


CONTROL SYSTEM
[BalancerBlockDiagram.gif (diagram left, text to right and below)]
The most interesting part of the balancing machine, and its "lifeforce", is the software, which executes in a continuous loop on a remote PC.  The block diagram at left represents the software and hardware (on and off the machine) which constitute the control system.  The PC has an I/O card which recieves TILT DATA from the whisker clinometer and WHEEL X POSITION DATA from the encoder, and the user can control X position. These are the only 3 inputs to the program, and "Wheel Correction" data (POWER and DIRECTION) are the only outputs.

The block diagram can be more easily unstood if we first think about "Desired Tilt".  If you want to stay put, Desired Tilt is zero. If you want to accelerate forward, you first need to tilt forward - your Desired Tilt is, say, +10 degrees. Driving the wheels a few inches backward achieves this forward tilt.  Or, if moving forward and you want to stop, you'll need to lean back (run the wheels a little too fast for a bit).  Walking humans routinely trigger such "partial falls" to initiate movements. We just don't think about it.

So, the machine desires a certain tilt, and knows its ACTUAL tilt from a sensor. The difference between these 2 values is the "Tilt Error", and this is what determines what the wheels do. If tipping too far forward - move wheels forward; if tipping too far backward - move wheels backward. 

In the jargon of control systems, the Tilt Error is the [bold]controled variable, and the "Wheel Correction" power is the [bold]manipulated variable.  The purpose of the Tilt PID Servoloop software block is to minimize the Tilt Error. PID stands for Proportional Integral Differential.

One could just apply wheel power in proportion to the tilt error, but this would result in overshoot and instability.  In practice, it is crucial to act not only on the Tilt Error, but on the ERROR RATE too - If we are rapidly closing-in on desired tilt, back off the power, if getting worse apply more power - this is the "differential" part of PID.  The "integral" part helps correct for small, longstanding errors - not so important in a system like this.

The software outputs  "Wheel Correction" data.  This contains direction and power components, and goes to a piece of hardware called an H-Bridge.  The H-Bridge takes the command signals and converts them into action - motor voltage at high currents.

If, say, we want the machine to move forward at 5 feet per second, things get slightly more complex.  There is a POSITION control loop operating as well as the TILT control loop discussed above.  The input at any given time is a Desired X Position.  Actual "Position" is a tricky concept in a dynamically stable system like this - as the machine jockeys to stay up, its wheels move quite a bit, but center of gravity position is pretty stable...  We need to take tilt into account as well as wheel position (which is known by a sensor) to calculate our "X Position" in the Geometry Calculation block.  Position Error here is the controlled variable, which generates a desired tilt manipulated variable.  In plain english, if we are falling behind we need to be tilting forward more. 

The 2 control loops operate seamlessly together.

PROJECT HISTORY
This machine operated successfully in 1995 with external PC as brain, using a potentiometer tilt sensor.  For various reasons, the next phases of the project were not attempted.  These were:  on-board microcontroller brain (eliminating the tether), inertial sensor (allowing operation on tilted surfaces), and independent wheel control (allowing turning).  These are major challenges, and all have been overcome by the smart and well-financed people at the Segway Company, resulting in a balancing machine you can ride.
[segway.JPG]    
Balancing Machine. 1995.
Design, Software, Construction, Carl Pisaturo
Aluminum, steel, DC motor, sensors, custom electronics.  Height 43".
The balancing machine is tall and top heavy for a good reason: the taller the center of gravity, the slower it will tip over (that's why it's easy to balance a rake on a finger but almost impossible to do it with a pencil). The main structural elements are bolted machined aluminum, and an aluminum pipe is the backbone.  A cordless drill was used as the powerplant (good, available gearmotor).  A timing belt and 2 matching pulleys form the transmission, and an optical encoder hooked to the drill axis keeps track of wheel rotation very accurately.  The solid metal wheels have o-ring tires, and are on a common ball bearing supported shaft (thus the machine can't turn).  Up top is a platform with the electronics and a battery.  The tether consists of a light cable for fall protection and a bundle of electrical wires which hook the machine up to and interface box and a PC.  
CONTROL SYSTEM
The most interesting part of the balancing machine, and its "lifeforce", is the software, which executes in a continuous loop on a remote PC.  The block diagram at left represents the software and hardware (on and off the machine) which constitute the control system.  The PC has an I/O card which recieves TILT DATA from the whisker clinometer and WHEEL X POSITION DATA from the encoder, and the user can control X position. These are the only 3 inputs to the program, and "Wheel Correction" data (POWER and DIRECTION) are the only outputs.

The block diagram can be more easily unstood if we first think about "Desired Tilt".  If you want to stay put, Desired Tilt is zero. If you want to accelerate forward, you first need to tilt forward - your Desired Tilt is, say, +10 degrees. Driving the wheels a few inches backward achieves this forward tilt.  Or, if moving forward and you want to stop, you'll need to lean back (run the wheels a little too fast for a bit).  Walking humans routinely trigger such "partial falls" to initiate movements. We just don't think about it.

So, the machine desires a certain tilt, and knows its ACTUAL tilt from a sensor. The difference between these 2 values is the "Tilt Error", and this is what determines what the wheels do. If tipping too far forward - move wheels forward; if tipping too far backward - move wheels backward. 

In the jargon of control systems, the Tilt Error is the controled variable, and the "Wheel Correction" power is the manipulated variable.  The purpose of the Tilt PID Servoloop software block is to minimize the Tilt Error. PID stands for Proportional Integral Differential.

One could just apply wheel power in proportion to the tilt error, but this would result in overshoot and instability.  In practice, it is crucial to act not only on the Tilt Error, but on the ERROR RATE too - If we are rapidly closing-in on desired tilt, back off the power, if getting worse apply more power - this is the "differential" part of PID.  The "integral" part helps correct for small, longstanding errors - not so important in a system like this.

The software outputs  "Wheel Correction" data.  This contains direction and power components, and goes to a piece of hardware called an H-Bridge.  The H-Bridge takes the command signals and converts them into action - motor voltage at high currents.

If, say, we want the machine to move forward at 5 feet per second, things get slightly more complex.  There is a POSITION control loop operating as well as the TILT control loop discussed above.  The input at any given time is a Desired X Position.  Actual "Position" is a tricky concept in a dynamically stable system like this - as the machine jockeys to stay up, its wheels move quite a bit, but center of gravity position is pretty stable...  We need to take tilt into account as well as wheel position (which is known by a sensor) to calculate our "X Position" in the Geometry Calculation block.  Position Error here is the controlled variable, which generates a desired tilt manipulated variable.  In plain english, if we are falling behind we need to be tilting forward more. 

The 2 control loops operate seamlessly together.



PROJECT HISTORY
This machine operated successfully in 1995 with external PC as brain, using a potentiometer tilt sensor.  For various reasons, the next phases of the project were not attempted.  These were:  on-board microcontroller brain (eliminating the tether), inertial sensor (allowing operation on tilted surfaces), and independent wheel control (allowing turning).  These are major challenges, and all were overcome by the smart and well-financed people at the Segway Company, resulting in a balancing machine you can ride: The Segway HT, introduced in 2001.
This purpose of the Balancing Machine was to not fall down. It was also an enjoyable practical education in motor control electronics, computer interfacing, and controlling unstable physical systems.   

Balancing is something we animals usually do, but machines usually do not; and that's why a machine like this is fascinating.  In operation, it seems almost alive, constantly adjusting its wheels to stay stable.  It can stay up reliably, even if pushed, and can make forward / backward motions (as far as the tether allows).  The tether, which provides connections to the PC "brain", is normally limp and does not help the machine stand.     
works of  Carlo Cesare Pisaturo