I recently acquired a BMP180 barometric pressure sensor and was pleased to see that it used the BMP085 library from Adafruit, what I was interested in was how accurate the altitude reading was. 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
Code
[codesyntax lang=”cpp”]
#include <Wire.h> #include <Adafruit_BMP085.h> // Connect VCC of the BMP180 sensor to 3.3V // Connect GND to Ground // Connect SCL to i2c clock thats A5 // Connect SDA to i2c data thats A4 Adafruit_BMP085 bmp; void setup() { Serial.begin(9600); if (!bmp.begin()) { Serial.println("BMP180 sensor not found"); while (1) {} } } void loop() { Serial.print("Temperature = "); Serial.print(bmp.readTemperature()); Serial.println(" *C"); Serial.print("Altitude = "); Serial.print(bmp.readAltitude(101500)); Serial.println(" meters"); Serial.println(); delay(1000); }
[/codesyntax]
Output
this was the reading from the serial monitor
Temperature = 22.90 *C
Altitude = 103.32 meters
To see how accurate this was I went to http://elevationmap.net and typed in my address, the stated elevation was 99m. Given that there was probably an additional couple of metres where the device was located in my house that's not too bad accuracy wise
Links
1PCS GY-68 BMP180 Replace BMP085 Digital Barometric Pressure Sensor Module For Arduino