© Freescale Semiconductor, Inc., 2006. All rights reserved.
AN1950
Rev 4, 11/2006
Freescale Semiconductor
Application Note
Water Level Monitoring
by: Michelle Clifford, Applications Engineer
Sensor Products, Tempe, AZ
INTRODUCTION
Many washing machines currently in production use a
mechanical sensor for water level detection. Mechanical
sensors work with discrete trip points enabling water level
detection only at those points. The purpose for this reference
design is to allow the user to evaluate a pressure sensor for
not only water level sensing to replace a mechanical switch,
but also for water flow measurement, leak detection, and other
solutions for smart appliances. This system continuously
monitors water level and water flow using the temperature
compensated MPXM2010GS pressure sensor in the low cost
MPAK package, a dual op-amp, and the MC68HC908QT4,
eight-pin microcontroller.
SYSTEM DESIGN
Pressure Sensor
The pressure sensor family has three levels of integration
— Uncompensated, Compensated and
Integrated. For this design, the MPXM2010GS compensated
pressure sensor was selected because it has both
temperature compensation and calibration circuitry on the
silicon, allowing a simpler, yet more robust, system circuit
design. An integrated pressure sensor, such as the
MPXV5004G, is also a good choice for the design eliminating
the need for the amplification circuitry.
Figure 1. Water Level Reference Design Featuring a
Pressure Sensor
The height of most washing machine tubs is 40 cm,
therefore the water height range that this system will be
measuring is between 0–40 cm. This corresponds to a
pressure range of 0–4 kPa. Therefore, the MPXM2010GS
was selected for this system. The sensor sensitivity is
2.5 mV/kPa, with a full-scale span of 25 mV at the supply
voltage of 10 V
DC
. The full-scale output of the sensor changes
linearly with supply voltage, so a supply voltage of 5 V will
return a full-scale span of 12.5 mV.
(V
S actual
/ V
S spec
) * V
OUT full-scale spec
= V
OUT full-scale
(5.0 V/ 10 V) x 25 mV = 12.5 mV
Since this application will only be utilizing 40 percent of the
pressure range, 0–4kPa, our maximum output voltage will be
40 percent of the full-scale span.
V
OUT FS
* (Percent
FS Range
) = V
OUT max
12.5 mV * 40% = 5.0 mV
The package of the pressure sensor is a ported MPAK
package. This allows a tube to be connected to the sensor and
the tube is connected to the bottom of the tub. This isolates the
sensor from direct contact with the water. The small size and
low cost are additional features making this package a perfect
fit for this application.
Figure 2. A Ported Pressure Sensor
AN1950
Sensors
2 Freescale Semiconductor
Amplifier Induced Errors
The sensor output needs to be amplified before being
inputted directly to the microcontroller through an eight-bit A/D
input pin. To determine the amplification requirements, the
pressure sensor output characteristics and the 0-5 V input
range for the A/D converter had to be considered.
The amplification circuit uses three op-amps to add an
offset and convert the differential output of the MPXM2010GS
sensor to a ground-referenced, single-ended voltage in the
range of 0–5.0 V.
The pressure sensor has a possible offset of ±1 mV at the
minimum rated pressure. To avoid a nonlinear response when
a pressure sensor chosen for the system has a negative offset
(V
OFF
), we added a 5.0 mV offset to the positive sensor output
signal. This offset will remain the same regardless of the
sensor output. Any additional offset the sensor or op-amp
introduces is compensated for by software routines invoked
when the initial system calibration is done.
To determine the gain required for the system, the
maximum output voltage from the sensor for this application
had to be determined. The maximum output voltage from the
sensor is approximately 12.5 mV with a 5.0 V supply since the
full-scale output of the sensor changes linearly with supply
voltage. This system will have a maximum pressure of 4 kPa
at 40 cm of water. At a 5.0 V supply, we will have a maximum
sensor output of 5 mV at 4 kPa of pressure. To amplify the
maximum sensor output to 5.0 V, the following gain is needed:
Gain = (Max Output needed) / (Max Sensor Output
and Initial Offset) = 5.0 V / (0.005 V + 0.005) = 500
The gain for the system was set for 500 to avoid railing from
possible offsets from the pressure sensor or the op-amp.
The Voltage Outputs from the sensor are each connected
to a non-inverting input of an op-amp. Each op-amp circuit has
the same resistor ratio. The amplified voltage signal from the
negative sensor lead is V
A
. The resulting voltage is calculated
as follows:
V
A
= (1+R8/R6) * V
4
= (1+10/1000) * V
4
= (1.001) * V
4
The amplified voltage signal from the positive sensor lead
is V
B
. This amplification adds a small gain to ensure that the
positive lead, V
2
, is always greater than the voltage output
from the negative sensor lead, V
4
. This ensures the linearity
of the differential voltage signal.
V
B
= (1+R7/R5) * V
2
– (R7/R5) * V
CC
= (1+10/1000) * V
2
+ (10/1000)*(5.0 V)
= (1.001) * V
2
+ 0.005 V
The difference between the positive sensor voltage, V
B
,
and the negative sensor voltage, V
A
is calculated and
amplified with a resulting gain of 500.
VC = (R12/R11) * (V
B
– V
A
)
= (500 K/1K) * (V
B
– V
A
)
= 500 * (V
B
– V
A
)
The output voltage, V
C
, is connected to a voltage follower.
Therefore, the resulting voltage, V
C
, is passed to an A/D pin of
the microcontroller.
The range of the A/D converter is 0 to 255 counts. However,
the A/D Values that the system can achieve are dependent on
the maximum and minimum system output values:
Count = (V
OUT
– VRL) / ( VRH – VRL) x 255
where V
Xdcr
= Transducer Output Voltage
V
RH
= Maximum A/D voltage
V
LH
= Minimum A/D voltage
Count (0 mm H20) = (2.5 – 0) / (5.0 – 0) * 255 = 127
Count (40 mm H20) = (5.0 – 0) / (5.0 – 0) * 255 = 255
Total # counts = 255 – 127 = 127 counts.
The resolution of the system is determined by the mm of
water represented by each A/D count. As calculated above,
the system has a span of 226 counts to represent water level
up to and including 40 cm. Therefore, the resolution is:
Resolution = mm of water / Total # counts
= 400mm/127 counts = 3.1 mm per A/D count
Table 1. MPXM2010D OPERATING CHARACTERISTICS (V
S
= 10 V
DC
, T
A
= 25°C unless otherwise noted, P1 > P2)
Characteristic Symbol Min Typ Max Unit
Pressure Range P
OP
0—10kPa
Supply Voltage V
S
—1016Vdc
Supply Current I
O
—6.0 mAdc
Full Scale Span V
FSS
24 25 26 mV
Offset V
off
-1.0 1.0 mV
Sensitivity DV/DP 2.5 mV/kPa
Linearity -1.0 1.0 %V
FSS
AN1950
Sensors
Freescale Semiconductor 3
Figure 3. Amplification Scheme
Microprocessor
To provide the signal processing for pressure values, a
microprocessor is needed. The MCU chosen for this
application is the MC68HC908QT4. This MCU is perfect for
appliance applications due to its low cost, small eight-pin
package, and other on-chip resources. The MC68HC908QT4
provides: a four-channel, eight-bit A/D, a 16-bit timer, a
trimmable internal timer, and in-system FLASH programming.
The central processing unit is based on the high
performance M68HC08 CPU core and it can address 64
Kbytes of memory space. The MC68HC908QT4 provides
4096 bytes of user FLASH and 128 bytes of random access
memory (RAM) for ease of software development and
maintenance. There are five bi-directional input/output lines
and one input line shared with other pin features.
The MCU is available in eight-pin as well as 16-pin
packages in both PDIP and SOIC. For this application, the
eight-pin PDIP was selected. The eight-pin PDIP was chosen
for a small package, eventually to be designed into
applications as the eight-pin SOIC. The PDIP enables the
customer to reprogram the software on a programming board
and retest.
Display
Depending on the quality of the display required, water
level and water flow can be shown with two LEDs. If a higher
quality, digital output is needed, an optional LCD interface is
provided on the reference board. Using a shift register to hold
display data, the LCD is driven with only three lines outputted
from the microcontroller: an enable line, a data line, and a
clock signal. The two LEDs are multiplexed with the data line
and clock signal
Figure 4. Multiplexed LCD Circuit
Multiplexing of the microcontroller output pins allows
communication of the LCD to be accomplished with three pins
instead of eight or 11 pins of I/O lines usually needed. With an
eight-bit shift register, we are able to manually clock in eight
bits of data. The enable line (EN) is manually accepted when
eight bytes have been shifted in, telling the LCD the data on
the data bus is available to execute.
The LEDs are used to show pressure output data by
displaying binary values corresponding to a pressure range.
Leak detection, or water-flow speed, is displayed by blinking a
green LED at a speed relating to the speed of water flow. The
red LED displays the direction of water flow. Turning the red
LED off signifies water flowing into the tub. Turning the red
LED on signifies water flowing out of the tub, or alternatively,
there is a leak.
Digital values for water height, rate of water flow, and
calibration values are displayed if an LCD is connected to the
board
R5
10K
R7
10
R8
10
R6
10K
R11
1K
R9
1K
R10
500K
R12
500K
V2
sensor
V4
sensor
V
OUT
V
CC
C5
0.1µF
6
5
7
2
3
1
9
10
813
12
14
11
4
V
CC
V
A
V
C
V
B
+
-
+
-
+
-
+
-
HC908QT4 HC164
LCD
EN
RS
RW
DB0
DB1
DB2
DB3
DB4
DB5
DB6
DB7
A
B
CLK
PTA4
PTA3
PTA5
R3R2
1K1K

KITMPVZ5004EVK

Mfr. #:
Manufacturer:
NXP / Freescale
Description:
Pressure Sensor Development Tools WATER LEVEL BOARD
Lifecycle:
New from this manufacturer.
Delivery:
DHL FedEx Ups TNT EMS
Payment:
T/T Paypal Visa MoneyGram Western Union

Products related to this Datasheet