In this example we show how to connect a BMP180 to a MSP-EXP432P401R LaunchPad, the example will use the Energia IDE. I used a BMP180 module, which you can see below
The BMP180 is a digital barometric pressure sensor of Bosch Sensortec, here is some technical data of the module
Parameter | Technical data |
---|---|
Pressure range | 300 … 1100 hPa |
RMS noise expressed in pressure | 0.06 hPa, typ. (ultra low power mode) 0.02 hPa, typ. (ultra high resolution mode) |
RMS noise expressed in altitude | 0.5 m, typ. (ultra low power mode) 0.17 m, typ. (ultra high resolution mode) |
Relative accuracy pressure VDD = 3.3 V |
950 … 1050 hPa/ ±0.12 hPa @ 25 °C/ ±1.0 m 700 … 900 hPa/ ±0.12 hPa 25 … 40 °C/ ±1.0 m |
Absolute accuracy p = 300…1100hPa (Temperature = 0…+65°C, VDD = 3.3. V) |
Pressure: -4.0 … +2.0 hPa Temperature: ±1 °C, typ. |
Average current consumption (1 Hz data refresh rate)
Peak current |
3 μA, typical (ultra-low power mode) 32 μA, typical (advanced mode)650 μA, typical |
Stand-by current | 1.62 … 3.6 V |
Supply voltage VDDIO | 1.62 … 3.6 V |
Supply voltage VDD | 1.8 … 3.6 V |
Operation temp. Range full accuracy” |
-40 … +85 °C 0 … +65 °C |
Connection
Here is a picture of the launchpad so you can see what pins we are referring to below in the table
Module Connection | MSP432 Connection |
SDA | J1-10 SDA |
SCL | J1-9 SCL |
Gnd | J3-22 Gnd |
Vin | J1-1 3.3v |
Code
You need to import the following library – https://github.com/astuder/BMP085-template-library-Energia
[codesyntax lang=”cpp”]
#include <Wire.h> // required by BMP085 library #include <BMP085_t.h> // import BMP085 template library BMP085<0> PSensor; // instantiate sensor, 0 = low precision pressure reading void setup() { Serial.begin(9600); // initialize serial, used to display readings in Serial Monitor Wire.begin(); // initialize I2C that connects to sensor PSensor.begin(); // initalize pressure sensor } void loop() { PSensor.refresh(); // read current sensor data PSensor.calculate(); // run calculations for temperature and pressure Serial.print("Temperature: "); Serial.print(PSensor.temperature/10); // display temperature in Celsius Serial.print("."); Serial.print(PSensor.temperature%10); // display temperature in Celsius Serial.println("C"); Serial.print("Pressure: "); Serial.print((PSensor.pressure+50)/100); // display pressure in hPa Serial.println("hPa"); delay(5000); // wait a while before next loop }
[/codesyntax]
Output
Open the serial monitor and you should see something like this
Temperature: 23.8C
Pressure: 986hPa
Temperature: 23.8C
Pressure: 986hPa
Temperature: 23.8C
Pressure: 986hPa
Temperature: 23.8C
Pressure: 986hPa
Temperature: 23.8C
Pressure: 986hPa
Temperature: 23.8C
Links
1PCS GY-68 BMP180 Replace BMP085 Digital Barometric Pressure Sensor Module For Arduino