CMU Balancer Project

Overview

For Chris Atkeson's KDC class I am developing a simple, robust machine to balance on two wheels. The design goals have been easy prototyping using standard parts.

Any suggestions for a catchy name would be welcome.

A group of students in the class is building a actively counter-balanced arm for the base machine.

I have a file of notes I jotted after putting the parts together.


Electronics

The onboard microcontroller is a LPC2103 on an Olimex prototyping board. I designed a simple daughterboard (PDF schematic) to connect it to a Spark Fun 5DOF IMU, the motor encoders, and the motor amplifier. The prototyping board includes a normal 9 pin serial port used for programming the board, debugging output, and the host data interface. It also has a JTAG port which could be used with gdb for in-circuit debugging.

Software

The baseline software in C is available here. It is an I/O server which runs the sensors and motor amplifier, and communicates over the serial port with a control program running on a host computer which implements the controller.

Eventually, the balancing controllers can be implemented directly on the LPC2103. The onboard software can be compiled using the Gnu Compiler Collection (GCC) set up as an ARM7 C cross-compiler. Here are my notes on compiling gcc on a UNIX machine (tested on Linux and OS X).

The LPC2xxx chips come with a bootloader supplied by the manufacturer. NXP/Philips offers a free Windows downloader which can program a .hex file into the on-chip FLASH. An open source alternative is lpc21isp; here is a cached copy of the version 1.37 source; more recent versions might be found on the files section of the related Yahoo group.

The procedure for downloading a new image to the LPC2103 internal FLASH on the Olimex LPC-P2103 board is to move the BSL jumper to the closed position, reset the board, then run lpc21isp. When P0.14/BSL is held low at reset, the bootloader will take control and wait for the programming handshake. One jumper pulls P0.14/BSL low. The other enables automatically resetting the chip using the DTR serial port line, which is not necessary if the chip is manually reset. After lpc21isp is done, move both jumpers back to the open position and reset the board again or power cycle it, and the new code will run from FLASH.

lpc21isp needs to know the clock rate and the port to use. Here's a sample set of command switches:

lpc21isp-1.37 -control balancer.hex /dev/cu.USA19QWb13P1.1 115200 14746

Data Sheets

Here are cached copies of data sheets for the components.

Mass Properties

The most recent mass distribution as calculated by SolidWorks. The coordinate system origin in the center of the bottom face of the vertical aluminum spine. The X axis faces forward, the Y axis to the left, and the Z axis up.

This can be see in this scale sketch of the machine showing the relation between this origin and the wheel axis.

Mass properties of balancing-robot

Output  coordinate System : mass props

Mass = 2.1 kilograms

Volume = 0.00156 cubic meters

Surface area = 0.538 square meters

Center of mass: ( meters )
	X = 0.0127
	Y = -0.000318
	Z = 0.256

Principal axes of inertia and principal moments of inertia: ( kilograms * square meters )
Taken at the center of mass.
	 Ix = (-0.0421, 0.00177, 0.999)   	Px = 0.00592
	 Iy = (-0.0147, -1, 0.00115)   	Py = 0.0991
	 Iz = (0.999, -0.0147, 0.0422)   	Pz = 0.102

Moments of inertia: ( kilograms * square meters )
Taken at the center of mass and aligned with the output coordinate system.
	Lxx = 0.102	Lxy = 3.97e-005	Lxz = -0.00406
	Lyx = 3.97e-005	Lyy = 0.0991	Lyz = 0.000167
	Lzx = -0.00406	Lzy = 0.000167	Lzz = 0.00609

Moments of inertia: ( kilograms * square meters )
Taken at the output coordinate system.
	Ixx = 0.239	Ixy = 3.12e-005	Ixz = 0.00276
	Iyx = 3.12e-005	Iyy = 0.237	Iyz = -3.88e-006
	Izx = 0.00276	Izy = -3.88e-006	Izz = 0.00643


Page revision: April 19, 2007.

Garth Zeglin, Robotics Institute, Carnegie Mellon University.