Subido por esle 5

A Digital Barometer

Anuncio
A Digital Barometer
Using the SCP1000 barometric pressure sensor
Introduction
The SCP1000 is a MEMs (microelectromechanical system) capacitive absolute pressure sensor
manufactured by VTI Technologies of Vantaa, Finland. VTI was organized in 1991 to use its 3D MEMs
technology for accelerometers and pressure transducers in the automotive field. The range of the
SCP1000 is 30-120 kPa, appropriate to atmospheric pressure measurement. Over -20°C to +70°C, its
absolute error is less than 150 Pa. We shall use the default triggered low power mode that provides the
temperature in 19 bits over an SPI or an I2C interface. We shall use the SCP1000-D01 with the SPI
interface. The SparkFun breakout board can be interfaced with a PIC16F690 and a 4-digit serial 7segment display, which uses the same SPI parameters as the SCP1000. The power supply is 3.0 V
regulated with an LM317. The PIC and the display work well with this voltage. Note tyhat the maximum
voltage that can be applied to the SCP1000 is 3.6 V, so a 3.3 V regulator could be used.
The Barometer
Build the barometer on a SparkFun breadboard as in several of the neighboring projects, using a 9V wall
power supply and an LM317 voltage regulator arranged for a 3.0 V output. Provide an on-off switch and
an indicator LED. Include a 4-digit serial SPI 7-segment display as explained in the Digital Compass
project. Carefully solder a 7-pin header to the SEN-08161 board. I used RC3 of the PIC16F690 for the
sensor CS. The sensor SCK and MOSI are connected with the same pins as for the display, and the MISO
goes to RB4, pin 13 (which the display does not use). I used RB5, pin 12, as the DRDY output from the
sensor to the PIC.
Reading the pressure requires three SPI transactions, each beginning by pulling CS low and ending by
raising it again. The first transaction triggers a conversion by sending 0E and 0C. Simply load W and call
send to send a byte, as when using the display. Next, the high pressure byte is read from DATARD8 by
sending 7C and receiving the byte with a further send. This byte should be saved. Next, we read
DATARD16 by sending 80 and then reading the bytes with two sends, saving the first byte before
receiving the second. Now we have three bytes, with the three upper bits in one, and the 16 lower bits in
the other two. The SCP1000 addresses are 5 bits long (i.e., DATARD8 is 1F, or 011111). Adding 0 for a
read and a final 0 which always appears, we get 01111100 or 7C, the command we send over the SPI to
read the byte.
The msb corresponds to 64k Pa, or 65536 Pa. We could display the pressure either in mb (1 mb = 100 Pa)
or in torr (mmHg, 1.33 mb = 1 torr). I chose to display torr, when 13 bits can be used. If mb is diaplayed,
we can use only 11 bits. We use the same method as we used for the humidity display by adding the
decimal digits to be displayed for each bit. The msb contributes 491.6 torr or 655 mb, and each successive
bit half the preceding one, down to 0.1 torr or 1 mb. The first thing to do is to shift the three bytes three
places right, so it fits into 2 bytes. Then we add up the decimal digits that should be displayed, bit by bit,
as we did for the humidity. Finally, the four digits are displayed. We wait a few seconds, and do it all
again. There is no part of the program that we have not already used, so it should not be hard to write.
The SCP1000 also measures the temperature at each pressure measurement. Celsius degrees in a 13-bit
binary number can be read as two bytes at TEMPOUT, read address 84. Negative temperatures are
preceded by a sign bit 1. If this bit (bit 5 in the high byte) is set, we note the fact, then complement the
two bytes and add 1. Bit 12 coerresponds to 204.8 °C, and each succeeding bit half the preceding down to
bit 0 which corresponds to 0.05 °C. Decimal digits for display are found just as for the pressure, while
blanking leading zeros and adding a negative sign if necessary. I displayed the temperature and pressure
alternately.
Atmospheric Pressure
The first barometer was made by Torricelli in 1643, using a mercury column with a vacuum above it, so
that the weight of the column was supported by the pressure of the air on the reservoir. He was the first to
realize that the atmosphere had weight and give an explanation free of any supposed properties of a
vacuum, and proved it by having a friend take a barometer up a mountain. Even Galileo had believed that
air had no weight, as Aristotle did.
The "normal" atmospheric pressure at sea level is taken as 101325 Pa, or 1013.25 mb, or 760 mmHg, or
29.92 in Hg, or 14.7 psi. In an isothermal atmosphere, the pressure decreases according to p = p0 exp(Mgh/RT), where R = 8314, T in K, M = 28.96, g = 9.80665, and h is in m. The scale height RT/Mg is
8781 m at 300K. The atmosphere is not isothermal, of course. There is a lapse rate in the troposphere,
where the temperature decreases from 288.16 K at sea level to 216.66 K at the tropopause at 11 km
altitude.
For weather purposes, the pressure measured at some altitude is reduced to a sea level value, perhaps by
assuming an isothermal atmosphere down to sea level. At 300 K, and the Denver elevation of 1609 m, the
factor is 1.201, so a sea level pressure of 760 torr corresponds to an actual pressure of 633 torr, a
difference of 127 torr. In fact, the atmospheric pressure measured at Denver is around 630 torr. The
pressures quoted in weather reports are the adjusted pressure, not the actual measured pressure.
Better, drier weather is associated with a rising barometer, while worse, wetter weather is associated with
a falling barometer. Mechanical aneroid barometers were deliberately made sticky so that when tapped,
they would show whether the pressure was rising or falling.
References
The SCP1000-D01 is available from SparkFun Electronics as SEN-08161. Download the data sheet as
well. Be sure to get the full 1.75Mb data sheet, not the brief version.
The VTI website is at VTI
The Wikipedia articles on atmospheric pressure are useful, but not excellent. Reduction to sea level is
poorly explained.
Descargar