So first off, a Segway needs to know at what angle it is to the ground. This can be accomplished surprisingly easily.

Their are basically two types of sensor used for sensing tilt in a robotics application, the Gyro and the Accelerometer. Both have their advantages and disadvantages, and both must be used for reliable tilt data.

Accelerometer - Used in the Nintendo Wiimote and Nunchuck


  • Doesn't Drift

  • Outputs Acceleration due to gravity


  • Very prone to vibration

  • Not very precise

  • Also senses the acceleration of the Scooter

Gyro - Used in Helicopters


  • Very precise

  • Very smooth input

  • Provides angular rate


  • Drifts - A LOT!

So what do you do?

Combine these two inputs so that you can get a solid, quickly responding signal, that doesn't drift. There are two common ways to accomplish this:

  1. Kalman Filter

The Kalman filter is a mathematically complex filter that provides a theoretically ideal combination and smoothing of sensor signals.

Implemented on the Arduino Here

Might be tried, but not until a working system is created

  1. Angle Complementary Filter

Uses a time bias to determine which sensor to trust

Described and implemented in the SegSpecs.zip file here

Easier to implement and cancels out drift and vibration.

blog comments powered by Disqus