
Introduction
Sensors have widespread use in our daily life and play a pivotal role in modern-day IoT. These chips sense the necessary mechanical excitation and converts to electrical entity. We have sensors in our daily gadgets like smartphones, smartwatches, sports equipment, laptops and other IoT tools. The performance of these equipments is heavily dependent on the quality of the sensory chip that is installed inside. Sensors which are prone to catching noises and unnecessary signals can not provide precise result and eventually get out of the market. The competition is high in the sensor business for developing the top-notch chip that can effectively distinguish the signal from the noise.
In this article, I will go through a noise measurement process for MEMS sensors. MEMS stands for Micro-Electro Mechanical System. This branch of engineering deals with devices whose development requires both electrical and mechanical engineering knowledge. AVAR (Allan Variance) test is one of the many tests that check the noise performance of MEMS devices. It is named after American physicist David W. Allan. This test provides the noise performance of the device against time scale and interpretation of the AVAR curve is required to draw a conclusion if the device is noisy or not. Sometime instead of variance, deviation is used to plot the curves.
A sample Allan Deviation curve is shown below. This plot is particularly for clock’s frequency stability but one can measure any variable of interest over sufficiently long time to get these deviation curves. I will go through the interpretation of the Allan deviation plots in the later section.

Noise Measurement
The data is called noisy if the variance is too high. We all know of standard deviation or standard variance which is formulated as below

If the data from the device consists of random spikes or dips, it will have high deviation and eventually it will be deemed as a noisy device. Sometimes, the noise is indistinguishable from the signal if the relative amplitude of the noise is similar to that of the signal. Usually, in MEMS sensors, the noise should be smaller than the real signal by order of magnitude. The first estimation of noise is therefore the deviation of the sample data that is collected from the device. Why don’t we stick with the standard deviation/variance? Why did we need a different kind of variation like Allan Variance?
For MEMS sensors, the developers are interested in long-term stability of the device parameter and for that reason, data is collected over a long period. It is common that the traditional standard deviation increases as the amount of data is increased and therefore, it makes little sense to utilize that deviation as a device performance parameter. We needed some kind of deviation parameter that will root on the device performance and not dependent on any data artifact [1].
Variations of Allan Variance
Allan variance has many variations of formulations. The most common is the overlapping Allan variance where the data points are taken into clusters with a certain number of overlapping with the subsequent group. Classic Allan deviation formula incorporates only two consecutive data points for the calculation. That’s why it is sometimes called two-sample variance.

But this approach has poor confidence. The most commonly used approach is the overlapping method formulated as below

In essence. this method collects data points and averages over m times the initial value of tau. For example, if 2 data points are averaged, the value of m will be 2. The minimum time difference between two consecutive data points is the initial tau.
Interpretation of Allan Deviation Curve
![Sample MEMS sensor AV curve [2]](https://towardsdatascience.com/wp-content/uploads/2021/07/1AbgJA8DF06mLt6dWCzlbEQ.png)
Let’s take a sample AVAR result as shown in the figure above. AV curves are usually plotted on log-log scale. The deviation initially increases and up to a certain point of time, it increases and then starts falling. The x-axis is the clustering time where the values represent the amount of time the data is grouped together. These clusters are averaged together to obtain the Allan deviation. The decline of the deviation is the result of averaging the data over time. The initial increase is attributed as the artifact of roll-off. In a short time span, we usually do not have a whole sample but we want to average. The deviation goes up at this point. This is the artifact of correlated sensor motions at very short time scales.
The initial time clusters are representatives of high-frequency noises. Since it is a log-log plot, the deviation quickly declines with the slope of negative half which essentially describes the presence of white noise. The lowest point in the curve is generally defined as "bias stability" which is viewed as a very critical noise parameter. The bias stability is usually expected to have within a certain upper limit and lower limit. Beyond this point sometimes deviation starts to increase indicating dominance of low frequency noise. This type of noise may be comprised of temperature effect, aging of device or other secondary effects. For many devices, if data is not collected for a sufficient amount of time, this rising trend can not be observed since it is a log-log plot. White noise zone is called Angle Random Walk (ARW) for gyroscope and Velocity Random Walk (VRW) for accelerometer. The random walk coefficient is sometimes obtained from the slope of the line at a required cluster time.
Python Implementation
There has been a significant effort to generate python packages to implement Allan variance by AllanTools developers. Here I will use this python package to implement Allan variance in a notebook environment. For demonstration, I have previously created a synthetic dataset using R language which I will use here.
The data is first converted to a list since the Allantools.oadev() method takes a list as an input.
Finally, this data is provided to the method to generate the AVAR curves on log scale.

Since this is a synthetic dataset, we do not see roll-off effect initially. The oadev() method takes the data with a sampling rate = 1 Hz. It returns the required taus and deviation values which are plotted. Usually, the sensors have multiple axes and parameters are examined in all the axes too as shown below

If we plot at the raw values, it will look something like below

Here we can see the temperature effect or other low frequency effects towards the end of the band of curves and the curves start going up indicating high deviations. Therefore we have a minimum point where the deviation is minimum and that averaging point is the most desired operating point.
When overlapping method is not used, the deviation becomes random.

Conclusion
This article demonstrates the use of Allan deviation/variance as a noise parameter in modern day sensor business. The interpretation of the Allan curves are described with the incorporation of Python tools. AllanTools package is deployed to plot Allan deviation curves. The synthetic dataset does not clearly show all the aspects of AV curves but real sensors will definitely demonstrate roll-offs and secondary effects.
Thanks for reading.
Reference
[1] D. W. Allan, "Time and Frequency (Time-Domain) Characterization, Estimation, and Prediction of Precision Clocks and Oscillators," in IEEE Transactions on Ultrasonics, Ferroelectrics, and Frequency Control, vol. 34, no. 6, pp. 647–654, Nov. 1987, doi: 10.1109/T-UFFC.1987.26997.
[2] Tanenhaus, Martin & Geis, Tim & Carhoun, Dean & Holland, Alex. (2010). Accurate Real Time Inertial Navigation Device by Application and Processing of Arrays of MEMS Inertial Sensors. 20–26. 10.1109/PLANS.2010.5507137.