In this example we will create a temperature and altitude meter using a bm180 sensor and display the readings on an LCD shield
Lets look at the BMP180 first
The BMP180 is the new digital barometric pressure sensor of Bosch Sensortec, with a very high performance, which enables applications in advanced mobile devices, such as smartphones, tablet PCs and sports devices. It follows the BMP085 and brings many improvements, like the smaller size and the expansion of digital interfaces.
The ultra-low power consumption down to 3 μA makes the BMP180 the leader in power saving for your mobile devices. BMP180 is also distinguished by its very stable behavior (performance) with regard to the independency of the supply voltage.
Applications
– Indoor navigation
– GPS-enhancement for dead-reckoning, slope detection, etc.
– Sport devices, e.g. altitude profile
– Weather forecast
– Vertical velocity indication (rise/sink speed)
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 |
Pressure conv. Time | 5 msec, typical (standard mode) |
If you’re using an Arduino simply connect the VIN pin to the 5V or 3.3v voltage pin, GND to ground, SCL to I2C Clock (Analog 5) and SDA to I2C Data (Analog 4).
Parts List
Connection
In this example we show the connections to a typical LCD shield
Code
You need to add the adafruit bmp085 library, this is available in the library manager or from https://github.com/adafruit/Adafruit-BMP085-Library
[codesyntax lang=”cpp”]
#include <Wire.h> #include <LiquidCrystal.h> #include <Adafruit_BMP085.h> //setup for the LCD keypad shield LiquidCrystal lcd(8, 9, 4, 5, 6, 7); Adafruit_BMP085 bmp; void setup() { //init serial for some debug Serial.begin(9600); Serial.println("BMP180 Sensor Test"); //init bmp180 if (!bmp.begin()) { Serial.println("BMP180 sensor not found"); while (1) {} } //init LCD lcd.begin(16,2); //line 1 - temperature lcd.setCursor(0,0); lcd.print("Temp = "); //line 2 - humidity lcd.setCursor(0,1); lcd.print("Alt = "); } void loop() { // put your main code here, to run repeatedly: //display temperature and altitude on lcd lcd.setCursor(0,0); lcd.print("Temp = "); lcd.print(bmp.readTemperature()); lcd.setCursor(0,1); lcd.print("Alt = "); // you can get a more precise measurement of altitude // if you know the current sea level pressure which will // vary with weather and such. If it is 1015 millibars // that is equal to 101500 Pascals. lcd.print(bmp.readAltitude(101500)); delay(1000); }
[/codesyntax]