Introduction: Arduino BMP180

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

GND -> GND

SCL -> SCL

SDA ->SDA

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); }

Comments

author
JoãoG45 (author)2017-09-22

Uso esta placa normalmente com alimentação de 5V!. Ela vem com regulador de tensão incorporado. Uso também um conversor de nível para se comunicar com arduino 5V.

author
ramji12 (author)2017-02-26

Kindly get through the image attached and suggest me what initialization error I had did. The altitude in my place is 6.7 m. The program is not entering into the loop structure.

BMP 180 initialization error.png
author
ShubhamL9 (author)2017-01-15

Arduino: 1.8.1 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\shubh\OneDrive\Documents\Arduino\sketch_jan15a\sketch_jan15a.ino:3:51: fatal error: SFE_BMP180.h: No such file or directory

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

^

compilation terminated.

exit status 1

Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with

"Show verbose output during compilation"

option enabled in File -> Preferences.

author
CrtSuznik (author)2016-12-21

not the correct library in the code (from what i can see)

Also, is the module 5V compatible, since there's a 3.3V regulator on it?

author
tomatoskins (author)2015-05-07

Really cool project! What plans do you have for this project?

author
samuel123abc (author)tomatoskins2015-05-07

Hello,

Thanks for your awesome feedback! I do not really have any plans, in the future I will try to make an intractable to connect a LCD screen and display temp and pressure on it. Like a weather station. Again thanks for your feedback.

Samuel

author

*instructable not intactable haha

About This Instructable

12,484views

39favorites

License:

Bio: 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 ... More »
More by samuel123abc:Real time clock using DS3231 (EASY)Controlling 120-240 VAC with a relay using arduinoNokia 5110 graphics tutorial
Add instructable to: