BalanceBot
Fall 2008
For my senior design project at Cal, I chose to build a miniature segway, which I have nicknamed BalanceBot. The inverted pendulum concept had always interested me, and I had finally taken enough controls classes to understand the theory behind the system. If you’re in a hurry, just watch or download the video below. If you want to read more into how I built the hardware and designed the control algorithm, continue further below. I have also included some pictures to show the hardware in detail.
The BalanceBot uses a relatively simple control structure. The block diagram is below. As you can see, there are two control loops running, each of which uses a PID. The lower control loop holds a desired theta, keeping the BalanceBot vertical. The upper control loops monitors the horizontal velocity of the Bot by looking at the wheel encoder signals and modifying the desired angle to maintain the desired velocity. As of right now, my desired velocity is set to zero. But the control structure will lend itself well to allowing velocity control of the Bot (RC anyone). In reality, the PID controllers are only PD controllers. I didn't know if I would need I control, so I implemented it in software and then set the coefficient to 0 upon realizing my system worked well without it.
Estimating the tilt angle of the Bot is not a simple task. Accelerometers give accurate estimates over the long run, but give a compromised signal over the short run due to the dynamic accelerations of the system. Gyroscopes give great angle estimates, but due to the nature of the signal (must be integrated to obtain theta), they are extremely susceptible to drift. Neither sensor can give a good estimate of the tilt angle, but a combination of the the two can yield a clean accurate signal at all times. Normally, a Kalman filter is used in this situation. However, being that I am not terribly familiar with Kalman filters, I chose to use the simpler combination filter. This filter simply multiplies each signal by a constant and adds the two products together. This filter works surprisingly well for it’s low computational cost and ease of implementation.
The best part about this project is that it can now be used as a platform for any of my other projects in the waiting. In the future, I might add an RC receiver to the Bot and interface the microprocessor with the PWM outputs of the receiver. Then I’ll have my very own remote control segway! After that, I could attach a sonar sensor and light detector and perhaps make my BalanceBot drive around autonomously searching out well lit areas. The possibilities are endless...