Adjustment-Free Inclinometer Operates On +2.7V
Figure 1 is an inclinometer (tilt-measuring circuit) whose sensor (SN1) is filled with liquid electrolyte. Acting as a potentiometer, the inclinometer produces a voltage proportional to tilt on its center electrode. Because the liquid is subject to electrolysis, the sensor's forcing voltage must be AC with an average DC component of zero. IC1 is an 8-channel, 12-bit analog-to-digital converter (ADC) that digitizes the sensor output for use by IC2, the microcontroller (µC).
Figure 1. This tilt sensor is simple, accurate, inexpensive, and adjustment free.
Conditioning circuitry for this sensor type usually includes op amps, analog switches, and potentiometers. Because potentiometer settings drift with time and temperature, such systems require periodic recalibrations based on a precise and tedious procedure. The synchronous approach shown in Figure 1 not only eliminates the need for calibration, but it also operates from a single-supply voltage as low as +2.7V.
Two CMOS port pins on the µC generate 50Hz square waves, 180° out-of-phase, as an AC drive for the sensor. When the sensor is level, its center-electrode voltage (filtered by R3/C4 and fed to the ADC) is midway between these drive-electrode voltages, which are approximately VCC and 0V. Each port pin has a finite resistance and resultant voltage drop. To compensate for the resulting inaccuracies, voltage divider R4/R5 samples the drive signal's mid-level voltage and feeds it to channel 2 on the ADC. This voltage remains constant, but the center-electrode signal varies above or below mid-level according to the direction of tilt.
The tilt signal on one channel and the reference (mid-level) signal on another are digitized by the ADC and fed to the µC. The AC drive dwells 10ms on each polarity, allowing about nine time constants for 12-bit settling before the A/D conversion. The converter's pseudo-differential input negates the absolute value of these signals (~½VCC). Thus, the magnitude and polarity of channel 0 (with respect to channel 1) indicate the magnitude and direction of tilt. The tilt measurement is ratiometric and therefore relatively immune to large variations in the supply voltage (typically 0.2% of full scale per volt of supply change).
A measurement comprises two consecutive half-cycles: the µC first calculates the sensor-minus-reference value; it then applies an opposite-phase drive signal and calculates the reference-minus-sensor value. Subtracting these values produces twice the desired tilt value and negates the need for null ad-justment by canceling any systematic offsets. The values are handled in software (see the software listing called "Adjustment-Free Inclinometer" under the Other Software category on Maxim's website at www.maximintegrated.com) as two's-complement quantities, and displayed on the liquid-crystal display (LCD) as integers. (The display in this system is included mainly for demonstrations.)
Though not implemented by the software provided, this system is capable of very-low-power operation. IC1 can be shut down between conversions; in this state, it draws only 10µA. While IC1 is shut down, pins 12 and 13 on the µC port should be written low to prevent DC current from damaging the sensor (consult the sensor's data sheet for the maximum DC current allowed). The µC's internal watchdog can be set to wake up every second or so for a new measurement. Operating at a few measurements per second and replacing the LCD with Maxim's MAX7211 can lower the overall supply current to 100µA.
The techniques previously described are compatible with most µCs and microprocessors (µPs), but the output structures of some µPs are unlike that of the Microchip PIC™. Most variants of the 8051, for example, have an open-drain output and pull-up resistor that exhibit unequal source and sink currents at the port pins. Ensure reliable operation for these variants by providing external CMOS inverters between the port pins and sensor. Design the power-up initialization and power-down conditions carefully to minimize DC current through the sensor.
Finally, these techniques can be expanded to accommodate dual-axis sensors by dedicating two more port pins for a second pair of force electrodes. The measurement procedure is nearly identical, except that the sensor pins for each axis must be alternately three-stated while making measurements on the other axis. This provision minimizes cross-axis interactions, which is a difficult task to accomplish with the more common analog techniques.
A related idea appeared in the 4/24/97 issue of EDN.
PIC is a registered trademark of Microchip Technology Incorporated.
APP 1048: Jul 09, 1998
APPLICATION NOTE 1048,