SparkFun Forums 

Where electronics enthusiasts find answers.

Have a good idea for a new product for SFE or Olimex? Let us know!
By russ_barber
#2615
I have the IMU Combo Unit. I’m trying to track the “tiltâ€
User avatar
By sparky
#2632
Hi Russ,

Bare with me - I too have tinkered with an inverse pendulum robot.

The ADXRS gyros are some of the best in the world - they have some of the lowest drift in the world of gyros. But, they still drift. You will need to use the tilt sensor for off-kelter detection (Am I falling?) and the gyro (Oh S#$t! How fast am I falling?) as the rate of fall dectector.

I've noticed the gyro change output every time the unit was power cycled. This bothered me considerably - I wanted to program constants in there somewhere! But instead, use a configuration routine where you 'teach' the robot what is level, it captures the various gyro and tilt readings and attemps to maintain that position after you let go. It's quite extraordinary when it works!

-Nathan
By NateW
#2950
I saw a demo of a mini-segway sort of robot at the SRS event last year and probably the most interesting part was when the owner (whose name escapes me) put a coin on the top of the robot, way off-center. The robot tilted to regain its balance, then held still, leaning forward a couple degrees.

I thought that was pretty interesting. The owner said he used a Kalman filter to combine the inputs from the accelerometers and gyro. (All I know about Kalman filters is that I need to read more about Kalman filters.)

If I were to try to build a balancing bot (which might happen after I get a couple of legged projects built), I'd try to use the gyro in a PID loop with a set-point (desired output) of zero - basically, use the gyro to keep the tilt rate at zero, not to keep the robot level. Then add the accelerometer's signal to the output from the gyro's PID function. The accelerometer would give the motors some proportional feedback, and the "I" term in the gyro's PID loop should be able to compensate for a non-zero signal from the accelerometer.

Just an idea... Might work, might not. :)
By NateW
#2951
Sheesh, I wrote all that and forgot to address Russ' problem.

Russ, what you're trying to do is generally called "integration." In theory, if you add up all of the measurements you get from a rate sensor over time, you end up with the position. And if your position is zero, then you're back where you started. Unfortunately, integrated signals are notorious for drifting. Noise in the system will make your results less and less accurate over time. So, it's good to have a second sensor to compare against, which doesn't drift as much. In this case, an accelerometer fits the bill pretty nicely.

Another issue with gyros is that any rotation on an axis on the than the gyro axis becomes noise. Suppose I have a gyro on the vertical axis, like a turntable. I tip it sideways 90 degrees, and it doesn't detect any movement. Now it's only detecting forward-backward rotation. So I can rotate it on the vertical axis 90 degrees, and it won't detect any movement. Now it's only detecting side-to-side rotation. So I can tip it backward 90 degrees. That done, it's now back on the vertical axis, 90 degrees off of its original heading, and it hasn't detected any movement.

I hope I got that description right. Anyhow, it's an extreme case, but it shows how you can confuse a gyro by moving it on axes other that the axis that it's measuring. If you're tilting your IMU in your hand, subtle off-axis movements of your hand are probably adding to the noise and confusing the gyro. Again, there needs to be a second sensor (like an accelerometer) to compensate for drift.
User avatar
By sparky
#2964
SRS Event - you mean Robothon? We were there!

I saw a similar two-wheeled robot at Robothon that I believe won second in the Magellen event. I'll have to check with my brother - he remembers the builders.

I saw them put a paper coke cup on the edge of the robot (quite a bit of weight) and it adjusted flawlessly. Impressive, but they had some really high end electronics to pull it all off (expensive $500 gyros).

-Nathan
By Guest
#3166
I know, visited your booth and we talked briefly about your wireless serial stuff! (But so did a hundred other people that weekend, I'm sure.)