Real estate is all about location, location, location. But where are we, exactly?
Just 25 years ago sailors found their position using some limited hyperbolic navigation systems like LORAN when near land, but when at sea they mostly relied on the centuries-old technology of observing the sun and stars. The advent of GPS meant completely untrained navigators could get their position to within a handful of feet in seconds, for less than the cost of a sextant. In the last few years, that technology has made its way into automobiles and even phones.
However, consumers want even more information. The Nintendo Wii® showed us that relative position and a device’s movement is often as important as absolute latitude and longitude. Though inertial navigation via gyroscopes has a long history, it has always been hideously expensive and suited only for the most specialized applications, such as guided missiles and large aircraft. But Microelectromechanical Systems (MEMS – also known as micro systems technology in Europe or micromachines in Japan) have reduced the size, weight, power requirements and costs to trivial levels.
MEMS pushed the semiconductor revolution into the world of sensors, with all of the attendant benefits from Moore’s Law. Costs have come down so much that these sensors have found roles in unexpected places. They are used to detect head impacts in football helmets. Some sense a car crash to unlock doors and deploy airbags, and others put a disk drive in a protected state when it experiences a high-g force shock. They can sense tilt in industrial equipment to warn of a safety violation. Some athletic shoes incorporate these products to log exercise activity. The holy grail of portable electronics today is power management to extend battery life, and a MEMS sensor can sense that a device is not being used, and put it into a sleep mode. By measuring rotation, it is possible to stabilize images in a camera or pair of binoculars. Vibration sensors are used to detect impending bearing failures, seismic events, or a security issue such as a window being broken. Tilt information is often used in cameras to detect the horizon, or in tablets and phones to detect orientation. The number and types of applications of MEMS sensors is limited only by the imagination. One can envision swarms of autonomous systems used to sense position and attitude, and indeed most drones do employ them today.
The different classes of MEMS sensors include:
- Accelerometers: An accelerometer detects change in position.
- Inclinometers: An inclinometer measures tilt, and is nothing more than a repurposed accelerometer.
- Gyroscopes: A gyro is an angular rate sensor. It detects rotation around one or more axis.
A MEMS accelerometer differs from integrated circuits in that a “proof mass” is machined into the silicon. Any displacement of the component causes this mass to move slightly according to Newton’s second law, and that change is detected by sensors. Usually the proof mass disturbs the capacitance of a nearby node; that change is measured and filtered.
Figure 1: Micromachined proof mass interleaved with capacitive sensors (Courtesy of STMicroelectronics).
Although it may seem counterintuitive, an accelerometer can sense the inclination (tilt) of a device – even when stationary. Since gravity is an acceleration of 1 g, tilt is proportional to the sine of the angle the accelerometer makes with the Earth’s gravitational field. Much better results can be had using two or more sensors oriented orthogonally to each other. Analog Devices’ application note AN-10571 is an excellent brief on the issues involved. STMicroelectronics’ AN31822 application note is another valuable reference on the subject.
The most important specification is the number of axis. The MEMS proof mass can measure one parameter in each available axis, so a one axis device can sense acceleration in a single direction. Three axis units return sensor information in the X, Y, and Z directions.
Almost uniquely among electronic components, it is extremely important to orient an accelerometer correctly on the PC board in line with expected acceleration forces (calibration, described later, can mathematically correct for installation errors on three axis units, but at the loss of some sensitivity).
Acceleration is always measured in ratios of the Earth’s gravity, at least when using and selecting these parts, and devices can be purchased with a range of ±1 g all the way up to ±500 g.
Resolution is intrinsically intertwined with range. Devices with digital outputs are rated in g/LSB or counts/g. For instance, VTI Technologies’ SCA3060-D01 has a range of ±2 g and gives 1000 counts/g, which works out to 1 mg/LSB. Even more impressive, Freescale’s MMA8450Q is a three-axis unit with 14 bits of resolution over selectable ±2 g, ±4 g or ±8 g ranges.
Figure 2: Block diagram of the sub-$2 MMA8450Q accelerometer (Courtesy of Freescale Semiconductor).
Some devices give tilt resolution. Analog Devices’ ADXL312 provides 2.9 mg/LSB in acceleration mode and can detect inclination changes of 0.25 degrees. Oversampling using the built-in FIFO can improve that by a factor of five.
However, these devices are less perfect than we are accustomed to when selecting parts. A small misalignment between the silicon and the package will skew the results. Package alignment errors are usually one degree or less; if that is too much, you will have to include a calibration procedure in your product.
Another alignment problem creates cross-axis sensitivity. That is, an input in one axis may be partly sensed in another. Analog Devices’ very inexpensive ADXL337 has ±1 percent cross-axis sensitivity. Other parts can exhibit up to ±5 percent. If this is an issue, remove the error via calibration.
A further imperfection is called zero g bias level, or offset. This is the reading the sensor provides with no acceleration, and, unfortunately, that is rarely zero (in the Z direction it should be 1 g). In fact, the error can be substantial, frequently hundreds of times larger than the device’s resolution. The previously-mentioned SCA3060-D01 has 1 mg/LSB, but the offset can be ±200 mg. One can measure and subtract the offset or do a full calibration, but the offset is temperature dependent. The ADXL312’s offset temperature coefficient is ±0.8 mg/°C on the X and Y axis, and twice that on Z.
Some parts are factory-trimmed to remove the zero g bias, but even the stress imposed in soldering the package on a board can change that a little. STMicroelectronics’ LIS331HH is trimmed, but you may still find ±20 mg of offset.
Note that trimmed units have a startup delay as the sensor loads the parameters into its internal memory. STMicroelectronics’ LIS302DLTR, for instance, is a three-axis unit that requires about 3 msec to go from power-on to fully functional. Others may be substantially slower, so check the specs.
For high-accuracy applications you will need to calibrate each accelerometer to remove inaccuracies stemming from manufacturing imperfections, temperature variations, and installation issues. (In a tilt application, accuracies of more than a degree or so will require calibration.) For a three axis unit, one is measuring the following:
Equation 1: Measurement formula.
A is the corrected reading in X, Y and Z,
M is the 3 x 3 misalignment matrix,
S is the sensitivity of each channel,
R is the raw data from the accelerometer,
O is the accelerometer’s zero-g level.
The sensitivities and offsets are constants, so the matrix can be simplified to:
Equation 2: Simplified matrix.
The calibration process determines the values of the constant C. This is typically done using the least squares method, which is detailed in the previously-referenced AN3182 application note. Be aware, however, that calibration requires one to orient the production board in six different directions to let the software acquire data prior to running the least squares algorithm.
The classic view of a gyroscope as a rotating wheel – like a child’s top – does not apply to MEMS gyros. Instead, these use a tiny vibrating tuning fork. That “proof mass” tends to remain in its vibratory plane; rotation about any other axis will induce a small anti-force which can be detected by capacitive sensors; the electronics very closely mirrors that used by MEMS accelerometers.
But while accelerometers measure motion about the X, Y, and Z axis, gyros return information in roll, pitch and yaw coordinates. Most gyros return data about a single axis, but some sense two or three (an example of the latter is STMicroelectronics’ L3G4200D).
Figure 3: The three gyro axis (Courtesy of Analog Devices).
MEMS gyros are imperfect devices, exhibiting sensitivity to acceleration and vibration. Since they are under a one-g force from gravity in Earth-bound applications, tilting or moving a gyro can induce errors. Some designers compensate for these using measurements from an accelerometer, but vibration can swamp out such corrections. In applications where absolute rotation information is important (as opposed to relative), calibration may be necessary.
A gyro’s range, rated in degrees per second (dps), determines how much rotation the device can sense. Even inexpensive gyros have surprisingly good responses. For instance, STMicroelectronics’ LY3100ALH is rated for ±1000 dps, or about three revolutions per second, a sure nausea-inducer in a consumer device. Their LY3100ALH sports 1.1 mV/dps and a ±1000 dps range. To fully exploit its capability will require a 20-bit A/D converter.
Sensitivity is the measure of the change in output versus rotation rate, and is the unit’s resolution. For devices with analog output, this is rated in millivolts/degree/second (mV/°/sec). Analog Devices’ ADXR652 generates 7 mV/°/sec. Their ADIS16080 is a typical digital unit, and, as is common for this class of devices, its output is rated in °/sec/LSB (in this case it’s roughly 0.1°/sec/LSB).
Zero-rate level (some vendors call this the offset calibration error) is the output generated even if there is no rotation. The previously-mentioned LY3100ALH is specified at 1.5 volts, far in excess of the device’s 1.1 mV/dps sensitivity. Clearly this must be nullified by the designer. VTI Technologies’ CMR3000 has a ±2000 dps range, but the zero-rate error, at ±200 dps, is fully ten percent of the unit’s range. As mentioned, for absolute measurements one must calibrate the sensor. The CMR3000’s zero-rate level is further biased by a temperature coefficient of ±1°/sec/°C.
Accelerometers and gyros, while differing in construction and what they measure, use similar interfaces.
Very few gyros, with the previously-mentioned CMR3000 being in the minority, offer I²C outputs. Accelerometers, too, occasionally provide I²C. PWM is also very infrequently available (on accelerometers only), such as Analog Devices’ ADXL212.
Essentially all other gyros and accelerometers with digital outputs use SPI. Analog parts are just as common as their binary counterparts.
Many A/D converters, particularly those found on microcontrollers, convert the ratio of the input voltage to the ADCs’ supply voltage to digital. Vcc is subject to drift, which can add errors to the conversion. Gyros, as noted earlier, are also somewhat temperature-sensitive. Some, for instance Analog Devices’ ADXRS642 have a Vratio pin which tracks both the supply and temperature (via an on-board thermistor). By reading that output, and then the gyro’s rotational information, the software can divide the two and correct for these errors.
Figure 4: Block diagram of the ADRXR642. Note how the Vratio terminal can be used to compensate for power supply variations and the part’s temperature coefficient (relevant components highlighted). (Courtesy of Analog Devices).
Gyros offer little other than rotation information, but some accelerometers will detect particular conditions and generate interrupts. They may contain rather extensive filtering and detection logic which greatly offloads a system’s processor. For instance, Analog Devices’ ADXL345 can generate interrupts when the device detects a single- or double-tap, or a free-fall (the user dropped his hand-held device). Other interrupts can occur when a pre-programmed time elapses, with or without any motion being detected, a useful feature for waking or putting a tablet or phone to sleep. Suffice to say these parts are complex enough that it is worthwhile to do some prototyping with an evaluation board, such as the very inexpensive EVAL-ADXL345Z.
Gyroscopes, inclinometers and accelerometers have become so inexpensive they are found in a wide range of consumer and industrial goods. MEMS technology has made these parts as small as the smallest SMT IC, so they are readily included on a PC board. The parts are subject to various kinds of errors, so the designer must select parts carefully and insure the software provides the proper compensation.
- Analog Devices’ application note AN-1057: Using an Accelerometer for Inclination Sensing
- STMicroelectronics’ application note AN3182: Tilt measurement using low-g 3-axis accelerometer