Sandbox
 Sandbox Sensor Modeling Sensor Modeling Basics In order to prevent spam, users must register before they can edit or create articles.

## 1 Introduction to the Silicon Sensing CRG20 Sensor Model

The CRG20 sensor model example will follow the basic sensor model detailed below. I've picked Silicon Sensing's CRG29 primarily because they provided enough data to cover everything a basic sensor model should include.

The CRG20 is a MEMS sensor which means it is most likely small and low power. MEMS gyro operate on the principle of a vibrating proof mass whose average position is inertially static (mostly). The rate is sensed by measuring the current/voltage generated when the magnetic field of the housing (generated on the housing) moves relative to the intertially static proof mass. From here most vendors will condition the signal (clean up and filter) to provide the best possible performance. Sometimes the best performance means an extended bandwidth; sometimes it means less noise over the stated bandwidth; sometimes it means a more stable/linear output.

### 1.1 Sensor Modeling Basics

The following are the components of a basic sensor model.

1. Basic Linear Model
1. Transfer Function
2. Noise
2. Basic NonLinearities
1. Saturation
2. Quantization
1. Volts to Engineering Unit conversion
2. Cross-axis Sensitivity
3. Scale Factor changes (over temperature, frequency, etc.)

## 2 Silicon Sensing's advertised data for the CRG20

The data provided in Table 1 is current as of Dec. 1st, 2008.

Table 1: CRG20 (Digital) Sensor Parameters
Parameter Value Units

Bandwidth

55

Hz

Angular Random Walk

0.3

° / rt hr

Quiescent Noise

 0 to 10 Hz


0.06

° / s rms

 In band (55 Hz)


0.6

° / s rms

Cross-axis Sensitivity

< 2

%

Temperature (Operating)

-40 to +105

° C

Scale Factor

0.03125

°/s / bit

Scale Factor Variation over Temperature

< +/- 1.2

%

Rate Range

+/- 300

° / s

## 3 Basic Linear Model for the CRG20

### 3.1 Transfer Function

For a sensor with a linear output - the ouptut voltage is proportional to measured rate - the typical sensor model begins with a transfer function. Vendors intentionally condition the sensor output with the goal of achieving a nice, clean, transfer function well represneted by a 1st or 2nd order system transfer function. Remember that

 $LaTeX: TF_{1}=\frac{\omega}{s+ \omega}$ 1st Order

 $LaTeX: TF_{2}=\frac{\omega^{2}}{s^2 + 2 \zeta \omega + \omega^{2}}$ 2nd Order

where

$LaTeX: \omega$ is the bandwidth,
$LaTeX: \zeta$ is the damping, and
$LaTeX: s$ is the Laplace variable.

The result of 2nd Order transfer function for a 55 Hz Bandwidth is presented in Figure 1.

Figure 1: CRG20 Transfer Function with 55 Hz bandwidth

#### 3.1.1 MATLAB code

The MATLAB code necessary for creating a 2nd order tranfer function with a 55 Hz bandwidth and a damping of 1 is

 >> w = 55 * (2*pi);  % 55 Hz converted to rad/sec
>> z = 1;
>> tf2 = tf([w^2], [1, 2*z*w, w^2]);


The code for creating the plot can be found on the MATLAB Bode Plot article.

### 3.2 Noise

Often during the early design phases the noise PSD is not available. Many vendors will provide a quiescent noise RMS. Typically this is modeled as a flat PSD. The RMS of the flat PSD between 0 and the vendor stated bandwidth equals the vendor specified quiescent noise RMS.

#### 3.2.1 Quiescent Noise

For this sensor the vendor specifies an RMS noise for 0 to 10 Hz and an in-band RMS (0 to the 55 Hz bandwidth). For simplicity I will be modeling the flat PSD with a single simple magnitude.

 $LaTeX: PSD_{mag} = \frac{RMS_{total}}{Bandwidth}$

where

$LaTeX: PSD_{mag}$ is the flat PSD magnitude in units^2 / Hz,
$LaTeX: RMS_{total}$ is the vendor specified in-band RMS, and
$LaTeX: Bandwidth$ is the vendor specified bandwidth in Hz.

In our particular example the RMS is provided in °/s so the PSD would be in (°/s)^2 / Hz.

In Simulink the flat PSD noise is produced using a Band-Limited White Noise block.

 Sensor Model, Band-Limited White Noise Noise Power $LaTeX: PSD_{mag}$ Sample Time $LaTeX: \frac{1}{Bandwidth}$ Seed Whatever you want

Coming soon...

## 4 Basic NonLinearities for the CRG20

There are a couple basic nonlinearities. Among them are saturation and quatization.

### 4.1 Saturation

Saturation is typically defined by vendor specification. For our example the values are found in Table 3.

 Sensor Model, Saturation Upper Limit +300 °/s Lower Limit -300 °/s Sample Time -1

### 4.2 Quantization

Quantization effects become important when required performance begins pushing the envelope of the sensor. It is also important when the number of bits provide only a coarse output measurement. Coarse is a subjective matter of performance vs. output.

 Sensor Model, Quantization Gain (Scale Factor) 0.03125 °/s / bit Sample Time -1

## 5 Additional Linear Elements for the CRG20

### 5.1 Engineering Units to Volts

The Silicon Sensing CRG20 has a digital output. The Least Significant Bit (LSB) has a value of 0.03125 °/s. So in this case, the downstream model would pass the output around in bits rather than volts.

### 5.2 Cross-axis Sensitivity

Most sensors have some cross-coupling from one axis to another. Think of it as bleed over. For the CRG20 the vendor specification is that corss-axis sensitivity is less than 2%. So consider the scenario where the motion is exclusively in the x-axis, worst case is that 2% of the x-axis motion will bleed over into the y or z axes.

For cross-axis sensitivity I typically use a gain block with using the Multiplication setting of Matrix(K*u). The matrix in this case is a 2x2 where the diagonal elements are 0.98 and the off-diagonal elements are 0.02. The code is

 >> K = [0.98, 0.02 ; 0.02, 0.98];


### 5.3 Scale Factor changes (over temperature, frequency, etc.)

The stated scale factor change over temperature is less than 1.2%. This is as simple as a change in sensor gain. The sensor response can be defined using a state-space or transfer function object. You can change the gain of the response with a gain change to either object. I find it easier to put a gain block downstream of these objects just upstream of the Quanitzation block. The gain for these blocks is simple and can be any value between 0.988 and 1.012. What value between 0.988 and 1.012 constitutes the worst-case scenario depends on the system being modeled.

## 6 Full Simulink Model for the CRG20

Basic Sensor Model

The above image is a picture of a simple sensor model. For the CRG20 the gain block which converts the Measured Noisy Analog Rate to Measured Analog Rate in Volts would be replaced a scale factor variation. The cross-axis sensitivity gain block would need ot be added . It could added to either the input or output of the State-Space block with the same effect. The resulting model is below.

Silicon Sensing CRG20 Sensor Model