# Original Article

, Volume: 7( 1)## Experimental Sensor Characterization

- *Correspondence:
- Sands T , Department of Mechanical Engineering, Stanford University, USA,
**Tel:**+1-831-656-3954;**E-mail:**dr.timsands@stanford.edu

**Received:** December 12, 2017; **Accepted:** January 25, 2018; **Published:** January 30, 2018

**Citation:** Sands T. Experimental Sensor Characterization. J Space Explor. 2018;7(1):140.

### Abstract

Spacecraft use accelerometers to measure acceleration (changes in speed), so the spacecraft can know things like when it has fired its engines long enough. Thus, accurate modeling and characterization of the accelerometer are very important features of any space mission, especially since it involves fuel consumption (currently an unreplenishable asset in space). Accelerometers are particularly useful for guidance, navigation and control. Simple control algorithms begin by using the governing physics expressed in mathematical models for control, but usually more advanced techniques are required to mitigate noise, mismodeled system parameters, of unknown/un-modeled effects, in addition to disturbances. This research describes methods utilizing LabVIEW software and a myDAQ device, a low-cost data acquisition (DAQ) device that gives students the ability to measure and analyze live signals from Bosch BMA145 accelerometers, both signals and noise. Accelerometer characterization is key to the success of any space mission. This tutorial instructs the reader how to setup the experimental test hardware and characterize an accelerometer and then proceeds to analyze the noise, permitting the utilization of the accelerometer for free fall utilizing a novel algorithm that is a natural extension of the experiments used for accelerometer characterization and noise analysis.

### Keywords

Guidance; Navigation; Control; Sensors; Accelerometer; Characterization; Experimentation; Physics-based control; Free fall; Accelerometer; Noise; Fast Fourier transform; Bosch BMA145; Labview; My DAQ

### Introduction

Space system guidance and control algorithms need a source of systems states to function properly and the most common two sources (usually used in concert together) are state estimators and sensors. Which system model and sensor models should engineers choose? Astrom and Wittenmark described the techniques in their textbook on adaptive control [1]. Slotine [2,3] reveals adaptive control techniques that utilize system and sensor math models in their adaptive strategies can often make acceptable system identifiers. Fossen [4] subsequently improved Slotine’s technique with mathematical simplifying problem formulation and Sands [5-11,41] and Kim [6] developed further improvements to the algorithm based on Fossen’s problem formulation followed by Nakatani [12,13] and Heidlauf-Cooper [14,15], but alas these improvements were not revealed in time for publication in Slotine’s text. Troublingly, Wie [16] elaborated singularities that exists in the control actuation that can exacerbate or defeat the control design as articulated [17-21] and solved by Agrawal [22]. Lastly, Sands [23,24,39] illustrated ground experimental procedures and on-orbit algorithms for system identification, while this research article illustrates ground experimental procedures for sensor characterization.

Laboratory experiments often confound the best analytically derived algorithms. Noise is just one common reason, while many others arise unexpectedly from the hardware setup, source of electrical-current, etc. This paper gives a detailed step-by-step tutorial for the reader to use inexpensive myDAQ devices [25] and LabVIEW software to build a “virtual instrument” that can be used to characterize an accelerometer for comparison to the products spec sheet. The experiments lead to a very natural ability to perform noise analysis and inspires a novel new algorithm for free fall detection that is favorably compared to recent research [26] and patents [27].

### Materials and Methods

**Build a virtual instrument (VI)**

The goal is to acquire two signals simultaneously, but LabVIEW nominally only lets you have one "DAQ Assistant" virtual instrument (VI) that takes analog inputs. The main task of Part 1 is to configure LabVIEW to read in the two signals with the single DAQ Assistant block and then separate them to do analysis on them separately. NI ELVISmx Instrument Launcher was used to output 3.3V to the myDAQ. AGND was connected to the myDAQ multimeter COM port and AO?0 was connected to the multimeter HI port, making 3.3V visible on the DMM. Henceforth, the myDAQ provides a 3.3V power supply for the lab. The black wire was connected to AGND, the red wire to AO?0 and two of the 3 other wires to AI?0+/AI?0?. AGND, AI?0? and AI?1? were shorted together so that the signals were all referenced to AGND.

Next, labVIEW was opened and a DAQ Assistant block was placed on the block diagram. Select Acquire Signals, Analog Input, then Voltage, then Channel 0 ("ai0”). The range was set from -10 to 10, differential configuration. The sampling frequency was set to 1000 Hz and to acquire 100. Next, to add another channel of analog input (still within the DAQ Assistant dialog box), I clicked on the blue plus-sign above the channel list and chose channel "ai1" this time. This adds another channel to the channel list. The range was set to -10 to 10 V, again in differential configuration.

Output: the directed-output of this task is to take a screenshot of the two signals on the superimposed graph. **FIG. 1** displays the results of the first attempt to display the two signals (3.3V and 5V respectively). Notice the lack of grounding produced oscillations associated with the power source. This was initially confounding, because the hardware was assembled properly, but the reason for improper grounding was not apparent.

The results of the second attempt are depicted in **FIG. 2**. Unable to deduce the reason for lack of grounding, route-cause may be sought by disconnecting the 3.3V signal’s ground wire from the myDAQ and instead connecting it to the power supply’s ground, which eliminates the oscillations in the 3.3V signal. Since that works, the issue in this instance described here resides somewhere in the myDAQ ground, so next disconnect the remaining ground wire (for the 5V signal) and connect it to the ground of the power supply to eliminate both oscillations finally yielding the proper output for this calibration as depicted in **FIG. 2**.

Next, we want to separate the two wave forms, so we can manipulate them separately in labVIEW. Create a "Select Signals" block (under “Express” and "Signal Manipulation" on the functions palette of the Block Diagram); and then click “OK” on the dialog box that comes up without doing anything. Next, wire-up the output of the DAQ Assistant block to the Select Signals block and run the virtual instrument (VI). This tells the Select Signals block what channels the DAQ Assist block is outputting. Double-click on the “Select Signals” block (or right-click and go to Properties) and then move the first channel ("Voltage") from the "Unselected Signals" side to the "Selected Signals" side. Close the dialog box and connect a waveform graph to the output of the Select Signals block and then run the virtual instrument again. Only the signal that came in on the ai1 channel should be visible on the output of the Select Signals block.

Repeat the process to create another Select Signals block that isolates and displays the signal coming in on ai0. The only thing done differently is which of the signals was selected within the dialog box. The y-axis scale was adjusted as necessary to get a cleaner graph. Our goal is to see results as depicted in the screenshot in **FIG. 3**.

**Connect BMA145 accelerometer**

Next, tape the BMA145 accelerometer in **FIG. 4** (left) onto the tilt-module (right). Connect the accelerometer to the myDAQ according to the schematic in **FIG. 4** (center) from the “BMA145 Datasheet.pdf” [28] depicted in **FIG. 5**.

The supply voltage (Vdd) for the accelerometer should be set at 3.3V. Per the BMA145Datasheet, anything higher than 3.5V will exceed the accelerometer’s design. From the many pins in the accelerometer, only Xout, Yout and Zout will be used. In this instance two of these outputs were connected (Zout plus one of the others, depending on how the tilt-module is setup they are marked XZ or YZ) to the connector block to the pins corresponding to analog input channels in myDAQ. The accelerometer datasheet and the board schematic (**FIG. 5**) describe the pin layout. In the DAQ Assist block that interfaces with the input, set the sampling frequency to 10 kHz and “data taken” for 0.10 seconds. Since the accelerometer only outputs between 0 and 3.3 V, Channel ai1 was safely set to these limits. Channel ai0 was set to have a similar range (identical in this case).

The datasheet for the accelerometer helps you set the Y-range on your graph to match the expected minimum and maximum outputs of the accelerometer. The key orientation figure and data table are taken from the datasheet and depicted in **FIG. 6**. The output voltage (X_{out}, Y_{out} and Z_{out}) of the accelerometer will be accessible within LabVIEW on the two different ai channels created earlier. Add time-domain graphs to the output of the DAQ assistant blocks, visible in the left-hand **FIG. 7**. The graph on the top contains both signals, while the two bottom graphs contain the disparate single signals.

Next, obtain data at various rotation angles of the tilt-module. A description follows for taking data at two different orientations to reconcile the experiment (**FIG. 8**) with the orientation information provided in the datasheet (**FIG. 6**). If the tilt-module had been lying flat, so the accelerometer was more similar to the datasheet depiction, you would expect one of the two measured signals (X/Y) to be on the order of 1.5V, while the other signal (Z) should’ve been on the order of 1.8V. Instead, the orientation of the tilt-module here is more akin to the datasheet’s [4] orientation where the gravity vector is perpendicular to the upper depiction of **FIG. 6**. Thus, neither channel (X/Y and Z) was optimally oriented to measure the gravity vector.

**FIG. 8** and **FIG. 9** show signal zero plotted two different ways. First the plots were called in labVIEW, but the raw data was also exported to excel and plotted (so the data can be easily saved for other potential analysis). Similarly, **FIG. 10** and **FIG. 11** depict signal one data, again noting that we don’t see the gravity signal present due to this first orientation of the tilt-module (**FIG. 7**). Next, the accelerometer should be laid flat by rotating the tile module ninety degrees (**FIG. 12**) to align the gravity vector to be measured as signal 1 (look again at the top part of **FIG. 6**. to recall the orientation stated in the datasheet that should now contain a signal from gravity). Signal zero remained just above 1.65V while signal one now has a signal on the order of 1.97V produced by the acceleration of gravity.

**FIG. 13**. shows signal zero plotted in excel and similarly, **FIG. 14** depicts signal one data, again noting that now we see the gravity signal is present since we rotated the tilt-module.

**Characterize the BMA145 accelerometer**

The final characterization task is to take data points at various angles to determine the 0G bias voltage and sensitivity for each axis; and then compare these to the values found in the datasheet [29]. In particular, two plots showing the acceleration in two of the three dimensions (X and Z, or Y and Z) versus rotation angle. One way to do this is to record angle values and output voltage values from the sensor in excel and make a plot. Additionally, the 0G bias and sensitivity for two of the three X, Y and Z axes will be calculated; and finally, the source of cross-axis sensitivity can be described.

First, note in **FIG. 15** the example of signal 1 (z-direction) when the rotation angle in ninety degrees (orthogonal to the gravity vector thus the only signals present are the bias and noise). Taking the mean of this signal reveals the bias, which is depicted in the plot, while the noise bounces around the mean (or bias).

Rather than produce plots like **FIG. 15** to find the means for every experiment, modify your labVIEW file (see **FIG. 16**) to automatically output the signal mean, μ for each experiment. Then simply iterated the rotation angle and record the means in an excel spreadsheet (**FIG. 17** and **FIG. 18**).

Next, implement equation 1 “No-bias Signal, Vnb [30] to find the no-bias signal (which should contain the acceleration measurement plus noise). Anticipate near-zero, no-bias signal zero, while signal 1 should be near-zero at ± 90 degrees increasing to 1 g at zero degrees. Peaking at **FIG. 19**, these experiments behave accordingly. According to the BMA145 datasheet, “if the sensor is at rest or at uniform motion, in a gravity field according to” **FIG. 6** the output signals are ± 0 g for the X/Y channel and +1 g for the Z channel. This is indeed the results of equation 1 implemented in excel (**FIG. 17** and **FIG. 18**), so there is confidence the experiments were good. The datasheet said to expect sensitivity [30,31] roughly one-tenth of the supply voltage, so something on the order of 3.3/10=0.33 was expected as the measurement for 1 g per equation 2 “sensitivity”, which is very close to the calculation of roughly 0.32.

(1)

(2)

(3)

Sensitive is the change of output (voltage) per unit input (acceleration). From a zero-acceleration state, the change is therefore the voltage measurement divided by the acceleration, which is 1 g multiplied by the cosine of the rotation angle, ? per equation 2 and the results are displayed in **FIG. 17** and **FIG. 18**. Carefully note there is a cosine in the denominator of equation 2, so when the rotation angle is ± ninety degrees, this equation is ill-defined, which we see in **FIG. 20**. As we get away from ninety degrees, we see normal behavior and the accelerometer’s sensitivity is very roughly within spec for much of the experiments, certainly performing towards the lower end of advertised sensitivity. Furthermore, the datasheet stipulates that the expected sensitivity will vary ± 4% establishing the upper and lower bounds depicted in **FIG. 20**.

**Note on cross axis sensitivity**

Cross-axis sensitivity is sensitivity to accelerations in orthogonal axes. According to both analog.com’s and Bosch’s websites, cross-axis sensitivity is typically caused by alignment errors, etching inaccuracies and circuit crosstalk. We can calibrate it out by first restricting acceleration to one axis, noting the no-bias signal (should be zero, other than noise) present in the other axes.

Analog.com in particular is the source of the recent publication [26] by the authors of the recent patent [27,28] to be used for comparison.

### Results and Discussion

**Noise analysis**

The mean value of the voltage (acceleration measurement plus bias) was subtracted away leaving only the noise per equation 4 “noise calculation”. Next, the root mean square [32] of the noise was calculated per equation 5 (**FIG. 21**).

(4)

(5)

The 1-g voltage value can be calculated for comparison to the spec sheet by subtracting off the 0-g measurements (signal 1) which only contain the bias and the noise. The residual difference is theoretically only the gravity measurement signal which was averaged to find a mean value for measurement of 1-g (roughly 0.33 Volts).

The noise can also be evaluated via the Fourier Transform [33] (automated in labVIEW) depicted in **FIG. 22** with results depicted in **FIG. 23** and **FIG. 24** for the z-aligned and x/y-aligned directions respectively. Although this effort focuses on the z-direction measurements, the x/y-aligned measurements are useful, since they signal contains no acceleration measurement and therefore yield information about bias and noise.

**FIG. 22:** LabVIEW model for analyzing noise.

If the noise were white, there would be equal amounts of spectral content at all frequencies. In both z-aligned and x/y-aligned data, there is clearly more spectral content at low frequencies. This is intuitive, since it is difficult for physical motion to occur at higher-and-higher frequencies and this sensor measures motion acceleration. Naturally, this sensor is better at low frequencies.

Quickly noting the two figures, you can see that spectral content (spikes) are similar in both figures at some frequencies. Since the x-y aligned measurements contain no acceleration data, the spectral content can only be from sources other than acceleration (e.g. 60 Hz from the power lines in the building and spikes just below 2000 Hz, 3000 Hz, 4000 Hz and 5000 Hz could be acoustic noise pressure waves impinging on the accelerometer, recalling that pressure is force divided by area and force is mass times acceleration) [34]. Another potential noise source is the vibrations of the laboratory laptop on the table shared with the accelerometer.

**Data averaging**

One method for data averaging uses MATLAB [35]. To average the data, import it into MATLAB using the following MATLAB command: xlsread (filename, sheet, x1range) [36], which reads from the file named filename, choosing the particular sheet named sheet and reads data from the range specified by x1range.

Plot multiple data in “subplots” for clarity-of-comparison. Individual figures for the five cases of bins were first plotted in **FIG. 25** to **FIG. 27**. Next, execute a loop in MATLAB that calculates the running-average over a variable amount of data: 100, 300, 1000, 3000 and 10000 measurements. Then root-mean-square RMS values can be calculated for the averaged data and the binsizes cane be converted to bandwidth per equation 6 (bandwidth related to bin-size) [37,38], resulting in **FIG. 25**.

(6)

Also, in **FIG. 25**, the theoretical noise level is displayed. The sensor’s datasheet reflects noise. Thus, 175 μg was multiplied by the root of the bandwidth to yield the noise in [g]. Then, the value of volts corresponding to 1 g (z-channel minus x/y channel) was multiplied to yield the noise value in volts. This sensor seems to slightly exceed the noise spec. There are clearly some advantages to signal averaging, in particular reduction of noise (RMS). **FIG. 26** and **FIG. 27** demonstrate that increasing the bin-size (number of data points averaged) decreases the root-mean-square value of the noise. Equation 6 inversely-relates the bin-size to the bandwidth and thus **FIG. 25** reflects decreasing noise with decreasing bandwidth (or equivalently increasing bin-size). There are also disadvantages. Averaging a signal reduces the fidelity of the knowledge about the measured phenomenon.

**Free fall detection**

Having calibrated the accelerometer, the next paragraphs offer a novel algorithm (whose effectiveness evaluation is to be published in the sequel) in LabVIEW that can detect a free fall condition using the accelerometer data. Liao’s recent Patent [27] seeks to do the same thing and fortunately the Liao patent contains experimental data characterizing free fall acceleration and acceleration-rate data. This inspired my algorithm **FIG. 28** and **FIG. 29**. Display the experimental acceleration and acceleration rates respectively.

It is insufficient to monitor only the output of 2 signals, since that neglects one-direction of sensing. The patent restricts free fall measurement to a situation where free fall is always preceded by a rollover condition. In order to detect free fall that doesn’t necessarily follow a rollover, we’ll need to monitor all three directions. Non-ideal parts of this initial setup include differentiation of noisy signals. This is a horrible practice and requires further signal processing actions to mitigate noise. Clearly, if we had only relied upon acceleration-rate measurements, we could have many false-positives. My implementation of the combined-use of acceleration and acceleration-rate is a good start, but noise-mitigation should be pursued further, e.g. signal averaging [35], Kalman Filter, etc.

### Conclusion

This paper gave a lengthy tutorial for real-world laboratory calibration of a BMA145 accelerometer utilizing LabVIEW software and a myDAQ device, a low-cost data acquisition (DAQ) device to create “virtual instruments”. After accelerometer characterization, noise analysis is demonstrated; after which a novel supplement algorithm is introduced to detect free fall distinguishable from static conditions, when compared to a recent patented technique. Accelerometer characterization is key to the success of any space mission. Spacecraft use accelerometers to measure acceleration (changes in speed), so the spacecraft can know things like when it has fired its engines long enough. Thus, accurate modeling and characterization of the accelerometer are very important features of any space mission, especially since it involves fuel consumption (currently an unreplenishable asset in space). Accelerometers are particularly useful for guidance, navigation and control. Simple control algorithms begin by using the governing physics expressed in mathematical models for control, but usually more advanced techniques are required to mitigate noise, mismodeled system parameters of unknown/un-modeled effects, in addition to disturbances, permitting challenging space mission accomplishment [41].

### Conflicts of Interest

“The authors declare no conflict of interest."

### References

- Astrom K, Wittenmark B. Adaptive Control. 2nd ed. Addison Wesley Longman, Massachusetts; 1995.
- Slotine J, Benedetto M. Hamiltonian adaptive control of spacecraft. IEEE Trans Auto Control. 1990;35(7).
- Slotine J, Li W. Applied Nonlinear Control. Pearson Publishers, Chapter 8; 1990.
- Fossen. Comments on Hamiltonian adaptive control of spacecraft. IEEE Trans Auto Control. 1993;38(4).
- Sands T. Fine Pointing of Military Spacecraft (Ph.D. Dissertation). Naval Postgraduate School, Monterey, USA; 2007.
- Kim J, Sands T, Agrawal B. Acquisition, tracking and pointing technology development for bifocal relay mirror spacecraft. SPIE Proceedings. 2007;6569:656907.
- Sands T, Lorenz R. Physics-Based Automated Control of Spacecraft. Proc AIAA Space 2009 Conference Exposition. Pasadena, USA; 2009.
- Sands T. Physics-based control methods. In: Advancements in Spacecraft Systems and Orbit Determination. Rijeka: In-Tech Publishers; 2012:29-54.
- Sands T. Improved magnetic levitation
*via*online disturbance decoupling. Phys J.2015;1(3): 272-80. - Sands T. Nonlinear-adaptive mathematical system identification. Computation. 2017;5(4):47.
- Sands T. Phase lag elimination at all frequencies for full state estimation of spacecraft attitude. Phys J. 2017;3(1):1-12.
- Nakatani S, Sands T. Autonomous damage recovery in space. Internat J Auto Control Intell Syst. 2016;2(2):23-36.
- Nakatani S, Sands T. Simulation of spacecraft damage tolerance and adaptive controls. IEEE Aerospace Proceedings. Big Sky, MT, USA; 2014.
- Heidlauf P, Cooper M. Nonlinear Lyapunov Control Improved by an Extended Least Squares Adaptive Feed Forward Controller and Enhanced Luenberger Observer. Proceedings of the International Conference and Exhibition on Mechanical & Aerospace Engineering, Las Vegas, USA; 2017.
- Heidlauf P, Cooper M, Sands T. Controlling chaos – forced van der Pol equation. Mathematics. 2017;5(4):70.
- Wie B. Robust singularity avoidance in satellite attitude control. U.S. Patent 6039290 A; 2000.
- Sands T, Kim J, Agrawal B. 2H Singularity-Free Momentum Generation with Non-Redundant Single Gimbaled Control Moment Gyroscopes. Proceedings of 45th IEEE Conference on Decision & Control; 2006.
- Sands T. Control moment gyroscope singularity reduction
*via*decoupled control. IEEE SEC Proceedings; 2009. - Sands T, Kim J, Agrawal B. Non-redundant single-gimbaled control moment gyroscopes. J Gui Control Dyn. 2012;35(2):578-587.
- Sands T. Experiments in control of rotational mechanics. Internat J Auto Control Intell Syst. 2016;1(2):9-22.
- Sands T. Singularity minimization, reduction and penetration. J Numer Anal Appl Math. 2016;1(1):6-13.
- Agrawal B, Kim J, Sands T. Method and apparatus for singularity avoidance for control moment gyroscope (CMG) systems without using null motion. U.S. Patent 9567112 B1. 2017.
- Sands T. Experimental piezoelectric system identification. J Mekh Eng Auto. 2017;7(6).
- Sands T. Space system identification algorithms. J Space Explor. 2017;6(3).
- National Instruments website: https://decibel.ni.com/content/docs/DOC-11685
- Laio W, Zhao Y. Using dual-axis accelerometers to protect hard disk drives. Analog Dialogue. 2005:39-11.
- Laio W, Zhao Y. Accelerometer-based differential free fall detection system, apparatus and method and disk drive protection mechanism employing same”, US Patent 7,382,567 B2; 2008.
- http://www.datasheetarchive.com/
- https://www.digikey.com/product-detail/en/bosch-sensortec/BMA145/828-1002-1-ND/1987008 accessed Sept 2017
- Fraden J. Handbook of Modern Sensors, 4th ed. Chapter 5, Springer, New York; 2010.
- Fraden J. Handbook of Modern Sensors, 4th ed. Chapter 8, Springer, New York; 2010.
- Kenneth VC. Determining the effective or RMS voltage of various waveforms without calculus. Technology Interface. 2007;8(1).
- E Titchmarsh. Introductionto the theory of Fourier integrals. 2nd ed. Oxford University: Clarendon Press; 1948/1986.
- http://cudl.lib.cam.ac.uk/view/PR-ADV-B-00039-00001/1 accessed Sep 2017.
- https://www.mathworks.com/help/search.html?qdoc=data+averaging&submitsearch
- https://www.mathworks.com/help/matlab/ref/xlsread.html?searchHighlight=xlsread&s_tid=doc_srchtitle
- Kalman RE. A new approach to linear filtering and prediction problems. Trans ASME J Basic Eng. 1960;82 (Series D):35-45.
- http://www.ni.com/white-paper/2709/en/
- Sands T, Kim J, Agrawal B. Singularity Penetration with Unit Delay (SPUD). Applied Mathematics. 2018:6(1).
- Sands T. Space Mission Analysis and Design for SEAD. Designs. 2018;2(1).
- Sands T. Analysis, Correlation, and Estimation for Control of Material Properties”, J Mech Engn Auto. 8(1);2018.