Вы находитесь на странице: 1из 8

Acquiring 2-Axis Data From A MEMS Gyroscope

Paulo Cummings Pizzuto∗


Illinois Institute of Technology, Chicago, Illinois, 60616

Lab Partners: Brayan Abreu-Gomez and Michael Murray


Illinois Institute of Technology, Chicago, Illinois, 60616

Professor: David R. Williams, Ph.D.†


Illinois Institute of Technology, Chicago, Illinois, 60616

This experimental procedure aims at obtaining an angle reading from of a mechanical arm
using a microelectromechanical gyroscope. The paper discusses proper setup and calibration
procedures for the sensor which results in precise readings, methods for error correcting
are discussed. The final result of this experimental procedure is an accurate reading of the
inclination angle.

I. Nomenclature

M E MS = microelectromechanical systems
Ω = angular rotation velocity
φ = roll angle
θ = pitch angle
V = volts
Vo f f = offset voltage
ADC = analog to digital converter
C = procedural programming language
x̄ = estimate of the mean
sx = estimate of the standard deviation
µ = true mean
α = confidence interval
Z = statistical Z-score

II. Introduction
he purpose of this experimentation, is to gain experience in the functionality of a MEMS gyroscope. A basic
T mechanical gyroscope is a device that can be used to measure or maintain a certain orientation and/or angular
velocity, dating back to ancient Greece, this device consisting of a gyroscope frame, a spin axis, a gimbal and a rotor
was popularized by French physicist Léon Foucault who proved Earth’s rotation with gyroscopes and a pendulum. The
MEMS gyroscope works differently, exploiting the Coriolis effect, when a mass (m) is moving in direction v → and
angular rotation velocity Ω → is applied, then the mass will experience a force in the direction of the arrow as a result
of the Coriolis force. A fork like capacitance system will measure the displacement caused by the resultant Coriolis
force, this leads to a change in voltage output which allows to obtain angular rates after proper calibration. A basic
diagram of the MEMS gyroscope principle can be seen on Figure 1. ∗
∗ Fourth Year Aerospace Engineering Student
† Professor of Mechanical & Aerospace Engineering and Director of the Fluid Dynamics Research Center
∗ Figure credits: Stanford University

1
Fig. 1 A diagram of a MEMS gyroscope, with the v →, Ω → and the resultant Fcoriolis shown

MEMS gyroscopes have plenty of applications in several industries for example: they allow cars to deploy airbags,
allow smart-phones to provide engaging user interfaces and are also useful to determine roll, pitch and yaw rates in
various aircraft. This experimentation constrains our hardware to two degrees of freedom, utilizing a multi-copter arm

attached to a desk, the pitch rate (q = dθ
dt ) and roll rate (p = dt ) will be read from the gyroscope by a data acquisition
system and processed with a Simulink model that will allow reading the pitch angle of the multi-copter arm in real time.
Since the gyroscope outputs an angular rate Equation 1 is used to get the angle in real time.
∫ t

θ(t) = θ(t0 ) + dt (1)
t0 dt

Where θ(t) is the angle in real time, θ(t0 ) is the initial angle at the initial time and the integral is processing the angular
rate over time. To calibrate our gyroscope it has to be placed at a completely static position, the Vout at that position will
be the Vo f f . Hence the linear calibration for the gyroscope is seen in Equation 2. The sensitivity of the sensor is given
by dV
d θÛ
. Solving for dθ
dt and substituting that into Equation 1, Equation 3 is obtained, which accounts for Vo f f and the
sensitivity.
dV dθ
V(t) = Vo f f + (2)
d θÛ dt
∫ t
V(t) − Vo f f
θ(t) = θ(t0 ) + dV
dt (3)
t0
d θÛ
Using Equation 3 to build the Simulink model the angle in real time will be obtained. The fact that the calibration of our
system relies on integration small errors in the Vo f f will cause the integrand to be non-zero, this will make the angle read
by the sensor change with time even if the gyroscope is completely static, this is called drift rate and it can be minimized
by getting Vo f f to be really close to V0 , in this experimentation the drift rate is minimized as much as possible.

III. Experimental Setup


This experiment is carried out after setting up three different systems. The first is the physical system which consists
of a multi-copter arm which is constrained so that it only has two-degrees of freedom, the arm is able to move about
180◦ freely, the arm is attached to a desk which prevents it from changing its vertical position at the beginning of the
arm, horizontal position and yaw angle. A MEMS gyroscope is attached to the arm, in this manner as the pitch angle of
the arm changes the same thing happens to the gyroscope. The gyroscope’s cables are also attached to the arm in a way
that they don’t obstruct the circular motion of the arm. Figure 2† shows a CAD model of the physical setup.
† CAD model done with Autodesk’s Inventor Student Edition

2
Fig. 2 Sketch of the physical setup, the arm has a circular motion freedom of -90◦ to 90◦

The second setup is the electrical system, which not only powers the LPY503AL gyroscope sensor but also reads the
non-amplified x-axis output signal and splits it into two with a T-connector. Both signals have to be grounded, one
of the signals goes to a Tektronix TDS 2002B oscilloscope, the oscilloscope displays the x-axis raw voltage from the
gyroscope this is useful for calibration and debugging purposes. The other signal goes to an ADC input (Ch-5 for this
experimentation) of a data acquisition system developed by dSPACE, it allows users to read and/or write analogical and
digital signals with a personal computer. The dSPACE environment features the ControlDesk software which allows
interfacing with Simulink as well as reading inputs and writing outputs in real time. The use of a breadboard and a
variable voltage DC power source made the electrical setup smoother. Please refer to Figure 3‡ , for a sketch of the
finalized electrical setup, please note that the gyroscope was not directly connected to the breadboard as shown on
Figure 3.

Fig. 3 Sketch of the electrical circuit built to read the x-axis of a gyroscope

The final setup is building a computer program that acquires the raw voltage from the dSPACE ADC and converts it
into an angle by using Equation 3, the program is built using Simulink which is a graphical programming environment,
which allows advanced simulations and modeling of dynamical systems. The Simulink model seen on Figure 4 reads
Ch-5 from the the ADC and then processes it using built in functions based on Equation 3. As seen in Equation 2,
the mathematical model relies on Vo f f and the sensitivity ( dV
d θÛ
), for the initial model these values were obtained from
‡ Electrical sketch done with the open-source Fritzing software

3
the manufacturer’s data sheet§ for the LPY503AL MEMS gyroscope sensor. When the Simulink model is compiled
dSPACE will begin running the compiled C code immediately.

Fig. 4 Simulink layout used to process the signal by recreating Equation 3

The advantage of the dSPACE environment is that it allows the user to modify graphically the C code compiled by
Simulink, no programming knowledge required. This means that variables such as Vo f f and sensitivity can be modified
in real time through ControlDesk without recompiling the Simulink model. ControlDesk allows the various variables of
the Simulink model to be modified and read in real time. ControlDesk consists on a list of predetermined graphical
tools to read and write data, examples of such tools are: displays, gauges, plots and sliders to mention a few. The
ControlDesk layout was setup to calibrate and tweak the signal in order to get proper angle readings, such layout can be
seen on Figure 5.

Fig. 5 Layout created in ControlDesk to monitor and modify various parameters

One of the outputs seen at ControlDesk is the raw voltage output of the sensor, by placing the gyroscope at a
completely immobile surface that raw voltage output will roughly be Vo f f . Using the newly determined Vo f f input it
through ControlDesk to modify the initial value, this will decrease the drift rate. Record the drift rate for that particular
Vo f f by taking various data points of how the angle output changes with time while the sensor is completely stationary.
Once the drift rate is small enough for proper angle reading use an external digital angle gauge to record angle changes
from you initial position to the horizontal. Zero this gauge at the workstation table, proceed to do angle changes from
your initial angular position to when the gauge reads zero, record the value being read by ControlDesk.

IV. Results
From the oscilloscope signal, the saturation of the gyroscope sensor was found to approximately be from 0V to
2.75V this was obtained by quickly moving the multi-copter arm with the attached gyroscope sensor.
§ Provided by ST, the manufacturer of the gyroscope

4
With the sensor stationary and ControlDesk running, the Vo f f1 is found to be 1.3769V, however with this Vo f f the
drift rate was to fast to properly read the angle. The Vo f f was increased and decreased by small amounts and the drift
rate at each different Vo f f was recorded. To record the angle changing with time screen shots of the ControlDesk
were taken besides a precise chronometer, the screen shots were then converted to a Matlab matrix. The results of this
procedure can be seen on Figure 6.

Fig. 6 Plot of output angle drifting with time for various Vo f f

With the system completely setup, the collected data from measuring the angle change from −93◦ to 0◦ can be seen
on Table 1. The angle gauge was zeroed on the desk where the multi-copter arm is attached, then the angle at its initial
stationary position was measured to be −93◦ the arm was taken 13 times to a horizontal position until the angle gauge
read zero, at this instant the angle from ControlDesk was recorded. To accommodate for the fact that arm is not resting
at exactly −90◦ , 3◦ have to be added to the angle change column of Table 1 when analyzing the obtained results.

Angle Change
1 -2.7◦
2 -2.1◦
3 -1.9◦
4 -2.06◦
5 -2.9◦
6 -2.4◦
7 -2.5◦
8 -2.5◦
9 -2.3◦
10 -2.9◦
11 -2.2◦
12 -2.2◦
13 -2.9◦
Table 1 ControlDesk results from moving the multi-copter arm from -93◦ to 0◦

V. Discussion of Results
The experimentally found saturation can be used to limit the sensor output, if the saturation limits of this gyroscope
sensor (0V to 2.75V) are violated it means that the sensor has been pushed beyond its design boundaries, for example if

5
it is moving faster than what it is designed to, the sensor will output voltages above or below the saturation limits, this
is not desired since it leads to wrong data and even permanent damage to the sensor. The sensor can also exceed its
saturation limits if the input voltage is higher than its operating design voltage, this leads to wrong data output and
eventual burnout of the electronics.
The various slopes of the five different curves seen on Figure 6 represent the drift rate, which means how quickly the
output angle is changing with time, this is due to the integrator factor in the mathematical model. To further reduce this
phenomena several different approaches could be used, the one used in this experimentation is to plot the drift rate
vs Vo f f as can be seen on Figure 7, from this data scatter a simple one degree line is fitted using the polynomial fit
numerical method. The data points fit the following line Y = 93.123622X − 105.9626872, when it equals zero the
X value is close to 1.378711V. Using this approximation the drift rate is significantly decreased, it is not completely
stopped since voltage oscillations are still present, however it is decreased to a degree that allows proper angle readings.

Fig. 7 Plot of output angle drifting with time for various Vo f f

Using the results from Table 1 a statistical analysis is done to get an estimate of the mean, an estimate of the standard
deviation, an approximation of the true mean and a Student-t distribution curve which can be seen on Figure 8. To
obtain an estimate of the mean from the results we first add the offset angle of 3◦ and then using the definition of the
mean seen in Equation 4, it is found that for the obtained results the estimate of the mean is roughly 0.5723◦ this value is
however not the true mean unless the number of data samples was close to ∞. For the standard deviation estimate, the
definition of it seen in Equation 5 the estimate is roughly 0.3410◦
N
1 Õ
x̄ = xi = 0.5723◦ (4)
N i=1
r
1 Õ
sx = (xi − x̄) = 0.3410◦ (5)
N −1

6
Fig. 8 Bar plot of the obtained data with a normal distribution curve

To obtain a true mean the student’s t-distribution method by William Gosset is used, this method allows finding the
distribution of a random variable in this case θ by only knowing estimations of the mean and of the standard deviation.
As the number of samples increases the Student-t distribution get closer to the normal distribution. From Equation 6 the
true mean can be found to lie in-between two values based on statistical estimations and the confidence interval of the
curve seen in Figure 8.
Sx Sx
x̄ − z α2 < µ < x̄ + z α2 (6)
N N
From Figure 8 the confidence interval α is estimated to be 90% hence α2 = .45, using a table of T-distributions¶ Z α2 is
found to be 1.782. Plugging all these into Equation 6 yields the following 0.4038◦ < µ < 0.7409◦ , it can be said with a
90% confidence that the true mean will lie in between those values.

VI. Conclusions
This experimentation has properly acquired useful data from a MEMS gyroscope. With the objective of reading the
pitch angle of a multi-copter arm, the functionality of a MEMS gyroscope had to be understood, by referring to the
manufacturer’s data sheet and through the mathematical derivations‖ discussed previously. Three models were created
one allows the arm to move alongside the sensor, the second one powers the sensor and connects to the data-acquisition
systems the third one allows processing of the acquired data and actually displaying a pitch angle in real time.
The problem of drift which occurs in many MEMS sensor, was successfully taken care of. This technique will work
when dealing with drift rates with other time based sensors, improvements to the used techniques have been thought out
and will be applied in further experimentations. Properly calibrating a MEMS sensor to read proper data is critical in
controls systems, since the mathematical and computer models are useless without the right data. From the results, it
can be seen that even mass manufactured sensors as the one used, will vary in their output to a certain extent, properly
configuring your system to the actual hardware is critical in successfully measuring the factors affecting your system.
The results obtained after accounting for the experimentally determined Vo f f were very satisfactory, however to find
the reliability of the sensor many more data points should have been taken, since the actual mean of our angle is being
estimated by the Student-t method. Having more data points would have yielded a more precise statistical model. This
experimentation concludes in a proper calibration of a MEMS sensor and a very accurate reading of the pitch angle of
a multi-copter arm. This MEMS gyroscope reading method can be used to feed data into the controller of a flying
helicopter for example.

References
[1] Knuth: Computers and Typesetting,
http://www-cs-faculty.stanford.edu/˜uno/abcde.html
¶ Table from statistics how to website
‖ Provided by Professor Williams

7
[2] Foucault Pendulum,
https://www.maa.org/sites/default/files/pdf/upload_library/1/1/Oprea-Ford-1996.pdf

[3] MEMS gyroscopes introduction,


http://electroiq.com/blog/2010/11/introduction-to-mems-gyroscopes/

[4] Gyro image,


http://web.stanford.edu/ yanm2/gyrophone/images/IS-forces.png

[5] LATEXMath Symbols„


http://web.ift.uib.no/Teori/KURS/WRK/TeX/symALL.html

[6] How to statistics,


http://www.statisticshowto.com/tables/t-distribution-table/

[7] Wolfram Math World,


http://mathworld.wolfram.com/Studentst-Distribution.html

[8] Control Theory,


http://wikis.controltheorypro.com/index.php?title=Saturation

[9] Matlab Reference,


https://www.mathworks.com/help/matlab/ref/std.html

[10] C language,
https://www.geeksforgeeks.org/c-language-set-1-introduction/

[11] dSPACE,
https://www.dspace.com/en/pub/home/products/systems/controldesign/matlabsimulinkstateflow.cfm

Вам также может понравиться