public class BarometerBMP180 extends I2CComponent
Use a barometer to measure air pressure and temperature.
Some specifications:
Datasheet: BMP180
[datasheet - p.9]
The pressure and temperature data has to be compensated
by the callibration data of the E2PROM of the BMP180.
The BMP180 consists of a piezo-resistive sensor, an analog to digital
converter and a control unit with E2PROM and a serial I2C interface.
The BMP180 delivers the uncompensated value of pressure and temperature.
The E2PROM has stored 176 bit of individual callibration data.
This is used to compensate offset, temperature dependance and other
parameters of the sensor.
Example of use: BarometerBMP180Example
Modifier and Type | Class and Description |
---|---|
static class |
BarometerBMP180.HardwarePressureAccuracyMode
There exists 4 different hardware accuracy modes to deal with the BMP180 pressure measures.
|
Modifier and Type | Field and Description |
---|---|
static int |
BMP180_ADDRESS
Default i2c BMP180 address.
|
static int |
BMP180_MSB_REG_ADDR_AC1
BMP180 register MSB address of calibration coefficient AC1.
|
static int |
BMP180_MSB_REG_ADDR_AC2
BMP180 register MSB address of calibration coefficient AC2.
|
static int |
BMP180_MSB_REG_ADDR_AC3
BMP180 register MSB address of calibration coefficient AC3.
|
static int |
BMP180_MSB_REG_ADDR_AC4
BMP180 register MSB address of calibration coefficient AC4.
|
static int |
BMP180_MSB_REG_ADDR_AC5
BMP180 register MSB address of calibration coefficient AC5.
|
static int |
BMP180_MSB_REG_ADDR_AC6
BMP180 register MSB address of calibration coefficient AC6.
|
static int |
BMP180_MSB_REG_ADDR_B1
BMP180 register MSB address of calibration coefficient B1.
|
static int |
BMP180_MSB_REG_ADDR_B2
BMP180 register MSB address of calibration coefficient B2.
|
static int |
BMP180_MSB_REG_ADDR_MB
BMP180 register MSB address of calibration coefficient MB.
|
static int |
BMP180_MSB_REG_ADDR_MC
BMP180 register MSB address of calibration coefficient MC.
|
static int |
BMP180_MSB_REG_ADDR_MD
BMP180 register MSB address of calibration coefficient MD.
|
static int |
CONTROL_PRESSURE_REQUEST
Value sent to the control register to ask a new pressure
value in [OUT_MSB_ADDR, OUT_LSB_ADDR, OUT_XLSB_ADDR] registers.
|
static int |
CONTROL_REG_ADDR
Control register address.
|
static int |
CONTROL_TEMPERATURE_REQUEST
Value sent to the control register to ask a new temperature
value in [OUT_MSB_ADDR, OUT_LSB_ADDR] registers.
|
static int |
OUT_LSB_ADDR
Second register address containing calculated values:
respectively temperature or pressure, depending on previous value sent to control register.
|
static int |
OUT_MSB_ADDR
First register address containing calculated values:
respectively temperature or pressure, depending on previous value sent to control register.
|
static int |
OUT_XLSB_ADDR
Third register address containing calculated values:
respectively temperature or pressure, depending on previous value sent to control register.
|
static double |
PRESSURE_AT_SEA_LEVEL
The pressure at sea level, in hPa.
|
device, MAX_I2C_ADDRESS, MIN_I2C_ADDRESS
Constructor and Description |
---|
BarometerBMP180()
Default constructor for a new barometer BMP180 using the default i2c address of the component,
the ultra high resolution mode and a minimum timeout before refreshing the temperature value of 1 second.
|
BarometerBMP180(int i2cAddress,
BarometerBMP180.HardwarePressureAccuracyMode selectedHardwarePressureAccuracyMode,
int temperatureTimeout)
Constructor for a new barometer BMP180 using a specific i2c address,
a specific pressure accuracy mode, and a specific timeout to refresh the temperature value.
|
Modifier and Type | Method and Description |
---|---|
double |
calculateAbsoluteAltitude()
With the measured pressure p and the pressure at sea level p0,
the altitude in meters can be calculated with the international
barometric formula:
|
int |
calculateTruePressure()
Implements the algorithm presented in [datasheet - p.15] and
returns the compensated pressure in Pa.
|
double |
calculateTrueTemperature()
Implements the algorithm pressented in [datasheet - p.15].
|
int |
readUncompensatedPressure()
Read the uncompensated pressure value from the BMP180.
|
int |
readUncompensatedTemperature()
Read the uncompensated temperature value from the BMP180.
|
getDevice, getType, readSignedRegisterValue, readTwoSignedRegsiters, readTwoUnsignedRegisters, readUnsignedRegisterValue, writeUnsignedValueDirectlyToI2CDevice, writeUnsignedValueToRegister
public static final int BMP180_ADDRESS
public static final int CONTROL_REG_ADDR
public static final int CONTROL_TEMPERATURE_REQUEST
public static final int CONTROL_PRESSURE_REQUEST
public static final int OUT_MSB_ADDR
OUT_LSB_ADDR
,
OUT_XLSB_ADDR
,
Constant Field Valuespublic static final int OUT_LSB_ADDR
OUT_MSB_ADDR
,
OUT_XLSB_ADDR
,
Constant Field Valuespublic static final int OUT_XLSB_ADDR
OUT_MSB_ADDR
,
OUT_LSB_ADDR
,
Constant Field Valuespublic static final double PRESSURE_AT_SEA_LEVEL
public static final int BMP180_MSB_REG_ADDR_AC1
public static final int BMP180_MSB_REG_ADDR_AC2
public static final int BMP180_MSB_REG_ADDR_AC3
public static final int BMP180_MSB_REG_ADDR_AC4
public static final int BMP180_MSB_REG_ADDR_AC5
public static final int BMP180_MSB_REG_ADDR_AC6
public static final int BMP180_MSB_REG_ADDR_B1
public static final int BMP180_MSB_REG_ADDR_B2
public static final int BMP180_MSB_REG_ADDR_MB
public static final int BMP180_MSB_REG_ADDR_MC
public static final int BMP180_MSB_REG_ADDR_MD
public BarometerBMP180()
The timeout for the temperature values here is used to don't refresh the temperature value (read on the BMP180) too frequently, as recommended by the [datasheet - p.11].
public BarometerBMP180(int i2cAddress, BarometerBMP180.HardwarePressureAccuracyMode selectedHardwarePressureAccuracyMode, int temperatureTimeout)
The timeout for the temperature values here is used to don't refresh the temperature value (read on the BMP180) too frequently, as recommended by the [datasheet - p.11].
i2cAddress
- the i2c address of the BMP180 component.selectedHardwarePressureAccuracyMode
- the pressure accuracy mode.temperatureTimeout
- the minimum timeout before refreshing the temperature value, in milliseconds.public int readUncompensatedTemperature()
[datasheet - p.15]
public int readUncompensatedPressure()
[datasheet - p.15]
public double calculateTrueTemperature()
ATTENTION: the calculation of a new temperature value is limited by the b5UpdateTimeout. This is due to the fact that this value is also used with the calculateTruePressure(), and we don't need to update this value too frequenty (as recommended in the datasheet - p.11).
public int calculateTruePressure()
public double calculateAbsoluteAltitude()
altitude = 44330 * (1-(p/p0)^1/5.255)[datasheet - p.16]
Note: we recalculate here the calculated true pressure without any sampling rate problem. Indeed, the pressure sampling rate can increase up to 128 samples per second (in standard mode) for dynamic measurements.