circuitcellar.com
Magazine Support   Digital Library   Products & Services   Suppliers Directory 
 
 





 

July 2006, Issue 192

Dual-Axis Level Sensor
Philips ARM Design Contest 2005 Winner


by Stefan Morley


Start System Overview LCD Analog Software Implementation Hand that Feeds Where to Now? Sources and PDF

ANALOG

The dual-axis DX-045D-90 sensors I used have four pins around the circumference of the device intended to have excitation applied. A central pin measures the signal. The sensor’s angle determines the amount of liquid electrolyte that covers the excitation pins, which in turn determines the voltage level that can be measured at the SENSE pin. The sensor effectively acts as a resistive voltage divider. If the axes are orientated in an x/y configuration, then reasonable orthogonal measurements can be taken of the relative angle of the two axes.

Electrolytic tilt sensors cause a chemical reaction in the liquid by applying a voltage that makes electrons migrate to the positive electrode and protons move to the negative electrode or cathode. The amount of liquid that covers the internal pins dictates how much reaction can occur, which can be measured on the SENSE pin as if the unit looked like a voltage divider.

Looking at the datasheets, some thoughts come to mind as to why limitations occur. Temperature affects the chemical reaction, as does the length of time the unit is subject to electrical energy. The unit’s response time is based on the viscosity of the liquid with an inverse effect on the settling time. A sensor’s repeatability is based on the surface tension of the liquid and the wetting effect it would have on the internal pins. Linearity and symmetry are based on the liquid’s volume, constraints due to the internal variation of the shape, and the difference between the pins.

When driving the sensors, the electrical properties of the electrolyte can be destroyed if DC is applied to them. According to AOSI, the sensors should be driven by a 50% duty cycle signal. The sensor will accumulate charge if the signal isn’t symmetrical. Why should it be a 50% duty cycle? As long as the sensor sees a symmetrical waveform, there should be no net positive or negative charge over time. The other problem in sending a square wave (which is the easiest method for a microcontroller) of 50% to the sensor is that effectively you will have a DC component on the sensor for most of the time even though it’s symmetrical. That’s how I arrived at the approach I followed.

I used the microprocessor’s output pin totem pole arrangement with the added benefit of being able to turn off power to the pin. As a result, there is a four-arm H-Bridge driving the sensor. This enables current to be driven in both directions across the sensor resulting in a net zero positive or negative charge over time. Although the processor can drive a pin from only 0 to 3.3 V, this is relative to the 0 V of the processor. By driving the sensor in the H-Bridge configuration, a sensor pin sees a voltage relative to an opposing driving pin.

This was achieved by driving the pins as inputs for the majority of the time and placing an effective open circuit across the sensor (minus leakage currents stated as maximum of 3 µA). I then set the direction register to outputs driving one pair of pins high and the opposite pair of axis pins low. Which sensor pins are driven high or low is dictated by the axis that needs to be measured (see Figure 3). The pins are driven for 10 µs to allow for a stable reading owing to the RC elements of my circuit.

(Click here to enlarge)

Figure 3—The dual-axis sensors have four pins around the circumference of the device. This demonstrates the relationship between the electrical signals and the physical orientation of the device. The code for this sequence is performed in an endless loop. The converted values from the SENSE pin have a direct relationship with the stimulation sequence.

Each axis was treated the same way to end up with four measurements and to satisfy the sensor’s need for symmetry. The net result is that no one pin sees a greater positive or negative current flow than any other pin. The raw counts of the two x-axis conversion results were subtracted from one another to give one value for the x-axis. The y-axis was treated the same way. These measurements are done every 7 ms in an interrupt routine.

One problem I encountered was vibrational stability with the sensor. The electrolyte liquid has a low viscosity and tends to splash around in the sensor. An advantage is that the unit stabilizes quickly, but it won’t be much good for a vibrating machine. It really won’t matter how much averaging you do if the liquid is splashing. You’re never going to get much sense from it.

Splashing is probably not the right term because the volume in the sensor and liquid’s surface tension won’t splash around like water in a bucket. However, it does respond to gravity and inertia with the resultant forces quite possibly being in opposite directions. The liquid is only going to attempt to respond to this. When stationary, it gives stable readings, certainly within the specifications of the 10-bit LPC2138’s ADC. AOSI offers liquid of different grades of viscosity to change these characteristics with resulting increase in settling time.