MEMS accelerometers and gyroscopes - we understand the specification
“Houston, we have problems,” sounded tiredly in a brain trying to wade through the Datasheet IMU MPU-9250 from InvenSense at night. When all words are separately understood, but their interrelation is confused to impossibility. It all started with the LSB parameter, about which I only vaguely remembered that the translation is Least Significant Bit. Then went “Resolution”, “Sensitivity”, and even further I realized that the resulting text can already be titled “Datasheet for dummies”. It is a little about the main blocks of the inertial module.
MEMS gyro
The MPU-9250 consists of three independent uniaxial vibration angular velocity sensors (MEMS gyroscopes) that respond to rotation around the X, Y, and Z axes. Two suspended masses oscillate in opposite axes. With the advent of angular velocity, the Coriolis effect causes a change in the direction of the vibration ( vecFK=−2m[vecomegatimesvecvr] which is fixed by a capacitive sensor. The measured differential capacitive component is proportional to the displacement angle [Electronics Time]. The resulting signal is amplified, demodulated and filtered, resulting in a voltage proportional to the angular velocity of rotation. This signal is digitized using a 16-bit ADC integrated into the board. The sample rate can programmatically vary from 3.9 to 8000 samples per second (samples per second, SPS), and user-defined low-pass filters (LPF) provide a wide range of possible cut-off frequencies. A low-pass filter is needed, including to remove vibrations from the motors (usually above 20-25 Hz).
Three-axis MEMS accelerometer
For each axis, it uses a separate test mass, which is displaced when acceleration occurs along this axis (fixed by capacitive sensors). The architecture of the MPU-9250 reduces exposure to temperature drift and variations in electrical parameters. When the device is located on a flat surface, it will measure 0g along the X- and Y-axes and + 1g along the Z-axis. The scale factor (scale factor) is calibrated at the factory and does not depend on the supply voltage. Each sensor is equipped with an individual sigma-delta ADC (consists of a modulator and a digital low-pass filter, for more details about the device in [Easyelectronics]), the output digital signal of which has an adjustable measurement range. ')
And immediately about the three-axis MEMS magnetometer
Based on high-precision Hall effect technology. Includes magnetic sensors that determine the earth's magnetic field strength along axes, a control circuit, a signal amplification circuit, and a computational circuit for processing signals from each sensor. Each ADC has a resolution of 16 bits, the measurement range pm4800muT . To measure weak magnetic fields, use either a unit in the SI system of microtesla (µT) or gauss (G, CGS system): 1Gs=100muTl , [Radiolotsman]).
So, what is LSB and how to calculate it? Mining instructions
Let's say our accelerometer is now working in the measurement range Fs=pm2g , that is, the full range of possible values will be 2cdotFS=4g . The corresponding voltage values are digitized by a 16-bit ADC, which can split the entire interval as much as possible into 216=$6553 steps. The minimum increment that can be detected is just one step. LSB=2cdotFS/65536 . Here we must remember that the account is conducted from scratch, so that in fact the maximum measured value will be 2cdotFStrue=(216−1)∗LSB=65535∗LSB=2cdotFS−LSB . That is, the larger the bits in the digital word ADC or DAC, the smaller the discrepancy will be. In this case, the sensitivity (sometimes called the scale factor, the sensitivity scale factor) of a sensor on a specific range will be determined as the ratio of the electrical output signal and the mechanical effect. Traditionally indicated for a signal frequency of 100 Hz and temperature T=+25circC. For the MPU-9250, the sensitivity is 216/(2cdotFS) steps for every g or circ/s ( Lsb/g , Lsb/(circ/s) ), for another IMU, BMI088 from Bosch Sensortec, the sensitivity of the gyroscope is calculated in the same way, and for the accelerometer it is used (216−24)/(2cdotFS) steps on each g.
The FS options are taken out of the specifications for gyroscopes and, in order not to get up twice, accelerometers.
I took FS for accelerometers also from the BMI088 documentation (see below).
Gyroscope, 16 bits (2N=65535)
Accelerometer, 16 bits (2N=65535)
Range (FS) circ/s (dps)
LSB, circ/s (dps)
Range (FS), g
LSB mg
pm125 (Fs = 250)
0,004
pm2 (Fs = 4)
0.06
pm250 (Fs = 500)
0,008
pm3 (Fs = 6)
0.09
pm500 (Fs = 1000)
0,0015
pm4 (Fs = 8)
0.12
pm1000 (Fs = 2000)
0.03
pm6 (Fs = 12)
0.18
pm2000 (Fs = 4,000)
0.06
pm8 (Fs = 16)
0.24
pm12 (Fs = 24)
0.37
pm16 (Fs = 32)
0.48
pm24 (Fs = 48)
0.73
Everything seems to fall into place, you can go on. In some cases (below, for example, a clipping from the documentation for BMI088), a parameter such as resolution (Resolution) is separately indicated.
In fact, it seems, it turns out that it should be LSB. But why, then, do we see one value instead of several tied to specific ranges? I had to expand the list of investigated sources in search of answers.
What is resolution?
The minimum value that the sensor reliably sees is extremely important when trying to strike a balance between price and performance. This is not an accuracy - a high-resolution sensor may not be very accurate, as well as a low-resolution sensor in certain areas may have sufficient accuracy. Unfortunately, LSB only defines a theoretical minimum distinguishable value, provided that we can use all 16 bits of the ADC. This resolution is in the digital world. In analog, some of the steps will be noisy and the number of effective bits will be less.
What are the characteristics of noise and where does it come from?
Noise sources can generally be broken down into electronic noise schemes that convert motion into a voltage signal (Johnson thermal noise, shot noise, pink 1 / f flicker noise, etc.) and thermal mechanical (Brownian, due to the presence of small moving parts) from the sensor itself. The characteristics of the latter will depend on the resonant frequency of the mechanical part of the system. f0 (natural frequency of oscillation of the sensor omega0=2pi/f0 ).
RMS value of noise in the entire spectral range - Total RMS (Root mean square) Noise
Noise levels can be determined in several ways. You can consider them in the time or frequency domain (after the Fourier transform). In the first case, the residual noise is taken as the rms value of the signals from the fixed sensor (in fact, this is the standard deviation for the sample at overlinex=0 ) for a certain period of time:
xRMS=sigmaX=sqrtsumni=1(xi−overlinex)2overn−1
Accelerations or angular rotational speeds below the level of broadband noise will be indistinguishable - that’s the actual resolution. The rms value of the ac voltage or current (often referred to as effective or effective) is equal to the magnitude of the constant signal, the effect of which will do the same work in an active (resistive) load during a period. This approach is most effective in estimating broadband noise where white noise dominates.
For white noise, the ratio of the amplitude (instantaneous peak value) to the root mean square with a probability of 99.9% is NPP/NRMS=6.6. Such an attitude is called the cross-factor (crest factor, cross ratio). You can choose the probability of 95.5% - the cross factor will be equal to 4.
In fact, noise signals do not behave so well and may produce peaks that increase the cross factor up to 10 times. Some specifications may contain values. NPP or the multiplier itself.
In the narrow low-frequency band of 0.1–10 Hz, the main role is played by the flicker noise “1 / f”, which is estimated using the peak-to-peak signal noise.
Spectral density
Sometimes it is more convenient to consider a signal in the frequency domain, where its description is called a spectrum (dependence of amplitude and phase on frequency). One of the possible noise characteristics in the specifications is called power spectral density of noise (PSD), noise spectral density, noise noise density, or simply noise density ). Describes the noise power distribution over a range of frequencies. Regardless of the representation of the electrical signal through the current or voltage, the instantaneous power dissipated in the load can be normalized (R = 1 Ohm) and expressed as p(t)=nu2(t)/R=i2(t)R=x2(t). Average power dissipated by a signal over a period of time (−T/2,T/2),
PTx=frac1TintT/2−T/2x2(t)dt.
Power - the rate of energy intake. Through the energy determined and non-periodic signals. Periodic and random signals are expressed in terms of power, since they are not limited in time and, accordingly, energy, while at any time their average power is non-zero.
Px=limTtoinftyfrac1TintT/2−T/2x2(t)dt.
One may recall [Sklyar] that an arbitrary periodic signal is expressed through a combination of an infinite number of harmonics with increasing frequencies:
The amplitude and phase spectrum is called dependency graphs. |cn| and thetan on frequency. Power spectral density Psd(f) periodic signal x(t) gives the distribution of signal power over the frequency range:
Psd(f)=suminftyn=−infty|cn|2delta(f−nf0)
and has dimension [W/Hz]=[x2/Hz]. The average normalized power of the actual signal will be
Px=intinfty−inftyPSD(f),df.
Non-periodic random signals (in particular, noise) can be described as periodic in the limiting sense. If a T0 tends to infinity, the sequence of pulses turns into a separate pulse x(t) , the number of spectral lines tends to infinity, the spectrum graph turns into a smooth frequency spectrum X(f). For this limiting case, you can define a pair of Fourier integral transforms
X(f)=intinfty−inftyx(t)e−i2pift,dt
and
x(t)=intinfty−inftyX(f)ei2pift,df,
Where X(f) - Fourier-image.
The spectral power density of a random signal is determined through the limit
PSD(f)=limTtoinftyfrac1T|XT(f)|2.
and describes the distribution of signal power in the frequency range.
Since we assume that the average for the white noise of the sensors in a stationary state is zero ( overlinex=overlinex2=0 ), then the square of the rms value is equal to the variance and represents the total power in the normalized load:
We look in the specification - in fact, under the name of the spectral density is indicated the square root of it with the corresponding dimension [circ/s/sqrtHz] or [mug/sqrtHz]. That is, the RMS value of the noise without specifying the frequency band on which it was considered (Bandwidth) is meaningless.
A little more about the choice of bandwidth
At the output of the MEMS sensor, we receive signals of different frequencies. It is assumed that we have in advance some idea of the processes we are measuring. For example, when determining the acceleration vector of a drone, the noise is the vibration of the apparatus. You can separate them from the useful signal using a low-pass filter, which cuts off all frequencies above that specified (for example, 200 Hz). The MPU-9250 provides the ability to adjust the cut-off frequency of the low-pass filter using the parameter with the magic name DLPFCFG . It stands for Digital Low Pass Filter Configuration. Further, in the specification, here and there, no less mysterious type expressions (DLPFCFG = 2, 92Hz) surfaced, but after decoding, I had to go into another document, “Register Map and Descriptions”. It shows which sets of bits in which registers need to be written to achieve the desired effects:
Omitting the technical details of the configuration, we can say the following. This sensor provides custom filtering of the readings not only of accelerometers, gyros, but also of the temperature sensor. For each, there are a total of 7 to 10 modes characterized by such concepts as Bandwidth in Hz, delay in ms, sampling frequency (Fs) in kHz.
The column “Noise density” was added to the accelerometer filter mode table in mug/rtHz=mug/sqrtHz , and the “Bandwidth” column is supplemented with the value of “3dB”.
It did not get any easier, so let's go straight through the list.
The legacy of ancient Rome
Sample rate + decimationDeltaSigma-ATP = data update rate (digital output data rate, ODR)
With the sampling frequency (the same sampling frequency), everything is clear - this is the number of points of a continuous signal taken per second when the ADC is digitized. Measured in hertz.
F s = f r a c 1 d e l t a t
In order for the sample to get a value close to the peak signal amplitude, it is important to take the sampling frequency at least 10 times the frequency of the useful signal. The MPU-9250 offers three options: Fs = 32kHz, 8kHz, 1kHz.
But this absolutely does not mean that the signal at the output of the accelerometer or gyroscope appears with the same period.
If you take the same drones, everything rests on the struggle to reduce energy consumption, increase the speed of calculations and reduce the noise of the output data. You can lower the update rate at the output, allowing the internal algorithms to integrate the input information over a period of time. The RMS will decrease, but the bandwidth will also decrease (the sensor will be able to detect only those processes whose frequency will be less than 50% of the data update rate).
It is better to immediately recall the Kotelnikov theorem . It promises that when sampling an analog signal, you can avoid information loss (that is, restore the signal without distortion) if the frequency of the useful signal is no more than half the sampling rate, also called the Nyquist frequency . In practice, a classic anti-aliasing filter (a low-pass filter that reduces the contribution of side frequency components in the output signal to negligible levels — GOST R 8.714-2010) requires in most cases a difference of at least 2.5 times [Siemens].
For Fs = 32kHz, the Nyquist frequency will be 16kHz. In this case, the useful signal is unlikely to go beyond the band fa = 20Hz (very few people can change the direction of movement more often 20 times per second). In total, the sampling frequency is much higher than the frequency required for storing the information contained in the fa band (40 Hz, 400 times higher), that is, the useful signal is over-sampled. The band between the fa and fs-fa frequencies does not contain any useful information. You can reduce the sampling rate (in the diagram this is done with the coefficient M, [7]), after thinning out the sequence of samples (samples). This process is called decimation .
According to the specification for the MPU-9250, accelerometers are equipped with a sigma-delta ADC . Schemes based on it consume minimal power. It should be noted that the bandwidth of these converters is very narrow, does not exceed the audio range [Easyelectronics], but for a standard quadcopter more is not needed. They consist of two blocks: S i g m a D e l t a modulator and digital low-pass decimation filter.
Why combine a low pass filter and decimation?
Honest excerpt from wiki:
If the original signal does not contain frequencies higher than the Nyquist frequency of the decimated signal, then the spectrum of the received (decimated) signal coincides with the low-frequency part of the spectrum of the original signal. The sampling rate corresponding to the new sample sequence is N times lower than the sampling rate of the original signal. If the source signal contains frequencies that are higher than the Nyquist frequency of the decimated signal, then aliasing (spectral overlap) will occur during the decimation.
Thus, to save the spectrum, it is necessary to remove frequencies from the original signal that are higher than the Nyquist frequency of the decimated signal before decimation. The specification for the MPU-9250 does not have a lot of information about the characteristics of DLPF, but you can find studies of enthusiasts [9].
Bandwidth, also known as frequency response
frequency range in which the sensor detects motion and provides a valid output signal. In some specifications, the frequency response of the sensor is given - the dependence of the electrical output signal of the accelerometer on external mechanical influences with a fixed amplitude but different frequencies. Within the passband, the non-uniformity of the frequency response does not exceed the specified one. In the case of applying a digital low-pass filter, the choice of bandwidth just allows you to change the cutoff frequency, inevitably affecting the speed of the sensor response to changes in position in space. The cut-off frequency must be less than half the digitization rate (ODR), also called the Nyquist frequency.
For MPU-9250 accelerometers, the bandwidth limit is determined so that within the range the spectral density of the signal differs from the peak (at 0 Hz) by no more than -3 dB.This level roughly corresponds to a drop to half the spectral density (or 70.7% of the peak spectral amplitude). Let me remind you that for energy values (power, energy, energy density), proportional to the squares of the field strengths, the ratio expressed in decibels
D P = 10 lg P 2P 1
. Bottom line: the signals passed through the low-pass filter are less noisy, they have better resolution, but with less bandwidth. Therefore, specifying the resolution in the specification without reference to the bandwidth does not make sense.
Back to resolution
In the specification for the MPU-9250, there is no resolution information in principle, for the BMI088, the resolution is represented by the digital resolution (LSB) and sensitivity. ”
You can estimate the resolution for each bandwidth by peak noiseNoisepk−pk=TotalNoiseRMS×CrestFactor=TotalNoiseRMS×4. The RMS value of the noise at the output is related to the spectral density specified in the specification (or rather, the root of it) and the equivalent noise bandwidth (equivalent noise bandwidth, ENBW) and the variance at the output, when acting on the inputs of white noise systems):
N R M S = P S D × √E N B W
And the noise bandwidth is related to the 3dB band coefficients corresponding to the order of the low-pass filter:
E N B W = 1.57 ⋅ f 3 d B for the 1st order
E N B W = 1.11 ⋅ f 3 d B for the 2nd order
E N B W = 1.05 ⋅ f 3 d B for the 3rd order
E N B W = 1.025 ⋅ f 3 d B for the 4th order
Judging by the research in [MPU9250_DLPF], our selection is 1.57. The obtained rms value takes into account the contribution of white noise (there is no quantization noise or mechanical noise). For example, for an accelerometer, the calculated value forB W = 99 H z , P S D = 300 μ g / √H z is obtainedN R M S = 4 m g . At the same time, the specification specifies the full root-mean-square noise T o t a l R M S N o i s e = 8 m g . The discrepancy is significant. Unfortunately, it is indicated only for one band, and for the BMI088 accelerometer only PSD is indicated in the specification. So we will use what we have. Cross-factor take 4. Now the most interesting. AttitudeF S / N o i s e p k - p k will give an approximate order of effective bits on a given measurement range, which is well below the 16-bit resolution of the ADC.
MPU-9250
BMI088
Gyroscope
NTotalRMS=0.1∘/s(BW=92Hz)
NRMS=0.1∘/s(BW=47Hz)
PSD=0.01∘/s/√Hz
PSD=0.014∘/s/√Hz
BW,Hz
NRMS,∘/s−rms
NPP,∘/s
BW,Hz
NRMS,∘/s
NPP,∘/s
523
0.41
1.6
250
0.2
0.8
230
0.27
1.1
184
0.17
0.69
116
0.19
0.76
92
0.12
0.49
64
0.14
0.57
41
0.08
0.32
47
0.12
0.49
20
0.06
0.23
32
0.1
0.4
ten
0.04
0.16
23
0.09
0.34
five
0.03
0.11
12
0.06
0.25
Accelerometer
NTotalRMS=8mg (BW=99Hz)
PSDXY=160μg/√Hz
PSD=300μg/√Hz (Gyro off)
PSDZ=190μg/√Hz(gFS3g, Normal mode)
BW,Hz
NRMS,mg
NPP,mg
BW,Hz
NRMSXY,mg
NPPXY,mg
218.1
5.6
22
280
3.4
14
99
3.8
15
145
2.4
ten
44.8
2.5
ten
80
1.8
7
21.2
1.7
7
40
1.3
five
10.2
1.2
4.9
20
0.9
four
5.05
0.9
3.4
ten
0.6
2.6
420
7.8
31
five
0.5
1.8
1046
12.3
49
Delay (ms),
Out of the need to store variables in the internal buffer to divide the signal into different frequencies by the filter
Total The lower the cutoff frequency of the filter, the less noise in the signal. But here we must be careful, because at the same time the delay also grows. In addition, you can skip the useful signal [8].