Introduction: Arduino BMP180

About: Hello, My name is Samuel, I am a student. I love micro controllers like arduino, they are my favorite interest. I also do geocaching, a worldwide treasure hunt game. I hope you enjoy my instructables! Samuel

This tutorial will show you how to connect the BMP180 (or BMP085) to arduino and displaying the data in the serial monitor. Enjoy!

Step 1: Parts

Let's get your parts together:

One arduino (10-15$ for a clone), I am using the mega although you may use any arduino you would like. Of course the micro controller can be displaced over future projects.

A BMP180 sensor (1-2$) Measures air pressure and has an embedded temperature sensor.

A few jumper cables (These do some already have at home, and do not have to be bought although I had to buy some for 2-3 $ (a pack of 60 pcs I think) ).

That's about what you need, now let's connect everything up.

Step 2: Connections

Remember that the BMP180 uses 3.3V, which if you connect the sensor to 5V it will be destroyed fast. Be sure to have your power cable disconnected throughout the connection part.

Connect your wires as following:

VIN (or VCC) -> Arduino 3.3V




Next let me give you my code:

Step 3: The Code

The code for this sensor is fairly simple, although you are going to need a library to get your values.

Go ahead and navigate here to download the library from adafruit. The code I used is found below:

(I have compiled and uploaded this code to my arduino and it work very well.) Thank you for reading!

#include <Wire.h> //Including wire library

#include <SFE_BMP180.h> //Including BMP180 library

#define ALTITUDE 35.6 //Altitude where I live (change this to your altitude)

SFE_BMP180 pressure; //Creating an object

void setup() { Serial.begin(9600); //Starting serial communication

Serial.println("Program started");

if (pressure.begin()) //If initialization was successful, continue Serial.println("BMP180 init success"); else //Else, stop code forever { Serial.println("BMP180 init fail"); while (1); } }

void loop() { char status; double T, P, p0; //Creating variables for temp, pressure and relative pressure

Serial.print("You provided altitude: "); Serial.print(ALTITUDE, 0); Serial.println(" meters");

status = pressure.startTemperature(); if (status != 0) { delay(status);

status = pressure.getTemperature(T); if (status != 0) { Serial.print("Temp: "); Serial.print(T, 1); Serial.println(" deg C");

status = pressure.startPressure(3);

if (status != 0) { delay(status);

status = pressure.getPressure(P, T); if (status != 0) { Serial.print("Pressure measurement: "); Serial.print(P); Serial.println(" hPa (Pressure measured using temperature)");

p0 = pressure.sealevel(P, ALTITUDE); Serial.print("Relative (sea-level) pressure: "); Serial.print(p0); Serial.println("hPa"); } } } } delay(1000); }