so i played around with an angular rate sensor at one point, trying to make my own balancing bot.
it's harder than you would at first think.
the angular rate sensor doesn't tell you which way up is but instead tells you how fast it is rotating.
(an accelerometer will tell you which way is up but only if it's not accelerating.)
so to initially calibrate the angular rate sensor you have to hold the bot stationary. this will give you a set output voltage.
if the bot starts to rotate (ie, fall over) this voltage will change.
you have to develop an algorithm that takes into account the rotation of the robot and also the speed at which the wheels are turning.
to get the bot balancing in a stationary position you have to react to any change in angle by turning the wheels in a direction that counters that angle.
if the rate of change of angle is increasing you need to turn the wheels faster. if the rate of change of angle is decreasing you need to turn the wheels slower. if the rate of change of angle is constant then your bot is not falling over at the moment but it is not necessarily stationary.
you have to be take into account the speed the wheels are turning at the moment and try to add just the right extra speed to hit the stationary *and* balanced point both at once.
to anyone who's trying to build a balancing bot, remember it's actually easier to balance a top heavy item than a light one.
to prove this point, try and balance a broomstick on it's end in your hand.
it's easier with the heavy end pointing up.
i never did get this idea for a bot working particularly well.
it could stay upright but you wouldn't call it "balancing". more like a jittering shuffle.
i never did work out if the problem was due to lack of precision in the sensor i was using, interference from the motors or just problems with my code.
most of the articles you find on the internet (as well as the segway) use a combonation of angular rate sensors and accelerometers.
i started my experiment thinking it was possible with just the angular rate sensor but i never did prove this point effectively.
i'll probably go back to it one day but my present bot is taking up all my spare time.