Skip to content

Simulink model for a MEMS angular speed sensor based on Allan deviation noise estimation

Notifications You must be signed in to change notification settings

alediclem/GyroscopeAllanSimulinkModel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Allan variance analysis and modeling of a MEMS gyroscope

End-course project for Misure ed Analisi Dati (Metrology and Data Analysis) @ University of Rome Tor Vergata.

Project summary

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.

Mathematical modeling

Gyroscope output is modeled as follows:

\boldsymbol{y}{\omega}(t) = M\boldsymbol{\omega}^b{b/i}(t)+\boldsymbol\beta_\omega^b(t) + \boldsymbol\nu_\omega(t)

where M is the disalignment matrix, \boldsymbol\nu_\omega(t) 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.

\boldsymbol\beta_\omega^b(t) is a bias term which can be assumed as a Wiener process (random walk process):

\dot{\boldsymbol\beta}\omega^b(t) = \mathcal{N}\left(0,\boldsymbol\sigma{\beta\omega}^2\right)

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

s\left(\bar{\beta}{\omega,y}\right)=\frac{s\left({\beta}{\omega,y}\right)}{\sqrt N}=0.014\text{dps}

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 2\sigma confidence level,

\beta_{\omega,y}=\left(-0.3421\pm 0.0279\right) \text{dps}

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.

Allan variance

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 \Omega[n] of L output values, sampled at a frequency \frac1{\tau_0}. From this sequence, a set of L angles is calculated

\theta[i]=\tau_0 \sum_{j=1}^i \Omega[j]

which is equivalent to a weighted cumulative sum of the output vector. The Allan variance is then calculated from these angles

\sigma_y^2(\tau)=\frac1{2\tau^2\left(N-2m\right)}\sum_{k=1}^{L-2m}\left(\theta[k+2m]-2\theta[k+m]+\theta[k]\right)^2

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 \chi^2 distribution for the sample variance distribution.

Noise terms identification

It is shown that Allan variance is related to the two-sided power spectral density of the \Omega(t) signal, in particular it is the noise PSD of the output signal from a filter with transfer function

H(f)=\frac{\sin^4(\pi f \tau)}{(\pi f \tau)^2}

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 N^2 (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 N can be read on the plot as the value of the Allan deviation in \tau=1. It can be related to the \boldsymbol\nu_\omega(t) variance.

  • Bias instability B 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 K 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:

\sigma^2(\tau)=\sigma_N^2(\tau)+\sigma_B^2(\tau)+\sigma_K^2(\tau)

Real gyroscope Allan variance

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:

Output Comparison

The model output fits well the output of the real sensor and is suitable for sensor simulation in a model based control design approach.

References

About

Simulink model for a MEMS angular speed sensor based on Allan deviation noise estimation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published