Language: EN

como-usar-un-giroscopio-arduino

How to use a gyroscope in our Arduino projects

In this post we will expand on the use of a gyroscope, another sensor that, due to its characteristics, complements very well with the use of an accelerometer, something we will see in the last entry of the series on IMUs.

In the previous post we have seen the basics of accelerometers, a very useful component that allows us to determine the acceleration and orientation of a device.

What is a gyroscope?

A gyroscope (also called gyro) is a device that allows to measure the angle of rotation turned by a certain mechanism.

Unlike accelerometers, gyroscopes are purely differential devices, that is to say, there is no absolute reference but angles are always measured relative to an arbitrary reference.

There are various types of gyroscopes (mechanical, laser ring, fiber optic). Those used in MEMS are called Coriolis effect vibratory gyroscopes (CVG), which in a way can be considered an evolution of the Foucault pendulum.

We remember that the Coriolis force is a fictitious force that appears on a moving body when it is in a rotating system.

The value of this force is,

Do not confuse with the centripetal force which is a real force that must be exerted on a system to make it rotate, or with the centrifugal force, which is a fictitious force in non-inertial systems.

The operating principle of a CVG is that a vibratory object tends to vibrate in the same plane even if it rotates. The Coriolis effect causes the vibratory object to exert a force on the support, and by measuring this force we can determine the rotation to which the gyroscope is subjected.

arduino-giroscopio-funcionamiento

To record the effect of the Coriolis force, a MEMS has structures similar to those of the accelerometer. Certain parts of the body are subjected to resonance vibration and the effect of the Coriolis force deforms the structure, which can be measured by the variation in capacitance of the system.

arduino-acelerometro-giroscopio

As in the case of accelerometers, it is normal for the gyroscopes we use to be 3-axis, that is, they independently record rotation in X, Y, and Z, which allows determining the magnitude and direction of the rotation.

arduino-yaw-pitch-roll

One of the consequences of using the Coriolis force is that vibratory gyroscopes, unlike other types of gyroscopes, do not record the rotated angle but the angular velocity, which is the rate of change of the angle with respect to time.

The units in the International System are rad/s (equivalently s-1), although other units such as º/s, rev/s (rps), or rev/min (rpm) are often used.

To obtain the position angle of the sensor it is necessary to perform integration with respect to time, something that is usually done by the internal electronics of the sensor.

We cannot stress enough that integral measurements are never a good idea because they involve the accumulation of measurement errors and noise, which causes drift in the measurement.

Indeed, the biggest problem we encounter with vibratory gyroscopes is that they have drift in the medium and long term, that is, the measurement progressively deviates from the real value (even with the sensor static).

On the other hand, gyroscopes are sensors of rapid response and high precision in short times. In addition, they respond well to sudden changes, and are relatively immune to noise, always in short time ranges.

If you have read the post about the accelerometer, you will see that its measurement characteristics are opposite to those of gyroscopes, so (attention SPOILER) they complement each other very well.

We will see this in depth in the next post, how to measure inclination with IMU, Arduino, and complementary filter, where we will finally bring both devices together to make a sensor more robust than both independently.

Download the code

All the code from this post is available for download on Github. github-full