A self-balancing two-wheel robot is an inverted pendulum on wheels, which means its center of mass is above its wheel axle and it naturally wants to tip over. It stays upright by constantly measuring its tilt and moving its wheels underneath its body. This idea matters because the same control principles appear in scooters, humanoid robots, camera stabilizers, and autonomous machines.
The robot is a clear example of how sensors, programming, and physics work together in real time.
An inertial measurement unit senses angular velocity and acceleration, then software estimates the robot's tilt angle. A controller compares the measured tilt with the desired upright position and calculates how much motor torque is needed. Wheel encoders can add feedback about wheel speed and position, helping the robot control both balance and motion.
To accelerate forward without falling, the robot first leans slightly forward so the wheels can push under its center of mass while maintaining balance.
Key Facts
- A two-wheel balancing robot is an inverted pendulum because its center of mass is above the wheel axle.
- Tilt error is found by error = desired angle - measured angle.
- A PID controller can use u = Kp e + Ki integral(e) dt + Kd de/dt to compute motor command.
- Motor torque changes wheel acceleration, which moves the contact point under the robot's center of mass.
- IMU data often combines accelerometer and gyroscope measurements to estimate tilt more reliably.
- To accelerate forward, the robot must lean forward slightly so gravity and wheel motion produce a controlled change in speed.
Vocabulary
- Inverted pendulum
- A system with its mass balanced above a pivot point, making it unstable unless actively controlled.
- IMU
- An inertial measurement unit is a sensor module that measures acceleration and rotation rate.
- PID controller
- A PID controller calculates a correction using proportional, integral, and derivative parts of the error.
- Wheel encoder
- A wheel encoder measures how far and how fast a wheel has turned.
- Torque
- Torque is a twisting force that causes rotation, such as a motor turning a wheel.
Common Mistakes to Avoid
- Assuming the robot balances by keeping the wheels still is wrong because balance requires constant small wheel motions to keep the contact point under the center of mass.
- Using only accelerometer data for tilt is wrong because acceleration from wheel motion can confuse gravity-based angle estimates.
- Setting the proportional gain extremely high is wrong because too much correction can cause overshoot, vibration, or rapid falling in the opposite direction.
- Forgetting motor limits is wrong because a controller may calculate a correction that the motors cannot physically deliver.
Practice Questions
- 1 A robot's desired tilt angle is 0 degrees and its measured tilt angle is 6 degrees forward. What is the tilt error using error = desired angle - measured angle?
- 2 A proportional controller uses u = Kp e with Kp = 12. If the tilt error is -4 degrees, what motor command u does the controller calculate?
- 3 Explain why a self-balancing robot must lean forward briefly in order to accelerate forward without falling backward.