B4R

B4R Arduino and BMP180 pressure sensor example

The BMP180 is the function compatible successor of the BMP085, a new generation of high precision digital pressure sensors for consumer applications.

The ultra-low power, low voltage electronics of the BMP180 is optimized for use in mobile phones, PDAs, GPS navigation devices and outdoor equipment. With a low altitude noise of merely 0.25m at fast conversion time, the BMP180 offers superior performance. The I2C interface allows for easy system integration with a microcontroller.

The BMP180 is based on piezo-resistive technology for EMC robustness, high accuracy and linearity as well as long term stability.

Key features

Pressure range: 300 … 1100hPa (+9000m … -500m relating to sea level)
Supply voltage: 1.8 … 3.6V (VDD)
Package: LGA package with metal lid
Small footprint: 3.6mm x 3.8mm
Super-flat: 0.93mm height
Low power: 5µA at 1 sample / sec. in standard mode
Low noise: 0.06hPa (0.5m) in ultra low power mode and 0.02hPa (0.17m) advanced resolution mode

This is a picture of the breakout I used

Here is a quick wiring diagram, the critical thing here is that VCC is 3.3v

 

Layout

 

UNO and BMP180

 

Code

This code example requires the https://github.com/adafruit/Adafruit-BMP085-Library to be installed

[codesyntax lang=”cpp”]

#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region

Sub Process_Globals
‘These global variables will be declared once when the application starts.
‘Public variables can be accessed from all modules.
Public Serial1 As Serial
Public timer1 As Timer
Public bmptemp As Float
Public bmppressure As Float
Public bmpaltitude As Float
Public bmpsealevel As Float
End Sub

Private Sub AppStart
Serial1.Initialize(115200)
Log(“AppStart”)
RunNative(“setup”,Null)
timer1.Initialize(“timer1_Tick”,1000)
timer1.Enabled = True
End Sub

Private Sub Timer1_Tick
RunNative(“loop”,Null)
Log(“Temperature is: “, bmptemp, “°C”)
Log(“Pressure is: “, bmppressure, “Pa”)
Log(“Altitude is: “, bmpaltitude, “metres”)
Log(“Sea level Pressure is: “, bmpsealevel, “Pa”)
End Sub

#if C
#include <Wire.h>
#include “Adafruit_BMP085.h”
Adafruit_BMP085 bmp;
void setup(B4R::Object* o){
bmp.begin();
}

void loop (B4R::Object* o) {

b4r_main::_bmptemp =bmp.readTemperature();
b4r_main::_bmppressure =bmp.readPressure();
b4r_main::_bmpaltitude =bmp.readAltitude();
b4r_main::_bmpsealevel =bmp.readSealevelPressure();
}

#End if

[/codesyntax]

 

Output

 

This is what is logged out

Temperature is: 28.6000°C
Pressure is: 97577Pa
Altitude is: 316.4837metres
Sea level Pressure is: 97581Pa
Temperature is: 28.8000°C
Pressure is: 97583Pa
Altitude is: 315.9684metres
Sea level Pressure is: 97587Pa
Temperature is: 29°C
Pressure is: 97585Pa
Altitude is: 315.9684metres
Sea level Pressure is: 97584Pa
Temperature is: 29.2000°C
Pressure is: 97581Pa
Altitude is: 316.3991metres
Sea level Pressure is: 97582Pa
Temperature is: 29.4000°C
Pressure is: 97584Pa
Altitude is: 315.9684metres
Sea level Pressure is: 97584Pa

 

Links

1PCS GY-68 BMP180 Replace BMP085 Digital Barometric Pressure Sensor Module For Arduino

Related posts

B4R Arduino TM1637 7 segment display example

B4R Arduino and BH1750 Ambient Light Sensor example

B4R Arduino and ADXL335 accelerometer example