Library for BMP085 Digital Pressure Sensor

Bosch’s BMP085 is a digital pressure sensor. It is designed to be connected directly to a microcontroller via the I2C bus. I2C is a synchronous two-wire interface. The first wire, SDA, is used for data transmission, while second wire, SCL, transmits a clock, which is used to keep track of the data.

It features pressure measuring range of 300-1100 hPa (Pascal Unit) and temperature measurement from 0 to 65 °C.

BMP085 – STM32F4 connection is pretty straight forward. The only thing which needs attention is how you power the sensor. Its maximum supply voltage is 3.6V so don’t feed it with 5V but with 3V from STM32F4 or you can give him an external 3.3V supply.

Connection

I2C is an open-drain/open-collector communication standard. It needs pull-up resistors connected from the I2C lines to the supply to enable communication. The pull-up resistors pull the line high when it is not driven low by the open-drain interface.

Luckily STM pins can be set as pull-up so there is no need for additional resistors and I2C lines can be connected directly. In the scheme below BMP085 is powered by YuRobot external power supply and resistors are drawn, just to show how it should look like.

BMP085 with STM32F4 powered by external power supply
BMP085 with STM32F4 powered by external power supply

Library usage

Library is written for STM32F4 series but it should/could work with rest the of STM32F family. Project is created using STM32CubeMX with I2C3 enabled and clock on 180MHz.

  1. Read calibration data from E2PROM of sensor. It is called only once in main.
  2. Temperature and Pressure can be read by calling:

BMP085 functions

Example program

Library can be downloaded from the link below: [download id=”6″]

Full example is on github: STM32F4_BMP085

Related posts