Arduino BMP180

Published

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

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

Share

    Recommendations

    • Creative Misuse Contest

      Creative Misuse Contest
    • Water Contest

      Water Contest
    • Oil Contest

      Oil Contest

    8 Discussions

    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
    1 reply

    I have the same error too, did you get the solution for it?
    If yes, please put it here how to solve this.
    Thank you

    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.

    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.

    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?

    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