Project #3 - Balancing an Inverted Pendulum

In this project, your team will complete the design and fabrication of a chassis for your robot and implement a balancing controller.

The Chassis Design

The chassis design phase considers a two wheeled, differential steering geometry for a balancing robot. The design must also accomodate future projects. In particular, it should provide space to mount four IR reflectance sensors to support odometry and space for mounting one or two Ping sensors to do wall following and (time permitting) a long distance navigation task.

Make a careful, dimensioned drawing of the proposed design. This can be a hand drawing if it is accurate geometrically. Indicate motor mounts, the location of the 12/24V LiPo battery, the 9V battery, two rocker switches for the batteries, and the Arduino/motor shield. Consider the means of mounting each component and the mass distribution.

Consider the wiring from the PWM outputs on the motor shield to the motors. Specify how power will be distributed from the Arduino to the IMU, the IR sensors, and the Ping sensors. The VCC out pin on the Arduino can source up to 200mA. Make sure that your design lives within these constraints, for example, 4mA(MPU6050) + 35mA(Ping) + 4*25mA(IR sensors) = 139mA.

Think carefully about how wires will be routed---can you configure components so that the wiring is simple and clean?

The robot will fall down. Think about how to rig a bumper that protects the robot when it falls---cushions the shock of the impact and protects the wiring---without adding mass. You may want to anticipate how you can put your robot up on blocks---wheels off the ground---so that you can do code development without your robot running away.

Balancing and Open-Loop Mobility

An example of a balancing controller using the MPU6050 is presented at 2-Wheel Self Balancing Robot by using Arduino and MPU6050. The code for the balancer is downloadable in "Step 6." There are others I recommend too, including "Balanbot" and "balance_leo_2_wheel." There are many examples---google it---but be aware many of them are not implemented according to the theory we developed (and yours should be. Still, they can be instructive.

Implement the Proportional-Derivative controller that supports balancing and executing constant radius turns---an integral feedback term may improve performance.

static int PWMout = 0;

loop:
      deltaPWM = -K*(angle - angle_ref) - B*(angle_rate);
      PWMout += deltaPWM; // integrator
      PWMout_left = PWMout + translate_velocity - turn_velocity;
      PWMout_right = PWMout + translate_velocity + turn_velocity;

The Proportional feedback gain K and the Derivative feedback gain B must be tuned to make the system responsive and stable. The parameter angle_ref is a calibration constant that you have to set appropriately for your robot in order to balance perfectly and to minimize drift (when translate_velocity = turn_velocity = 0). By selecting the right combination of translate_velocity and turn_velocity, your robot should be able to execute "open-loop" constant radius turns---from turning in place to straight line paths.

Final Report (one per team): (5 pages max)