# Measuring rotation over z-axis (gravity axis) inside an metallic duct

Well from my first research from the web I wasn't able to tell if what I need can be done.

The thing is, I need to measure the rotation over z-axis (yaw), in other words, to know the relative angle from the start point. The prototype goes down (z-axis negative direction) in the duct and it can eventually rotate, but it's not expected to rotate a lot or even fast.

So I found that it could be done with a compass but my prototype travels inside a metallic duct.

I tested my phone compass inside the duct and it went nut. So my first question is if the compass inside my phone is similar to the ones i found in IMU's and so.

Also saw some stuff about gyro and accelerometer, and I'm my way I've found a lot of info about Kalman Filter, but I'm kindda noob.

So my second question is, are the accelerometer and gyro able to measure yaw rotation. Even those "cheap" ones?

Where you guys think I should go from here?

• What are the size and shape of the prototype and of the duct? Are they givens or can you specify them? Is the duct straight? Vertical? Apr 20 '12 at 17:07

Sadly, this may be a very difficult problem to solve. The problem is that you have almost nothing to use as a reference.

There's no magnetic field, and no suitable gravitational one. So compasses and accelerometers won't help you here. These are the options I can think of:

Gyro: You can measure the rate at which the object is rotating, but not its absolute orientation. By watching the rotation rate all the time, you can estimate your angle by 'dead reckoning' (integration). However, this is really not accurate over long periods of time because the gyro isn't a perfect sensor. More time = more error.

Optics 1: There are a huge number of options here which may be suitable depending on your particular circumstances. Firstly, you could use a camera to look at the inside of the duct. If it's featured enough, you could figure out your angle by looking at the features. If the duct is perfectly smooth on the inside, then perhaps you can shine a laser down the duct to spot on the inside for the prototype to use as a reference.

Optics 2: If the entrance of the duct is still visible from the prototype, then a camera on the prototype could look back up the duct and see the orientation of the outside world to get its bearings.

Acoustics: If you have access to the outside of the duct, then maybe you could repeatedly tap on the outside of the duct, and the prototype could get a sense of direction with a couple of microphones.

How is the prototype being lowered into the duct? On a piece of string? If so, then attach it to a pair of strings instead. That way it won't be able to rotate by itself. You'll do the rotating from the entrance of the duct.

So, basically, all of these options involve some complexity. You won't be able to get a simple analog direction signal from a simple sensor. Almost everything I can think of involves processing power to some degree.

If you can give more details of your problem, we may be able to think of better solutions.

• First of all, thanks so much for the time you used to help! For my first question here, I was very happy with the help found here. Apr 24 '12 at 21:32
• @Bergamin - Did you manage to solve your problem? If so, I would be very interested to know how you did it? Apr 24 '12 at 21:35
• hi there! Actually not, I'm still thinking which way should I head. But you were so helpful. Thanks! And as soon as I make some advance I report back! Apr 24 '12 at 21:44