BMP180, the temperature and barometric pressure sensor
The BMP180
The BMP180 is an I2C sensor by Bosch Sensortec, measuring the ambient temperature and the barometric pressure and can be used in combination with e.g. the SHT30 to provide weather data. It is described in the data sheet
https://media.digikey.com/pdf/Data%20Sheets/Bosch/BMP180.pdf.
Bosch Sensortec provides a driver for this module
https://github.com/BoschSensortec/BMP180_driver ,which must be integrated into the embedded system in use by providing the I2C access routines. The driver is supplied in C and must be ported to MicroPython if we want to use it with our ESP32 MicroPython interpreter. I have written such a port and added it to our MicroPython version.
The driver is implemented as a Python class Bmp180 in a file Bmp180Class.py with the following methods:
- __init__(): Check if a BMP180 is connected to the I2C bus and reads the calibration values.
- setDebug(onOff): switches debug mode on or off
- dummyCalib(): uses the default calibration values from the data sheet
- setUncompensatedTestValues(): Sets the uncompensated test values from the data sheet for temperature and pressure
This allows to test the conversions to physical values in combination with dummyCalib() and convert(). The correct result is given in the data sheet.
- setResolution(res): sets the measurement resolution
- getResolution(): returns the current measurement resolution
- chipID(): returns the chip id. This should be 0x55
- measure(): makes a measurement and converts it to physical values using the calibration from the BMP180 EPROM.
- getTemperature(): returns the physical temperature from the last measurement
- getPressure(): returns the physical pressure value from the last measurement
- getCalib(): read the calibration values from the BMP180 EPROM
- convert(): Converts the uncompensated values to physical values
Exercise 1:
Read and print out the chip id
Exercise 2:
Set the default uncompensated values as well as the default calibration values from the data sheet and call convert() to calculate the corresponding physical values. Compare the results to the example in the data sheet.
Exercise 3:
Make a measurement and print the current temperature and barometric pressure.
--
Uli Raich - 2021-11-25
Comments