Arduino and the BMP085 environmental pressure and temperature sensor


The BMP085 I have is an I2C device with seven pins, but only four, Vcc, Gnd, SCA and SCL are used (pins are in that order). I found a number of sketches but feel that the best was the one on the Adafruit site,

I made one small change, I wanted to plug the sensor straight into the Arduino, so I made A2 and A3 power pins. If you want to do the same insert the following code into the sketch at the start of the void setup() loop

pinMode(17, OUTPUT);
digitalWrite(17, HIGH); // make this pin 5 volts
pinMode(16, OUTPUT);
digitalWrite(16, LOW); // make this pin Gnd

Just a word of warning if you do this, make sure your board needs 5 volts not 3.3 volts to power it and also make sure your pinout matches mine!

The altitude is only correct if you know exactly what the pressure is at sea level as this sketch assumes it is 101500 pascals. Height is calculated by knowing the difference in pressure between your location and sea level.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: