End-course project for Misure ed Analisi Dati (Metrology and Data Analysis) @ University of Rome Tor Vergata.
This project aims to produce a Simulink model for a MEMS angular speed sensor to be used in simulation of autonomous vehicle algorithms. The model must be parametrized to be adapted to the datasheet of the chosen sensor to approximate its behavior in terms of noise, non linearities and non idealities. The project follows this schedule:
- Mathematical modeling of sensor output;
- Allan variance method for noise contributions classification;
- Data collection and model fitting of real sensor output;
- Comparison of model output and real output.
A low cost MARG sensor (InvenSense MPU9250) was used to collect data and to verify the model. The data is collected from the sensor using an NXP LPC microcontroller with I2C serial protocol and streamed to a target computer via USB 2.0 Full-Speed protocol.
Gyroscope output is modeled as follows:
where is the disalignment matrix, models the random fluctuations of the sensor output; it is tipically assumed as a random variable with normal distribution with zero mean and diagonal covariance matrix.
is a bias term which can be assumed as a Wiener process (random walk process):
Bias contains, however, a static contribution which can be calculated from the still gyroscope output. This static contribution is evaluated as an example with 100 samples from the still sensor at a sampling frequency of 100Hz. The y-axis histogram for this data sample is shown
Mean and variance are evaluated as -0.3421 dps and 0.1395 dps, then it is possible to evaluate the standard deviation for the means distribution as
Considering a 95.45% confidence level related to a 2 *coverage factor+, the expanded uncertainty is 0.0279 dps. The static bias contribution on the y-axis is then, within a confidence level,
The same procedure can be repeated on the other axes to obtain the entire static bias vector. To reduce the confidence interval, it is necessary to increase the dimension of the sample.
Integration of gyroscope output for attitude estimation drifts tipically because of bias; output noise is also an important factor of performance degradation of estimation algorithms, especially for long integration times. The noise of an inertial sensor can be characterized in the frequency domain with as a noise power spectral density (PSD), or in the time domain through the Allan variance.
Allan variance is a method to analyze the phase and frequency stability of oscillators and atomic clocks introduced by David W. Allan in 1966. This method converges even in presence of types of noises for which traditional variance does not converge to finite values, like flicker noise and random walk noise. For this reason, Allan variance has been adopted to identify the origin of noise contributions on the inertial sensors output, first for linear accelerometers, then for angular speed sensors.
For the latter type sensors the Allan variance is calculated from a sequence of output values, sampled at a frequency . From this sequence, a set of angles is calculated
which is equivalent to a weighted cumulative sum of the output vector. The Allan variance is then calculated from these angles
Using a square root it is possible to evaluate the Allan deviation. It is also possible to calculate the confidence interval for the estimated Allan variance assuming a distribution for the sample variance distribution.
It is shown that Allan variance is related to the two-sided power spectral density of the signal, in particular it is the noise PSD of the output signal from a filter with transfer function
that is a band-pass filter with pass-band determined by the cluster dimension of the Allan variance expression. It is then possible to separate the noise contributions by varying the time of integration, if the noise terms are supposed to be dominant in different frequency bands with respect to others.
Three main noise contributions are deduced from the logarithmic plot of the Allan deviation, depending on the slope and location of the curve sectors:
-
Angle Random Walk (ARW) represents the spectrum of the white noise and is constant with frequency; it is the noise density and it is tipically specified by the manufacturer. This contribution is represented as a -1/2 slope line on the plot, so the random walk coefficient can be read on the plot as the value of the Allan deviation in . It can be related to the variance.
-
Bias instability is a low-frequency noise component caused by flicker noise on the sensor output. It is shown on the Allan deviation plot as a 0-slope line.
-
Rate Random Walk is produced by brownian noise on the gyroscope output and can be related to bias slow variations.
Supposing that the noise contributions are statistically independent, Allan variance is their sum:
The MPU9250 gyroscope has been configured disabling the low-pass filter and with a full-scale range of 500 dps; the sampling frequency was set to 100 Hz. The x-axis output for a 12-hours sample collection is the following:
Considering a 68% confidence level, the Allan deviation plot is the following:
From this plot it is possible to evaluate all the noise contributions:
Repeating the same calculations, it is possible to evaluate the noise coefficients N, B, K for all sensor axes and characterize the sensor with the measured Allan deviation plot:
With these parameters it is possible to implement a Simulink model which can simulate the real sensor noise output. The resultant block also includes temperature instability:
Allan noise terms and other block parameters can be deduced from device datasheet or measurement analysis and configured in the block mask to emulate the real sensor:
The model output fits well the output of the real sensor and is suitable for sensor simulation in a model based control design approach.
- Application Note AN5087 Allan Variance: Noise Analysis for Gyroscopes , NXP Freescale Semiconductor, 2015
- Handbook of Frequency Stability Analysis, William J. Riley, Hamilton Technical Services, 2007
- David W. Allan’s website, http://www.allanstime.com/index.html
- Inertial Sensor Noise Analysis Using Allan Variance using MATLAB, Mathworks, https://it.mathworks.com/help/fusion/examples/inertial-sensor-noise-analysis-using-allan-variance.html