Gyro vs Accelerometer

Hi all,

I've been scanning around the interwebs at various supplies for a gyroscope and/or accelerometer but the problem is, I don't know which I need to handle the task in hand.

I'm putting together the pieces to create my own tri-copter and have run into some confusion when it comes to the difference between gyros and accels.

I've been playing around with the new iPhone 4 (which has both gyro and accel in) trying to determine which does what in terms of the readings they both push out.

Basically, all I want to achieve is making some form of auto leveling for the tri-copter when I get round to building it. From reading other forums it seems people are using a combination of both to achieve 5+ degrees of freedom (this, I also don't understand).

Would an accelerometer suffice for simply determining whether the tri-copter is level, or do I need to utilise a gyroscope as well to get the correct readings?

At this moment, I'm not really too bothered about the orientation of the tri-copter as I assume a compass or gps sensor would suffice to give me a heading or location of some degree which I can factor in later once I have the tri-copter off the ground with the ability to hover steadily at a set altitude.

Can anyone provide a brief explanation of the differences between the two sensors and whether or not both are needed to be able to level out the tri-copter. Any insight into this 'degrees of freedom' lark would be appreciated too :slight_smile:

Thanks for reading!

Well I don't know much about the components, but I might be of some help with the concepts here...

Accelerometers do just what their name implies... they measure acceleration (as a swiping gesture with a Wiimote, or a car crash)... They can, however, also be used to measure orientation to some degree, since gravity is a constant force, and a sideways accelerometer will read different than an up-standing one...

A gyroscope, on the other hand, is a device for measuring orientation, since gyros spin really fast and spinning objects tend to retain their initial orientation, this can be used to measure relative orientation (and even absolute, if you have a gyro that never becomes misaligned)

The amount of measurements an accelerometer or a gyro can report is stated in degrees of freedom.

A degree of freedom is an axis about which you can displace yourself... like moving left/right, or pitching up/down...
In 3D space there can be 6 degrees of freedom... those are left/right, up/down, fore/aft (XYZ translations), Pitch, Yaw and Roll (XYZ rotations)

However, one might come across devices that say they can measure more than 6 DOF, like the 9DOF sensor from SparkFun... that doesn't mean it can measure hyperdimensional space (bummer)... but simply that it can measure absolute as well as relative displacements.

Now, on the difference between relative and absolute measurements...

Relative measuring is basically saying how much you displaced yourself from your previous measurement... no information of where you are can be known without a first (absolute) reference.

Absolute measuring is exactly the other part... it tells you where you are in relation to a wider scope (like magnetic north, or a fixed point in XYZ space), but how much you've displaced yourself since the last measurement would have to be calculated later.

So a device that states 9 degrees of freedom is probably an accelerometer coupled with a gyro and a compass for 6DOF relative measurement and absolute measurement of the 3 orientations so it gives you translation XYZ, pitch, yaw, roll, azimuth, zenith and... absolute roll (does it have a name?)

Now, on this notion, the maximum amount of degress of freedom one could have in 3D space would be 12, and include absolute and relative translations and orientations... Absolute position tracking is tricky, because it requires a frame of reference, which most people aren't willing to build on their living rooms... so a small 12DOF sensor is not something you can pick up at SparkFun yet, but if you do find one, please let me know so I can buy a thousand :wink:

I hope this helps... (and I hope I didn't write too much nonsense)

Cheers

Thanks HarvesteR!

Your response is most helpful in understanding the concepts of both accelerometers and gyroscopes. I think the stuff about DOF sunk in too :slight_smile:

From what I can gather now, both sensors would be needed to get the best reading in terms of rotations around the X and Z axis which would provide the bearing for determining how to automatically level the tri-copter out.

My initial thought was that a gyro would suffice to provide the appropriate values for how 'level' the tri-copter is but seeing the tri-copter will be moving along all 3 axis, i'm guessing the values read in from the accelerometer could be used to factor out any instability due to actually acceleration of the tri-copter itself. That should read: When the tri-copter is moving, any tilt/pitch from the movement could be factored out to ensure that i'm not trying to level out whilst in motion. If that makes sense?

A few tri-/quad-copter builds i've seen seem to use both sensors in tandem so I can only assume that that is the best approach. However, the projects i've seen all seem to be by model aircraft enthusiasts who are more interested in flying the device manually whereas i'm vying for a more autonomous approach.

It's a shame the ones i've seen featured on http://www.hackaday.com don't have more information about the build process as these seem to generally be the more interesting projects rather than simply building something I can fly around a field on my time off from work.

I guess I really should iron out what I want my tri-copter to be capable of before spending any more cash on parts but at least now I understand (slightly more than before at least) the reasoning behind the usage of both a gyroscope and accelerometer.

Thanks again for your reply :slight_smile:

Humm...

Sorry, it seems i've confused myself once more. :confused:

This page lists the parts used for a quadcopter build aeroquad.info on which it states that they used a 5 DOF IMU (Inertial Measurement Unit) and also a Dual Axis Gyroscope which apparently "adds the 6th DOF"

Unfortunately, the site neglects to mention the actual build process (even though there is a build process page) although I did manage to find a photo in which you can clearly see that some of the components are mounted vertically Attachment browser: ufo03.jpg by joeling - RC Groups

Am I correct in assuming that the 5 DOF IMU (accelerometer and gyroscope) is mounted horizontally to measure acceleration along all 3 axis and rotation around the X and Z axis?

Bearing that in mind, what purpose does the Dual Axis Gyroscope serve? Even mounted vertically, surely it would still measure rotations around the X and Z axis?

Does this mean that in order to determine rotations around the Y axis, the only component capable of such would be a compass sensor or magnetometer? Given that I want to create an autonomous vehicle, the orientation of the device is crucial seeing as it won't be me who's flying it and therefore knowledgeable as to which way it's facing.

Basically, I need to measure rotation around the X and Z axis to determine whether the tri-copter is stable. Currently, something that hovers will suffice until I think about adding in orientation/heading and waypoint finding at a later date. Which sensor would provide the appropriate feedback to achieve this? I'm so confused right now ::slight_smile:

Thanks for reading, any help is appreciated!

Hi again,

Glad I could help :slight_smile:

Am I correct in assuming that the 5 DOF IMU (accelerometer and gyroscope) is mounted horizontally to measure acceleration along all 3 axis and rotation around the X and Z axis?

Bearing that in mind, what purpose does the Dual Axis Gyroscope serve? Even mounted vertically, surely it would still measure rotations around the X and Z axis?

The IMU is one type of sensor that kind of falls out of the absolute/relative labels, because it is both...

Basically it works by, after being calibrated to a known absolute point and orientation, calculating it's current absolute displacement based on relative data...

Did that maky any sense? let me try and clarify it... basically it knows where it is because it knows where's it's been... It's like saying 'I started out at point (0,0), but then I moved 30 in X then 50 in Y, so I must be now in point(30,50) and so on and so on...

Commercial aircraft like the Boeing 747 use this system for location information... the trouble is that it has to be calibrated every once in a while with known positional information, since with this system desynchronizaiton is pretty much inevitable...

But anyways... to answer your question... you're probably right in assuming the 5DOF IMU is sensing all 3 translations and probably pitch and yaw rotations too... the 2 axis gyro is really one axis redundant, but maybe the builder liked to keep his option.

As for your next question, I assume that by Y axis you mean the up-axis (there is more than one axis convention out there)... Also I imagine you mean measuring absolute Y rotation...

That can be done with a magnetometer (which just a fancy word for a multi-axis compass) or a good gyro.

Anyways, a 3 axis magnetometer should be good enough for your roll, pitch and compass heading needs...

For absolute positioning, which given your project is an absolute (no pun intended) necessity, I'd go with an IMU, since it's a self-contained solution... just bear in mind the need for frequent calibration, lest your copter ram into your TV or something :-X

I'm just another n00b when it come to electronic components, so I'm afraid that's all the help I can give about that... I'm just getting started with the arduino myself...

Anyways, I wish you the best of luck on your project, which sounds really cool I might add.

Cheers

Thanks again for your reply HarvesteR :slight_smile:

I think your explanation has helped all this information to sink in finally.

I know it probably sounds really daft but the purpose of an accelerometer says it all in the name, right? =P God knows why that one caused me so much confusion. I'm still not 100% as to why you'd need to measure acceleration around anything other than the Y axis to determine if the device is 'falling' as such but I guess that's something I'll have to look into further.

As for the gyroscopes, I can understand why I'll need to measure rotation around the X and Z axis as this will help me to determine if the device is level or not. As for rotations around the Y axis, I think that's where the magnetometer comes into play?

This IMU I found boasts 9DOG http://www.coolcomponents.co.uk/catalog/product_info.php?products_id=462 which i'm thinking may be the best bet for my project seeing it's an all in one solution.

I like the possibility to measure translations from a set reference point, that could be rather handy for 2d/3d wireframing the world and measuring how far the tri-copter has traveled and in which direction.

As I mentioned before, I'm going to make a conscious effort to iron out what I want my tri-copter to be capable of before I start splashing out on 9DOG sensors (78 GBP is a bit steep for a hobbyist =P) but at least you've helped me clear up which tools I'll need for the job. Well, the need for an accelerometer still escapes me but at least I understand it's purpose.

Thank you for your in depth responses, as much as this information is available on the internet you do make it much easier to understand :slight_smile:

the Y axis to determine if the device is 'falling'

Gravity conventionally acts in the z axis.

Gravity conventionally acts in the z axis.

That depends on your coordinate system... 3D Studio Max, for instance, uses Z as the up-axis and Y as the depth-axis. On the other hand, DirectX uses the Y-up convention (with Z as depth)

So, to avoid confusion, it's best to refer to them as up-axis, forward-axis, and names like that... (X axis is fine since it's always lateral)

Cheers

Sorry, I should have been more clear with my axis labelling =P

Coming from an OpenGL background, Y is the up/down axis and Z is the fore/aft axis.

Essentially, this is a moot point seeing sensors can be oriented in any way you see fit so as long as I have a clear indication as to which axis is which in relation to the device. For now, I'll stick with the axis convention I feel comfortable with :slight_smile:

I'm wondering how complex this could all get in terms of the math behind it all but I do have a fairly solid Vector, Matrix and Quaternion library I could port into C assuming it will all fit on the Seeeduino =D