using gyroscopes

This is more of a theory question than one specific to the arduino, I hope this is the right sub for such a question.

I have just finally gotten my 3 axis gyroscope working, and I must say it's a thing of beauty. Its there not making a peep in serial, and then rapidly streams the updated degrees from start (NOT speed!), stopping suddenly at 89-91 as my breadboard squares the other side against the table.

Now that I have that working accurately, I will be adapting it for smoothing the tilt correction on my compass, that's currently relying solely on an accelerometer. (they're a bit jumpy, the gyro should REALLY smooth things out)

But I foresee a snag, in a gyroscopic effect that maybe I should have foreseen. I can spin this thing all around and it does a very good job of holding position, usually within a degree or two, as long as it's only turned on one axis at a time. When I "swirl" it, it does exactly what I would expect a gyroscope to do. It rotates the entire system.

Let me make sure you understand what I mean when I say "swirl". Imagine a cone with the tip pointed down and the bottom circle facing up. The vertial surface of the cone is made up of lines that go up from the tip to all around the circle. Imagine the gyroscope placed at the tip, with the body of the gyro being moved in a swirling motion such that the top center of the gyro is facing exactly an edge of the circle above it. Sorry, it's difficult to explain.

But if you try that with a gyroscope, you will notice as you twist, it torques itself at 90 degrees to the angle it's spinning and the angle you are moving. There's a name for that effect I'm sure someone will drop soon but I can't recall it right now. (you really need to be familiar with this when working on RC helicopters, that's really important for how the head is controlled) Anyway, when you finish your swirl, the gyroscope's ends won't be in the same alignment they were before. The axis of the gyro wlll be changed.

And that's what my gyro is doing too. After a swirl, the Z axis, which should be back at 0, is now maybe a 70. Now I intend to use this compass to keep track of north on a piece of handheld gear as the user is walking around on uneven ground, not paying too much attention to the physical orientation of the gear, and the gear needs to be continuously aware of north, as accurately as possible. This is why the tilt compensation is critical. I don't expect the user to be "swirling" the gear, but I foresee this causing problems with the tilt correction. I'm going to be using the simpler (non kalman) method that basically figures current tilt based on 98% of the previous angle + the change in the gyro, + 2% of the accelerometer. Given the large influence the gyro will have, I think I need to keep it as accurate as possible.

I hadn't really expected this snag with the gyro. The entire thing has really been stacking up on me. Got a compass. ok need to correct that with an accelerometer. ok need to correct that with a gyro. Now I need to correct that too??! Ideas? (and sorry for the long post)

Precession

Rotations are completely unlike translations; they don't commute so it matters what order you choose the rotation axes for compound operations. Furthermore, more than one set of rotations describes the same transformation between two different orientations.

The best and clearest introduction to angular coordinate systems, attitude and heading estimation, etc. that I know of, is on the CHRobotics site: https://www.chrobotics.com/library

PRECESSION
Upload a photo

I don't know if "precession" was the word I was trying to remember… I think it was going by something else with respect to helis. Anyway, yes that's it. So… is there a way to "fix" the gyro's X and Y after they have been altered by precession? What it amounts to (I think) is removing the Z, since there is never any actual change in Z angle, relative to the other two sensors. But I have no idea how to do that, I've never ran across anything like it online.

How about a photo of your gyroscope ?
Or better yet, a link to a Youtube video of it ?

raschemmel:
Or better yet, a link to a Youtube video of it ?

This isn't a physical gyro, it's an electronic one. One sensor in the GY-81 package, which also includes an accelerometer, compass, and pressure sensor. This is by far the best price for these combo modules:

"More than 10 available / 342 sold", obviously people like them. (I bought two) It's handy to have all those sensors on the same board, all with I2C interface. The compass, accelerometer, and gyro are all 3-axis. The pressure sensor isn't too useful, but whatever. The gyro has an onboard temp sensor also, presumably for drift compensation due to temperature. You only need to use four of the pins on the board. I am looking into using INT1 pin right now to stop some glitching.

So after calibrating, I let it run overnight. When I woke up in the morning, it had drifted FOUR degrees. nice.