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
- setResolution(res): sets the measurement resolution
- getResolution(): returns the current measurement resolution
- chipID(): returns the chip id. This should be 0x55
- dummyCalib(): uses the default calibration values from the data sheet
- 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
Exercise 1:
Read and print out the chip id
Exercise 2:
Make a measurement and print the current temperature and barometric pressure.
--
Uli Raich - 2021-11-25
Comments