AN3956, DEMOAPEXSENSOR Usage - Application Notes

AN3956
Rev 1, 09/2010
Freescale Semiconductor
Application Note
DEMOAPEXSENSOR Usage
Altitude Pressure EXperimental (APEX) Sensor Board
by: John B. Young
INTRODUCTION
The DEMOAPEXSENSOR is an experimental sensor board focused on pressure with a variety of applications built into the
demo. These include: Altimeter, Barometer, Barometer Alarm, Weather station, Waterlevel, Waterlevel Alarm, Tilt, Freefall, and
Temperature Sensing. The board has been designed as a standalone board to be interfaced currently via an LCD display and
menu buttons. The multiple functions of the Altitude Pressure EXperimental (APEX) Sensor board are possible with the use of
Freescale’s sensors. This kit has the following: MPL115A2, MPXM2102A, MPXV5004G pressure sensors with an MMA7361L
accelerometer. The demo makes use of Freescale’s Flexis MC9S08JM60 8-bit microcontroller. Figure 1 is an image of the
DEMOAPEXSENSOR with important items highlighted. Freescale’s sensors are listed along with their associated application in
Table 1.
Table 1. On-Board Sensors
Device
Type of Sensor
Measurement Range of Sensor
Sensor Application
Interface Type
MPL115A
Pressure Absolute
50 - 115 kPa
Barometer/Altimeter
Digital I2C/SPI
MPXM2102A
Pressure Absolute
0 - 100 kPa
Altimeter/Absolute Pressure
Analog
MPXV5004G
Pressure Gauge
0 - 4 kPa
Liquid Level Sensor
Analog
Accelerometer
Selectable ±1.5g, ±6g
Acceleration, Tilt, Shock,
Freefall
Analog
MMA7361L
Temperature Sensor
MPXM2102A
Absolute Pressure
Sensor -Altitude
Development
Header
MPL115A
Backside:
MPXV5004G
Gauge Pressure
Sensor- Waterlevel
LCD Display
for Results
USB
Connector
MMA7361L
3 Axis low-g
Accelerometer
-Motion
Push Buttons
“Up, Down, ESC
Enter”
BDM
Figure 1. Basic Components of APEX Board
© Freescale Semiconductor, Inc., 2009, 2010. All rights reserved.
MMA7360Q
3 Axis XYZ
Accelerometer
12 bit
MPXV5004
Integrated
Pressure
Sensor
20x4 Character
LCD Display
Menu Buttons
JM60
8-bit S08 MCU
12-bit ADC
60k Flash
USB
MPL115A2
(I2C)
24-bit
ADC
Converter
12 bit
Temp
Sensor
Instrumentation
Amplifier
Gain=98.8
Development Header
12 bit
MPXM2102
Compensated
Pressure
Sensor
Figure 2. Simplified Block Diagram
Figure 2 is a simplified block diagram of the DEMOAPEXSENSOR. The sensors with analog outputs (Table 1) are sampled
via the JM60 microcontroller’s 12-bit ADC. The exception is the MPXM2102A absolute pressure sensor. This is used for altitude
so it requires a high resolution sampling. It passes through an instrumentation amplifier and then is interfaced via an external
24-bit ADC chipset before communication via SPI to the JM60 MCU. The JM60 interfaces with the LCD screen and processes
inputs by the user for the displayed output.
Several Algorithms are used to calculate functions on the DEMOAPEXSENSOR.
Information on implementing the MPL115A can be found in
AN3785, How to Implement the Freescale MPL115A Digital Barometer.
Implementing the MPL115A as a barometer and altimeter can be found in
AN3914, Modern Altimeter and Barometer System using the MPL115A.
More pressure sensor application notes can be found at: www.freescale.com/pressure.
AN3956
Sensors
Freescale Semiconductor
2
Figure 3.
AN3956
8
7
6
5
4
3
2
1
A
A
Buz
P
N
+5V
3
2
1
UP
DN
B
C3
CH
2-H7
0.1μF
+5V
BAT54SLT1GOSCT
D5
B
USB
J1
1
2
3
4
5
R3
R2
33 !
R6
R5
R4
ADC_control
2-H6
0.1μF
C2
5.1K !
10K !
+5V
0.1μF
C1
5.1K !
10K !
+5V
33 !
R7
R26
20K !
C
+5V
1
3
0.1μF
C4
DB0
DB1
DB2
DB3
DB4
DB7
DB5
DB6
2
SDO
SDI
SCK
C8
R9
10μF
0.1μF
C
C6
C5
+5V
C10
0.1μF
D
0.1μF
C11
+3.3V
Vss
Vdd
Vo
RS
R/W
E
DB0
DB1
DB2
DB3
DB4
DB5
DB6
DB7
A
K
10μF
Vin
2-D1
0.1μF
C14
+VAref
0.1μF
C13
+5VA
C12
J2
0.1μF
C9
U1
6
4
2
BDM
E
5
3
1
E
5.1K !
R11
R10
10K !
+5V
PTC5/ExD2
PTC3/TxD2
PTC2
PTC1/SDA
PTC0/SCL
VSSOSC
PTG5/EXTAL
PTG4/XTAL
BKGD/MS
PTG3/KBIP7
PTG2/KBIP6
PTD7
PTD6
PTD5
PTD4/ADP11
PTD3/KBIP3/ADP10
PTD2/KBIP2/ACMP0
VSSAD
VREFL
VREFH
VDDAD
PTD1/ADP9/ACMPPTD0/ADP8/ACMP+
PTB7/ADP7
PTB6/ADP6
PTB5/KBIP5/ADP5
PTB4/KBIP4/ADP4
PTB3/SS2/ADP3
PTB2/SPSCK2/ADP2
PTB1/MOSI2/ADP1
PTB0/MISO2/ADP0
PTA5
MC9S08JM60
LCD
U3
PTC4
IRQ/TPMCLK
Reset
PTF0/TPM1CH2
PTF1/TPM1CH3
PTF2/TPM1CH4
PTF3/TPM1CH5
PTF4/TPM2CH0
PTC6
PTF7
PTF5/TPM2CH1
PTF6
PTE0/TxD1
PTE1/RxD1
PTE2/TPM1CH0
PTE3/TPM1CH1
PTE4/MISO1
PTE5/MOSI1
PTE6/SPSCK1
PTE7/SS1
VDD
VSS
USBDN
USBDP
VUSB33
PTG0/KBIP0
PTG1/KBIP1
PTA0
PTA1
PTA2
PTA3
PTA4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
0.1μF
RS
RW
E
1
2
3
4
5
6
7
8
PTC6
9
10
11
12
PTE0
13
PTE1
14
PTE2
15
16
17
18
19
20
21
22
23
24
25
PTG0
26
PTG1
27
/ C S 28
BUSY 29
PTA2
30
PTA3
31
PTA4
32
0.1μF
RESET
C7
10K !
+5V
DB0
DB1
DB2
DB3
DB4
DB5
DB6
DB7
D
+5V
SCL
SDA
PTC3
PTC5
PTC6
PTE2
PTE1
PTE0
PTG1
PTG0
PTA4
PTA3
PTA2
ADP5
ADP6
ADP7
PTD0
PTD1
CH0
CH1
CH2
CH3
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
ENT
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
R15
R13
SDA
SCL
PTC5
PTC3
SDA
SCL
A
A
F
R16
R14
R19
R18
R17
A
A
X1
1K !
1K !
1K !
D4
K
K
C22
0.1μF 0.1μF
C21
C19
C18
22pF
G
0.1μF
C20
C26
0.1μF
H
7
5
6
14
10
4
V+ 5
Gnd
LM20
U9
R22
5.1K !
/SLEEP
VSS
VDD
SELF_TEST
g_sel
U12
+5VA
C25
H
470pF
3
2 Vo
1 Gnd
NC
MMA7361
4
Zout
3
Yout
2
Xout
9
0g_det
+5VA
0.1μF
C27
ESC
+5V
.01μF
R21
10K !
C24
470 !
R20
+VAref
0.1μF
+5V
1μF
C16
C23
E
RW
RS
22pF
0.1μF
R1
G
C17
C15
0!
3
1μF
C47
0.1μF
10M !
D2
D3
K
D1
K
R12
1
VDD 2
CAP 3
GND 4
SHDN
MPL115A2
U11
8
7 SCLK
6 DIN
5 DOUT
CS
PTD1
PTD0
ADP7
ADP6
ADP5
+5V
F
2
1
Sensors
Freescale Semiconductor
3
U6
C28
0.1μF
C29
+3.3V
0.1μF
+5VA
1
2 NC
3 Vs
4 GND
Vout
8
NC 7
NC 6
NC 5
NC
MPXV5004
I
I
J
J
8
7
6
5
4
3
2
1
Figure 4.
AN3956
8
7
6
5
4
3
A
U5
C30
B
1
GND 2
+Vout 3
Vs 4
-Vout
MPXM2102A
0.1μF
0!
R23
1
3
2
C
R24
511 !
J5
U4
8
Rg2 7
V+ 6
Vo 5
Vrf
INA118UB
1
2 Rg
3 Vin4 Vin+
V-
P
N
SW7
C31
N
P
D
0.1μF
0.1μF
J3
C33
+5VA
1
J4
C37
E
0.1μF
C38
F
L1
+5V
C42
V+
LTC2442
Vcc
+5VA
F
C45
C46
R8
91 !
0.1μF
/CS
SCK
SDO
SDI
BUSY
FO
INT-/EXT
MUXOUTB
MUXOUTA
+INA
+INB
GND GND GND V -
0.1μF
+3.3V
L14806E101R-10
REF+
REFCH0
CH1
CH2
CH3
COM
ADCINB
ADCINA
OUTA
-INA
-INB
OUTB
+5V
30
31
6
CH1 7
CH2 8
CH3 9
28
10
11
12
13
18
17
+VAref
CH0
0.1μF
C36
3
0.1μF
U10
3
C34
N
P
C35
N
P
U7
MIC520I-3.3YS
1
C39
C40
MIC520I-5.0YS
47μF
47μF
Vin
1-E6
2
2
0.1μF
0.1μF
E
29
D
4
D8
G
/CS
35
SCK
1
SDO
36
SDI
33
2 BUSY
34
3
26
27
25
19
U2
R25
470 !
0.1μF
+VAref
+5VA
H
CH
1-B6
H
ADC_control
1-C5
LM4040A41IDBZR
LM4040A41IDBZR
G
C43
N
P
0.1μF
2
J6
C
5
B
24
47μF
D7
1
A
21
32
0.1μF
C41
1
2
C44
1
2
Sensors
Freescale Semiconductor
4
47μF
C32
I
I
J
J
8
7
6
5
4
3
2
1
Quick Start Guide
How to Read MPL115A Values on APEX Board
APEX Controls:
ON/OFF Switch: Located on the left side, under the LCD screen along the PCB edge. It is a slide switch.
Menu Selection Buttons: Located on the right side, next to the blinking LEDs.
On/Off
Slide Switch
Under LCD
Information
Displayed on LCD
UP
ESC
Push Buttons
“Up, Down, ESC
Enter”
Blinking LEDs
ENT
DN
Detail of Push Buttons
Figure 5. APEX Controls
MPL115A Pressure Shown on APEX Example
Navigating Through the Menu
Screen 1:
1.
2.
3.
4.
Alti/Baro
Waterlevel
Inertial
Additional
Press
UporDN
1.
a.
b.
c.
Altimetry
Press
MPXM2102A
UporDN
MPL115A2
Experimental ‘b’
Press UP or DN until option “1. Altimetry” is selected
Press ENT
‘1’
Screen 2:
Press UP or DN until option “b. MPL115A2” is selected
Press ENT
AN3956
Sensors
Freescale Semiconductor
5
Screen 3:
PPL115A2 Raw Values
Press ADC 5bc0 0367
Temp ADC 7a00
0488
ENTER for Coeff.
Pressure and Temperature Raw Values in decimal
format are on the right in blue.
Press ENT menu Button one time to move forward to
see the coefficients.
6 Coefficients:
3c ca
30
84
8a bd
b8 93
f2
Coefficients are listed. Press ENT menu button to see
compensated pressure reading.
Screen 4:
80
33
c0
Screen 5:
Compensated Pressure
PComp =
97.273
Pressure is compensated and listed in kPa. Press ENT
to continue to Alarm System.
To navigate backwards, press ESC to cycle to previous
screen.
ALARM System
Enter your Threshold
0.50 kPa
ENTER for Activation
Press UP or DN to set Pressure Threshold for the Alarm
System in 0.25 kPa increments.
Press ENT to activate the alarm feature and wait for
the buzzer to sound.
ALARM sounds when
Threshold is reached
Press.
97.273 kPa
97.836
ALARM
Alarm is armed and the current pressure is shown on top.
The bottom is the threshold pressure for the alarm.
Note the RED LED activates with the alarm and a green
solid LED indicates a non alarm pressure.
To navigate backwards: press ESC to cycle to previous
screens and deactivate alarm.
Screen 6:
Screen 7:
AN3956
Sensors
Freescale Semiconductor
6
Functions and the Screen Shot Navigation Path
Color Legend
Inputs: User has to enter in a value, or select a choice, UP or DN. Typical inputs are shown in ‘x’ format. ESC repeatedly
pressed, exits user to main menu.
Outputs: Demo code returns a result or value based on the user inputs.
Simple Weather Station
1.
2.
3.
4.
Alti/Baro
Waterlevel
Inertial
Additional
Press
UPorDN
‘4’
Additional
Press
a. Weather
UPorDN
b. Weather Advanced
c. Temp Sensor
ENT
‘a’
Please enter your
Altitude (m)
UP/DN
101.3 kPa
00
ENT
m
SIMPLE WEATHER
Weather outlook
0.423 kPa
Sun/Cloud Symbol
ENT
This is the altitude at your
current location. Once its
entered, the value of Pressure
for that altitude is displayed.
The current Weather outlook is
displayed in the options of
Symbols: Sun, Rain,
Sun/Cloud.
Note the difference in pressure
is displayed from current to
Altitude.
Advanced Weather Station
1. Alti/Baro
2. Waterlevel
3. Inertial
Press
UPorDN
4. Additional
‘4’
ENT
Additional
Press
a. Weather
UPorDN
b. Weather Advanced
c. Temp Sensor
‘a’
WEATHER
Sun/Cloud
Min 0224
dP/dt -0.042
Stable Weather Pattern
ENT
This shows the weather in the top right corner from the simple
weather algorithm. The ‘Min’ shows how long the algorithm is
working in minutes. dP/dt shows the differential change per an
hour. The corresponding weather type is predicted in the bottom.
This takes readings for up to 3 hours and compares results to the
algorithm every ½ hour.
Waterlevel Sensing
1. Alti/Baro
2. Waterlevel
3. Inertial
Press
UPorDN
4. Additional
‘2’
ENT
2. Waterlevel
MPXV5004 Integrated
40cm H2O Level
Press ENTER
2. Waterlevel
a. Liquid (cm)
b. Alarm system
Press
UPorDN
‘a’
ENT
Place in Liquid
ADC 12bit
H2O Level
Pressure
1179
0.0 cm
0.0 kPa
ENT
Selection of the Liquid
Waterlevel section in ‘a’.
Place tube attached to
MPXV5004 into water. As it
goes into the water, the value
of water height will be
displayed on the screen along
with Pressure.
AN3956
Sensors
Freescale Semiconductor
7
Waterlevel Alarm (sub-option from above menu)
2. Waterlevel
a. Liquid (cm)
b. Alarm system
Press
UPorDN
‘b’
LARM sounds when
Threshold is reached
Press.
4.00 cm
Alarm System
Enter your Threshold
5.50 cm
ENTER for Activation
ENT
ALARM
5.50
ENT
Press UP and DN to set the
Alarm Threshold in increments
of 0.25cm.
Press ENT to activate the
Alarm.
Alarm is now Active. Note the outputs of the current Pressure in
cm, and the Alarm Threshold point. Once crossed, the red LED will
flash as the buzzer sounds. Try activating by moving the tube up
and down in a column of water.
Additional
Press
a. Weather
UPorDN
b. Weather Advanced
Temperature
External Temp Sensor
1487 ADC
031 Deg C
087 Deg F
Temperature Sensor
1. Alti/Baro
2. Waterlevel
3. Inertial
4. Additional
Press
UPorDN
‘4’
ENT
c. Temp Sensor
‘c’
ENT
Value of the External Temperature sensor is displayed on the
screen in °C and °F
Inertial Sensor
1. Alti/Baro
2. Waterlevel
3. Inertial
4. Additional
Press
UPorDN
‘3’
ENT
3. Inertial
MMA7361L 3 Axis
Accelerometer 1.5g
Press ENTER
ENT
TRaw Values of Accel
X axis
1594
Y axis
1663
Z axis
2388
ENT
ADC values of the MMA7361L
are displayed on the screen.
Press Enter to proceed to the
next screen
Tilt Angle
X axis
Y axis
Z axis
-2deg
-4deg
90deg
ENT
ADC values are converted and
displayed on the screen as an
angle for X, Y and Z axis.
Press Enter to continue to
Freefall Detection.
Freefall detect
Drop carefully in Linear
Freefall only.
FF detected!!
Drop board in linear manner to
hear buzzer detecting Freefall
condition, and Red LED will
blink with buzzer. Exit Freefall
and Inertial by pressing ESC.
AN3956
Sensors
Freescale Semiconductor
8
Altimetry
1.
2.
3.
4.
Alti/Baro
Waterlevel
Inertial
Additional
Press
UPorDN
‘1’
1.
a.
b.
c.
Altimetry
Press
MPXM2102A
UPorDN
MPL115A2
Experimental
‘a’
ENT
Raw Value
Altitude
0x017c1d
459m
2(LP) value
Pressure
0x017c1f
95.365 kPa
ENT
Select the MPXM2102A,
option ‘a’ for higher resolution,
amplified pressure readings
for Altimetry.
Note the way that the output is displayed. The Raw value of the
24-bit ADC value is displayed on the left. The bottom left has the
raw value after it passes two low pass filters in software. This value
is mores stable but takes longer to update.
On the right the Altitude is displayed. This is the pressure
converted to altitude in (m). The Pressure corresponding to the
ADC value is shown in the bottom right.
The board can be placed on the table. Note the Altitude
measurement as it stabilizes. Then raise it above your head as a
‘1m’ increase. The value should go up by 1m. Place on the table
again. It should drop to the original value. Place on the floor, it will
again decrement 1m. Note that ambient pressure from A/C units
can affect this value drastically.
Barometer Compensated Pressure Output
1.
a.
b.
c.
Altimetry
Press
MPXM2102A
UPorDN
MPL115A2
Experimental
‘b’
ENT
6 Coefficients
ao = 3dc4
c11 = f8a0
b1 = bd7a
c12 = 2flc
b2 = c299
c22 = 0dc0
Compensated Pressure
PComp =9778 kPa
Altitude = 365 m
ENT
ENT
ENT
The values for the MPL115A
are shown here. To the left are
the Pressure and Temp ADC
values in their raw form in
HEX. To the right of them are
the shifted values displayed in
decimal.
Values of the Coefficients are
shown here. These are used
for the next step in calculating
the compensated Pressure.
MPL115A2
Raw Values
Press ADC
74c0
0467
Temp ADC
6b40
0428
ENTER for Coefficients
Compensated Pressure is
displayed. This is with an
accuracy of ±1kPa.
Press ENT to continue to the
Alarm section.
ALARM System
Enter your Threshold
0.50
kPa
Enter for Activation
ALARM sounds when
Threshold is reached
Press.
96.574 kPa
ALARM
97.324
ENT
Continued from the MPL115A
compensated Barometer
section above. Press UP and
DN to set the Alarm Threshold
in increments of 0.25kPa.
Press ENT to activate the
Alarm
Alarm is now Active. Note the
outputs of the current Pressure
in kPa, and the Alarm
Threshold point. Once
crossed, the red LED will flash
as the buzzer sounds. Try
activating by pressurizing the
MPL115A. This can be done
with a plastic syringe with
rubber tubing at the end to
make an air tight fit.
AN3956
Sensors
Freescale Semiconductor
9
DEMOAPEXSENSOR Altitude Measurement
There are two sensors that can be used for altitude measurement. The MPL115A can be used as an approximate altimeter,
but on this demo board, the MPXM2102A pressure sensor has been used to get a high resolution for altitude measurement. The
MPXM2102A is an absolute pressure sensor. It measures the pressure on its port in relation to a vacuum sealed reference. The
specs given on the data sheet do not easily translate into creating a product that resolves 1m of height difference. The
DEMOAPEXSENSOR in this sense explores how a sensor can be amplified and put through a 24-bit delta sigma ADC to pursue
that type of application.
There is more than one section in the software to determine the vertical altitude. The code has more than one method to try
to improve the resolution the MPXM2102A. One method aims at a sub 1 foot increment, but this is not as stable as the 1m
increment method. Again, this is a experimental board and the method used to measure the MPXM2102A for altitude is subject
to many outside influences. These are not limited to, but include; sudden pressure changes, gusts of wind, A/C unit on/off cycling,
temperature, and exposure to high brightness light. Note the value is setup for dynamic change. The altitude absolute height is
not calibrated. This is typical of end application requiring a starting point.
Table 2. Operating Characteristics (VS = 10 VDC, TA = 25°C unless otherwise noted, P1 > P2)
Characteristic
Symbol
Min
Typ
Max
Units
POP
0
—
100
kPa
Supply Voltage
VS
—
10
16
VDC
Supply Current
IO
—
6.0
—
mAdc
Full Scale Span
VFSS
38.5
40
41.5
mV
VOFF
-1.0
-2.0
-1.0
-2.0
—
—
—
—
1.0
2.0
1.0
2.0
mV
ΔV/ΔΡ
—
0.4
—
mV/kPa
—
—
—
—
-0.6
-1.0
-0.6
-1.0
—
—
—
—
0.4
1.0
0.4
1.0
%VFSS
Pressure Hysteresis (0 to 100 kPa)
—
—
±0.1
—
%VFSS
Temperature Hysteresis (-40°C to +125°C)
—
—
±0.5
—
%VFSS
Temperature Coefficient of Full Scale Span
TCVFSS
-2.0
—
2.0
%VFSS
Temperature Coefficient of Offset
TCVOFF
-1.0
—
1.0
mV
ZIN
1000
—
2500
W
ZOUT
1400
—
3000
W
Response Time (10% to 90%)
tR
—
1.0
—
ms
Warm-Up Time
—
—
20
—
ms
Offset Stability
—
—
±0.5
—
%VFSS
Differential Pressure Range
Offset
MPX2102D Series
MPX2102A Series
MPXM2102D/G Series
MPXM2102A Series
Sensitivity
VOFF
mV
Linearity
MPX2102D Series
MPX2102A Series
MPXM2102D/G Series
MPXM2102A Series
Input Impedance
Output Impedance
%VFSS
Table 2 shows the typical operating characteristics of the MPXM2102A. The supply voltage is ratiometric, but at 10V supply,
the FSS is 40 mV for 100 kPa of applied absolute pressure. The DEMOAPEXSENSOR does not have a full 10V supply. The part
is biased instead by a 5V supply. This cuts the FSS to 20 mV for 100 kPa. Since the output of an analog sensor is ratiometric to
the input voltage, it is crucial to have a stable supply voltage. In the case of amplifying and analyzing small pressure changes,
the input voltage must be stable to remove input noise. To achieve this, a shunt voltage reference connected to the 5V regulator
provides a low noise, stable voltage of 4.096V for the MPX2102A. This is the IC, D8 on the demo schematic, and is typically used
for data-acquisition systems. Thus, the span is really only 16.38 mV at 4.096V, for a pressure range of 0 to 100 kPa. MPXM2102A
is on a separate shunt such that no other connected IC will induce additional noise on the shared line.
AN3956
Sensors
Freescale Semiconductor
10
Hardware Issues to Consider when Designing such a Circuit
ADC Resolution: Since the MPXM2102A is an analog part, the ADC resolution is important to get the resolution needed for
stable measurement. The ADC has to be greater than 16-bits to gain 3 foot intervals in measurement.
Noise: Noise on the board has to be minimized. The digital and analog supplies and grounds must be separated. The
MPXM2102A on the DEMOAPEXSENSOR has its own dedicated shunt voltage reference after the 5V regulator. The external
ADC also has its own digital and analog 5V lines separated. The reference voltage on the ADC has its own shunt reference to
provide a stable value to compare ADC results. The board is 4 layers with a ground and Vdd plane to minimize parasitic
capacitance that creates noise. Analog 5V has its own separated section from the digital 5V in the power layer of the layout. This
minimizes the noise on both 5V digital and 5V analog sections.
Air Flow: The pressure sensor should have a cover when trying to measure a sub 1 m altitude measurement. Either the unit
should be housed in a box, or in a customer application and should have a method to introduce a laminar flow of air. This will
reduce A/C and breeze effects on the pressure sensor. Most applications of such, include a housing perforated with small holes.
This prevents a strong breeze from affecting the sensor, by filtering out the drastic pressure changes. DEMOAPEXSENSOR, as
a demo board, has no such housing.
Software Considerations
Filtering: There are high frequency noise and sensor fluctuations that have to be handled. In the software, two low pass filters
are used to minimize fluctuations in the ADC values. This makes the conversions slower, but the values are more stable. Low
pass filters are better than using a running average. A running average is a filter that does not discriminate noise outliers as well,
since it is included in the result.
Calibration Routines: As seen in the experimental section of the APEX board, it is possible to improve results with various
software calibrations. A simple example is done in the APEX code, but could be further worked with a possibility of multiple
sensors to take this further with motion combined. It will be explained in the short distance model of altimetry in this application
note.
Altimetry Background Information (refer to AN3914)
Altimetry utilizes absolute pressure sensors. An absolute sensor measures the deflection of the surrounding barometric
pressure with reference to a known pressure (usually a vacuum). This allows it to compare the air pressure at sea level
(101.3kPa) to the vacuum to gain an absolute pressure result. At a different elevation, the barometric (surrounding) pressure can
be compared again to the vacuum for that absolute pressure result. Since both readings were taken against the same reference,
they can be compared against each other.
Barometric pressure does not have a linear relationship with altitude. As altitude increases, the pressure decreases. Common
reference points are given in Table 3.
Table 3. Reference Points
Location
Sea Level
Dead Sea (lowest surface on earth)
Summit of Everest
Altitude (m)
Altitude (ft)
Pressure (kPa)
0
0
101.3
-396
-1300
106
10,058
+33,000
33
20000
ALTITUDE (ft)
15000
10000
5000
0
-5000
45
55
65
75
85
95
PRESSURE (kPA)
105
115
125
Figure 6. Altitude vs. Pressure
AN3956
Sensors
Freescale Semiconductor
11
At low elevations, a square meter on the earth’s surface has greater weight above it than at higher altitudes. This is due to the
mass of water vapor and air that sits upon it. Imagine cubes of air and water vapor stacked from the ground to space. At the low
altitude there is more cubic mass above, while higher altitudes will have less of these stacked above it.
Air and water vapor will compress more at sea level and the air is significantly denser than at high altitude. The density is not
uniform with altitude, and thus the pressure is not either. The reason for altitude’s non-linear relationship is that air has infinite
compressibility. It disproportionately compresses more as weight is placed upon it. Hence the graph of Pressure vs. Altitude seen
in Figure 6.
The simplified mathematical equation used to calculate altimetry in Table 3 is:
ph = p0 ⋅ e
–h
-----------------7990m
p0
h = 18400m ⋅ log ------ph
(eq. 1)
(eq. 2)
Assuming p0 = 101.3 kPa
ph - Pressure at height h
po - Initial Pressure point at sea level or 101.3 kPa
Calculations for a 24-bit ADC
First: Figuring out how the 24-bit ADC translates to counts, followed by pressure and altitude.
Table 4.
ADC Resolution
Range of ADC Counts
8-bit
0 to 255
12-bit
0 to 4095
16-bit
0 to 65,535
18-bit
0 to 262,143
24-bit
0 to 16,777,215
24-bit ADC LTC2442 reference voltage is 4.1V (temperature and voltage stable shunt).
MPXM2102A has a 16.4 mV span @ 4.1V supply.
Output is gained x 98.8 by instrumentation amplifier.
Span of differential amplified signal is now 1.62V.
Low pressure end of 0 kPa input is approximately 0V seen at the differential amplifier output.
Conversely the higher end of the pressure reading at 100 kPa is = 1.62V.
SPAN of MPXM2102A after Differential Instrumentation Amplifier is now 1.62V.
The 24-bit ADC would have a resolution of 4.1V/16777215 counts or 0.244 μV per an ADC count. Since the differential span
of the sensor is 1.62V after the amplifier, the span of 0 to 100 kPa can be seen as a ADC value of 0 counts to 6629045 counts.
This makes each ADC count equivalent to 0.0000151 kPa or 0.0151 Pa. The LTC2442’s value was shortened to a 18-bit
conversion to minimize the baseline noise seen on the ADC output.
For an 18-bit ADC conversion, 4.1V/262143 equals a resolution of 15.6 μV per a single ADC count. Since the differential span
of the sensor is 1.62V after the amplifier, the span of 0 to 100 kPa can be seen as a ADC value of 0 counts to 103846 counts.
This makes each ADC count for the pressure span equivalent to 0.000963 kPa or 0.963 Pa.
AN3956
Sensors
Freescale Semiconductor
12
Summarizing in Table 5
Table 5.
ADC Type
Resolution (μV/ADC)
Resolution (kPa/ADC)
24-bit
0.244 μV
0.0000151 kPa
18-bit
15.6 μV per 1 ADC count
0.000963 kPa per 1 ADC count
DEMOAPEXSENSOR can read a 0.000963 (kPa/ADC count) step for a 0 to 100kPa MPXM2102A sensor.
The formulas earlier were shown to reference the pressure to altitude relationship.
Converting all this to altitude:
Table 6.
Distance
Pressure (mB)
Pressure (kPa)
Voltage Change (μV)
ADC (counts)
0.5 m
0.05
0.005
0.81
5.19 so ~5
1m
0.11
0.011
1.78
11.4 so ~11
3 ft
0.09
0.009
1.46
9.35 so ~9
1 ft
0.03
0.003
0.49
3.11 so ~3
Reviewing Table 6, the DEMOAPEXSENSOR has code written to interpret small pressure changes and convert these to
altitude. The conversion from pressure to altitude still has to use the exponential equation for a proper conversion. But the
approximate distances and the ADC count equivalent are shown here. These are approximate across the pressure range but as
written in the demo code, the pressure is determined first, the altitude second. The altitude is calculated via the pressure value
inserted into the exponential altitude-pressure formula.
Experimental Altimetry Section
The preceding section on Altimetry has used the pressure sensor value to convert the pressure to an altitude reading. This
value of pressure is not linear with vertical height as detailed in the graph of Figure 6. However if a curved line is magnified
enough, the end result can be treated as a straight line. The “Experimental” section of the Altimeter/Barometer tries this particular
method. Due to changing air currents and unstable smaller resolution, it may require outdoor demonstration to get better results.
In this example the chart outlines the calibration routine.
• To calibrate the part, first place the board on the floor or table in front of you.
• Wait until the low pass filtered value is stable then press Enter. This saves the “0 level” barometric pressure.
• Following this, place the board about 3 feet above the “0 level”. Either this is at waist height if previously on the floor, or
above your head if previously on the table. When the value stabilizes, press Enter again.
Now the display will output the distance in smaller increments than 1 foot. Notice how it tends to jump around, and the “0 level”
shifts. This Experimental section shows how this method while being more accurate is not as stable as the exponential method
to see pressure. The resolution is reasonable for a short period of time before barometric changes in pressure change the
calibration.
AN3956
Sensors
Freescale Semiconductor
13
Filtered Value
3ft level lower P
Calibration Section
Constantly Running
Difference in
Pressure
Resolution=
(Difference)/3ft
Filtered Value
0ft level higher P
100ms Sample of raw
Pressure ? 24bit ADC
Twice Low-pass
filtered value ? 18bits
usable data
Current Pressure
value stored
Altitude in ft =
[Current Pressure –Zero Pressure Value]/3
Figure 7. APEX Short Distance Calibration Routine
DISSECTION OF THE ISSUES FACING THE PRESSURE READING
Note that with trying to resolve flowchart in Figure 7, there are issues as mentioned with the physical surroundings. A/C on/off
cycling along with airflow in the form of a breeze. Doors opening and closing change the pressure dynamic of a room as the air
flows in or out. This leads to the shifting in the zero level of the altitude as demonstrated in the flowchart.
This causes the scenario of leaving the APEX on the table and seeing that the 0 foot reading shifts up and down – due to the
many root causes in barometric pressure change. This is shown as an ‘experiment’ in the demo board. A straight linear pressurealtitude can sometimes work, but generally the shifting pressure wreaks havoc on the result.
Multiple sensor systems can be used to possibly stabilize the result. For example, a multiple sensor system can use the
accelerometer to detect movement and re-zero altimeter readings, if pressure changes are not related to movement.
High Resolution Altimetry Customer Implementations
Altimetry
Raw Value
Altitude
0x017c1d
459m
2(LP) value
Pressure
0x017c1f
95.365 kPa
In the Altimetry screen shot as see in the Quick Start Guide, note the raw and the twice Low-Pass filtered values. These are
converted using the pressure equations 1 and 2 as seen on page 12 for pressure and altitude conversion. The APEX does not
have a calibration for the altitude as most customer implementations of high resolution pressure, zero a point and measure the
dynamic change in meters for a given amount of time. The following are examples of ways to implement a high resolution
altimeter with focus on the ‘dynamic’ changing pressure rather than a constant absolute altitude reading.
Altimeter Example 1:
A person sets a zero point before hiking a steep hill. At the top of the hill, the change in barometric pressure is related to meters
or feet. This is a measure of the dynamic change of pressure over a short distance. This is a targeted application versus the other
application of knowing the altitude from sea level at all times after one factory calibration.
AN3956
Sensors
Freescale Semiconductor
14
Altimeter Example 2:
A GPS equipped smart-phone loses GPS signal as it enters a building. Knowing the approximate elevation with the GPS, the
beginning ‘zero point’ is 300 m. Entering the building the pressure sensor starts measuring the elevation, and tries to calculate
the height in meters.
Issues in this Example for Consideration:
• When entering a building from outside, a sudden rise in pressure is highly probable. This will send two different scenarios.
It could signify that the user has ‘fallen’ in altitude by several meters (such as jumping off a building or small cliff). Or they
have entered into a building with significant pressurized airflow (typical of an air-conditioned lobby with high air flow).
• Buildings vary on height per a floor. Lobbies of sky-rises have higher ceilings. Hotel accommodation floors tend to have
shorter standard heights. A restaurant located halfway or on top of the building may have a higher ceiling. The main point
is that the altitude in meters does not ideally correspond to floor location.
• Large buildings can be pressurized or not. It depends on building design. Some stadiums for sporting events are
pressurized to keep a fabric roof afloat. Tall high-rises have multiple stages of air-conditioning units. This leads to varied
pressure per a floor depending on that section’s on/off cycle, fan speed, or the air-tight nature of that section. Elevator
shafts also can equalize pressure, or create some pressure change as elevators move up and down.
• Smart use of Altimetry in tall buildings would use building information stored in a ‘smart’ GPS device so the altitude can
translate to floor level. This way location based services, emergency 911, etc. can know which floor the user is located.
MPL115A Miniature Barometer DEMOAPEXSENSOR
The MPL115A is a small 5 x 3 x 1.2 mm digital absolute pressure sensor. It is available in either I2C or SPI version. It has a
pressure range of 50 to 115 kPa. This narrower range is more application specific for events occurring in that altitude or in devices
requiring that pressure. In this section, the DEMOAPEXSENSOR’s implementation of the MPL115A and the information
displayed on the APEX is described.
In the Quick Start Guide section, the “Barometer Compensated Pressure Output” describes the compensated Pressure output
of the MPL115A in screen shots of the DEMOAPEXSENSOR.
Barometer Compensated Pressure Output
MPL115A2
Raw Values
Press ADC
74c0
0467
Temp ADC
6b40
0428
ENTER for Coefficients
6 Coefficients
ao = 3dc4
c11 = f8a0
b1 = bd7a
c12 = 2flc
b2 = c299
c22 = 0dc0
Compensated Pressure
PComp =9778 kPa
Altitude = 365 m
Stage 1
Stage 2
Stage 3
Raw Values of Temperature
and Pressure displayed on
LCD screen.
Display of 6 coefficients listed
on LCD screen.
Display of Compensated
Pressure output in kPa units.
The MPL115A’s Implementation is described in detail in the Application Note AN3785; How to Implement the Freescale
MPL115A Digital Barometer. Essentially in the LCD screen shots above, the Raw values of Pressure and Temperature are
displayed in Hexadecimal and Decimal format. Following this, the six coefficients MSB+LSB are shown in Hex format. The
combination of this data (streamed via I2C or SPI from the MPL115A) is used at the host MCU to calculate the Pcomp value.
Using eq. 2, the altitude is calculated and shown in meters.
The Pcomp value is the compensated absolute pressure value. This value unlike the analog pressure sensors does not require
any calibration trim, or offset auto zero. The Pcomp spec for the MPL115A is such that the value has an accuracy of ± 1kPa. The
advantage is implementing the sensor and having the compensated pressure readings without any additional calibration etc. on
the customer side.
As stated in AN3785, the MCU has to apply the equation below for Pcomp given that a0, b1, b2, c11, c12, c22 are coefficients
stored in MPL115A registers. Padc and Tadc are the raw ADC values of Pressure and Temperature that are clocked out of
MPL115A digitally.
Pcomp = a0 + ( b1 + cl ⋅ Padc + c12 ⋅ Tadc ) ⋅ Padc + ( b2 + c12 ⋅ Tadc ) ⋅ Tadc
(eq. 3)
AN3956
Sensors
Freescale Semiconductor
15
This is applied in the MCU code as a series of operations so the MCU does not have to apply the equation directly. The
following is a possible sequence for the calculation Pcomp, the trimmed pressure output. Input values are in bold.
c11x1 = c11 * Padc
a11 = b1 + c11x1
c12x2 = c12 * Tadc
a1 = a11 + c12x2
c22x2 = c22 * Tadc
a2 = b2 + c22x2
a1x1 = a1 * Padc
y1 = a0 + a1x1
a2x2 = a2 * Tadc
Pcomp = y1 + a2x2
Note that the Altitude measurement displayed for the MPL115A cannot be directly compared to the previous section on the
MPXM2102A. The MPL115A has an internal 10-bit ADC, with an accuracy of ±1kPa. The system set up on the
DEMOAPEXSENSOR for the MPXM2102A shows less than 1m resolution with a 24-bit ADC. The additional hardware cost,
digital and analog noise filtering, and calibration required is substantial compared to implementing the MPL115A directly to an
MCU. The value of the altitude changes constantly on the display, but it is also a raw conversion. It could be filtered, sampled in
longer intervals etc. to give the illusion of a more stable value. Here it is shown simply to get an idea of the raw conversion result.
The MPL115A can be used to measure changes in vacuum or for barometric pressure rather than the MPXM2102A.
In the Quick Start Guide there is a section to set a threshold above the current barometric pressure for an alarm. When the
alarm is set, the status LEDs will light up green. After the alarm threshold is reached, the red LED toggles on/off while a buzzer
is sounded. This can be activated via waiting for a pressure change, or applying pressure to the DEMOAPEXSENSOR. A clear
Ziploc bag or syringe with a soft applicator tip useful in activating the alarm.
Weather Station Implementation
Freescale application note, AN3914, details altimetry and barometric weather systems and also includes code examples from
the DEMOAPEXSENSOR. There are two sections in the APEX board; a simple weather station or an advanced method. The
simple method does a comparison by asking the user to input their known altitude, and comparing this pressure to that of the
MPL115A. The delta in the value is compared in the Table 7.
Table 7.
Analysis
Output
dP > +0.25 kPa
Sun Symbol
-0.25 kPa < dP < 0.25 kPa
Sun/Cloud Symbol
dP < -0.25 kPa
Rain Symbol
This is typical of a simple application and the APEX simulates a desktop barometer that is commonly bought at retailers.
A more advanced version of this calculates the pressure change by taking values over time and seeing the delta change over
a 3 hour period. This is outlined in Table 8 (AN3914).
Table 8. Advanced Weather Determination
Analysis
Output
dP/dt > 0.25 kPa/h
Quickly rising High Pressure System, not stable
0.05 kPa/h < dP/dt < 0.25 kPa/h
Slowly rising High Pressure System, stable good weather
-0.05 kPa/h < dP/dt < 0.05 kPa/h
Stable weather condition
-0.25 kPa/h < dP/dt < -0.05 kPa/h
Slowly falling Low Pressure System, stable rainy weather
dP/dt < -0.25 kPa/h
Quickly falling Low Pressure, Thunderstorm, not stable
AN3956
Sensors
Freescale Semiconductor
16
Waterlevel Implementation with the MPXV5004G
The DEMOAPEXSENSOR has the MPXV5004G gauge pressure sensor on board. This is located on the backside of the demo
board. It has a top port, which is to be used with the supplied high temp silicone hose.
The output of the MPXV5004G is shown in Table 9.
Table 9. Operating Characteristics (VS = 5.0 VDC, TA = 25°C unless otherwise noted, P1 > P2)
Characteristic
Symbol
Min
Typ
Max
Units
Pressure Range
POP
0
—
3.92
400
kPa
mm H2O
Supply Voltage
VS
4.75
5.0
5.25
VDC
Supply Current
IS
—
—
10
mAdc
Span @ 306 mm H2O (3 kPa)
Full Scale Span @ 400 mm H2O (3.92 kPa)
VFSS
—
—
3.0
4.0
—
—
V
Offset
VOFF
0.75
1.0
1.25
V
V/P
—
1.0
—
V/kPa
—
—
—
—
—
—
—
—
—
±1.5
±2.5
±6.25
%VFSS with auto zero
%VFSS with auto zero
%VFSS without auto zero
Sensitivity
Accuracy
0 to 100 mm H2O (10 to 60°C)
100 to 400 mm H2O (10 to 60°C)
0 to 400 mm H2O (10 to 60°C)
The part has a offset of 1V with a sensitivity of 9.8 mV/mm H20. On the DEMOAPEXSENSOR the value is sampled with a 12bit ADC from the JM60 MCU. Note the following when considering waterlevel:
• It is important to implement Auto Zero (AN1636) to improve accuracy.
• Calibration can be done, ideally with a two point calibration.
• The sensor must be implemented with an air column buffer between the liquid and the sensor. This is done with a section
of tubing as in Figure 8.
• It is a gauge application, so the pressure measured is with respect to barometric pressure; when elevation varies, the
pressure seen at the sensor is the same, only dependent on liquid height.
Figure 8. Waterlevel Connection to Pressure Sensor
Curved Bottom
Improved resolution when tank
is almost empty
More vertical height per
less volume H2O
Figure 9. Hot Water Heater
Figure 10. Conical Bottom for Measurement
AN3956
Sensors
Freescale Semiconductor
17
Figure 9 and Figure 10 are examples of water measurement. In the hot water heater to the left, although the temperature of
the water can be high, a long enough tube combined with air column separation provides a buffer for measurement. Water and
Air are good insulators, so temperature variation can be quite drastic in a short distance. This is a design advantage in isolating
the sensor from heat.
In Figure 10 the diagram has a method to improve resolution of the water level. The vertical height measurement is kept
constant, but the volume of water dispensed or left in the bottom is improved. This is done by simply making a conical bottom.
The resolution in vertical height can be used to improve the volume measurement. Additional ADC counts per a volume of water
are achieved, than a shape with a broad based bottom.
AUTO ZERO
A summary of the application note AN1636 is that the offset of the pressure sensor can change during board mount, stress,
or temperature shifts. By sampling the offset pressure (voltage output with no pressure input) and storing this value in the MCU,
the changes in the offset are negated. This improves the overall accuracy of the voltage output of the sensor, since the offset
changes are negated. Normally this would occur in a final product when there is a startup or a cycle when the sensor is not
pressurized.
CALIBRATION
The best calibration would be a two part calibration. A Pressure would be taken at 0 mm of H2O and also when the tubing is
at 40 cm of H2O. The difference in ADC counts divided by 40 cm will give the number of ADC counts per a cm etc. for each sensor.
This is the best calibration, but is not implemented on the DEMOAPEXSENSOR in software rev 1.0.
First Point: 0 Level, Water Surface
Second Point: Bottom of Container
Figure 11. Two Part Calibration
AN3956
Sensors
Freescale Semiconductor
18
Inertial MMA7361L
The DEMOAPEXSENSOR has a quick implementation of the 3 axis selectable low-g accelerometer. Notably the demo board
implements the tilt function of the accelerometer and Freefall detection. The Quick Start Guide shows the modes to select either
function.
TILT ANGLE ON THE DEMOAPEXSENSOR
The ADC counts are converted to tilt angles using the equation below:
ΔV
Vout = Voff + ⎛⎝ -------- ⋅ 1.0g ⋅ Sinθ⎞⎠
Δg
(eq. 4)
Where:
Vout = Analog output of accelerometer
Voff = Offset voltage of accelerometer
V/g = Sensitivity
1.0g = Earth’s gravity
θ = Tilt Angle
Note: MMA7361 was set to a g-level of 1.5 g.
Offset voltage is typically 1.65V @ 3.3V biasing supply
FREEFALL DETECT ON THE DEMOAPEXSENSOR
Freefall detect is the situation where all three axes of the inertial sensor converge towards the offset or ‘0g’ range. This is also
given as an output on the MMA7361L as the 0g-Detect pin. ‘1’ or logic high is the output for a detected Freefall. Note that this is
also for Freefall in a linear fashion such that the board is not spinning or in rotation as it falls. The DEMOAPEXSENSOR emits a
buzzer noise and a flashing red LED as the Freefall detect occurs.
AN3956
Sensors
Freescale Semiconductor
19
How to Reach Us:
Home Page:
www.freescale.com
Web Support:
http://www.freescale.com/support
USA/Europe or Locations Not Listed:
Freescale Semiconductor, Inc.
Technical Information Center, EL516
2100 East Elliot Road
Tempe, Arizona 85284
1-800-521-6274 or +1-480-768-2130
www.freescale.com/support
Europe, Middle East, and Africa:
Freescale Halbleiter Deutschland GmbH
Technical Information Center
Schatzbogen 7
81829 Muenchen, Germany
+44 1296 380 456 (English)
+46 8 52200080 (English)
+49 89 92103 559 (German)
+33 1 69 35 48 48 (French)
www.freescale.com/support
Japan:
Freescale Semiconductor Japan Ltd.
Headquarters
ARCO Tower 15F
1-8-1, Shimo-Meguro, Meguro-ku,
Tokyo 153-0064
Japan
0120 191014 or +81 3 5437 9125
[email protected]
Asia/Pacific:
Freescale Semiconductor China Ltd.
Exchange Building 23F
No. 118 Jianguo Road
Chaoyang District
Beijing 100022
China
+86 010 5879 8000
[email protected]
For Literature Requests Only:
Freescale Semiconductor Literature Distribution Center
1-800-441-2447 or +1-303-675-2140
Fax: +1-303-675-2150
[email protected]
AN3956
Rev. 1
09/2010
Information in this document is provided solely to enable system and software
implementers to use Freescale Semiconductor products. There are no express or
implied copyright licenses granted hereunder to design or fabricate any integrated
circuits or integrated circuits based on the information in this document.
Freescale Semiconductor reserves the right to make changes without further notice to
any products herein. Freescale Semiconductor makes no warranty, representation or
guarantee regarding the suitability of its products for any particular purpose, nor does
Freescale Semiconductor assume any liability arising out of the application or use of any
product or circuit, and specifically disclaims any and all liability, including without
limitation consequential or incidental damages. “Typical” parameters that may be
provided in Freescale Semiconductor data sheets and/or specifications can and do vary
in different applications and actual performance may vary over time. All operating
parameters, including “Typicals”, must be validated for each customer application by
customer’s technical experts. Freescale Semiconductor does not convey any license
under its patent rights nor the rights of others. Freescale Semiconductor products are
not designed, intended, or authorized for use as components in systems intended for
surgical implant into the body, or other applications intended to support or sustain life,
or for any other application in which the failure of the Freescale Semiconductor product
could create a situation where personal injury or death may occur. Should Buyer
purchase or use Freescale Semiconductor products for any such unintended or
unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and
its officers, employees, subsidiaries, affiliates, and distributors harmless against all
claims, costs, damages, and expenses, and reasonable attorney fees arising out of,
directly or indirectly, any claim of personal injury or death associated with such
unintended or unauthorized use, even if such claim alleges that Freescale
Semiconductor was negligent regarding the design or manufacture of the part.
Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc.,
Reg. U.S. Pat. & Tm. Off.
All other product or service names are the property of their respective owners.
© Freescale Semiconductor, Inc. 2010. All rights reserved.