Total Pageviews

Saturday, October 18, 2014

BMP180 sensor and Arduino

   BMP180 sensor can give us information about pressure an temperature.
   This sensor is delivered on small module with 4 pins: Vin (+3.3V), GND, SDA and SCL.
   For testing, schematic is very simple:
   For control BMP180 sensor I use Adafruit-BMP085-Library, them test the example sketch.
   For a stand alone weather station with information about temperature and presure, I put a alphanumeric LCD display with 16 colons and 2 rows (1602):
and test montage is:
   I use this sketch:
// adapted sketch by niq_ro from &
#include <Wire.h>
#include <Adafruit_BMP085.h>

  This is an example for the BMP085 Barometric Pressure & Temp Sensor
  Designed specifically to work with the Adafruit BMP085 Breakout 
  These displays use I2C to communicate, 2 pins are required to  
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution

// Connect VCC of the BMP085 sensor to 3.3V (NOT 5.0V!)
// Connect GND to Ground
// Connect SCL to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5
// Connect SDA to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4
// EOC is not used, it signifies an end of conversion
// XCLR is a reset pin, also not used here

// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

/*                                    -------------------
                                      |  LCD  | Arduino |
 LCD RS pin to digital pin 7          |  RS   |   D7    |
 LCD Enable pin to digital pin 6      |  E    |   D6    |
 LCD D4 pin to digital pin 5          |  D4   |   D6    |
 LCD D5 pin to digital pin 4          |  D5   |   D4    |
 LCD D6 pin to digital pin 3          |  D6   |   D3    |
 LCD D7 pin to digital pin 2          |  D7   |   D2    |
 LCD R/W pin to ground                |  R/W  |   GND   |

Adafruit_BMP085 bmp;
void setup() {
  lcd.begin(16, 2);
  // Print a logo message to the LCD.
  lcd.setCursor(0, 1);
  lcd.print("creat de niq_ro");
  delay (2500);

  // Print another message to the LCD.
  lcd.setCursor(2, 0);
  lcd.print("termometru -");  
  lcd.setCursor(0, 1);
  lcd.print("barometru ver1.0");
  delay (2500);

  if (!bmp.begin()) {
 Serial.println("nu exita senzor compatibil BMP085 sau BMP180");
 while (1) {}
void loop() {
    Serial.print("Temperatura = ");
    Serial.println(" *C");
    Serial.print("Presiune = ");
    Serial.print(" Pa / ");
 //   Serial.print("Presiune = ");
    float presiune1 = bmp.readPressure()/101.325;
    presiune1 = presiune1 * 0.760;
    Serial.println(" mmHg");
    // Calculate altitude assuming 'standard' barometric
    // pressure of 1013.25 millibar = 101325 Pascal
    Serial.print("Altitudine = ");
    Serial.println(" m");

    Serial.print("Presiune la nivelul marii (calculata) = ");
    Serial.print(" Pa / ");
  //  Serial.print("Presiure la nivelul marii (calculata) = ");
    float presiune = bmp.readSealevelPressure()/101.325;
    presiune = presiune * 0.760;
    Serial.println(" mmHg");

  // you can get a more precise measurement of altitude
  // if you know the current sea level pressure which will
  // vary with weather and such. If it is 1015 millibars
  // that is equal to 101500 Pascals.
    Serial.print("Altitudine reala = ");
    Serial.println(" m");
   lcd.setCursor(1, 0);
   lcd.print("temp.=  ");
    if ( bmp.readTemperature() < 10)
     lcd.print(" "); 
   lcd.print("C   ");
   lcd.setCursor(1, 1);
   lcd.print("pres.= p");
   lcd.print("mmHg  ");
   In last weak-end, I received 3 pics from Dave ( with a shield for Arduino Uno, made after my schematic:
   He made with board with CNC Cutter:
   I change the sketch for present the temperature in Fahrenheit, not in Celsius degree, using information from article


  1. Replies
    1. thx... a photo with montage can send to me for put on article?

  2. not Work... RA9YS

  3. Arduino: 1.6.4 (Windows 8.1), Плата"Arduino Uno"

    sketch_jun20c.ino: In function 'void loop()':
    sketch_jun20c:94: error: 'class Adafruit_BMP085' has no member named 'readSealevelPressure'
    sketch_jun20c:99: error: 'class Adafruit_BMP085' has no member named 'readSealevelPressure'
    Multiple libraries were found for "Adafruit_BMP085.h"

    Used: C:\Users\user\Documents\Arduino\libraries\Adafruit_BMP085

    Not used: C:\Program Files (x86)\Arduino\libraries\Adafruit-BMP085-Library-master

    Not used: C:\Program Files (x86)\Arduino\libraries\Adafruit_BMP085

    Multiple libraries were found for "LiquidCrystal.h"

    Used: C:\Users\user\Documents\Arduino\libraries\LiquidCrystal

    Not used: C:\Users\user\Documents\Arduino\libraries\LiquidCrystal_I2C

    Not used: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal

    Not used: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal_I2C

    'class Adafruit_BMP085' has no member named 'readSealevelPressure'

    de RA9YS

    1. in sketch it use some data:
      go to this link and download sensor library to work...

  4. Hi. I'm using a BMP180 to read the pressure. But at !bmp.begin() it gives me the error message and stops. Can you help clear this out for me pleasE?

    1. you have error when you compile/verify the sketch? or after upload the sketch?
      you have Adafruit_BMP085.h from ?
      what Arduino board you use?

  5. felicitari !!!
    folosesc un bmp280, verific sketch totul scriu pe arduino totul ok.
    dar nu imi afiseaza nimic pe display !!!!!
    oare ce am gresit?
    de la bmp 280 la arduiono folosesc: VCC- 3.3 v; gnd-gnd; scl-a5; sda-a4

    1. eu am folosit BMP180... afisajul trebuia sa indice macar "Temp.=" si "Pres.="
      vad pe net ca BMP280 e total diferit:

    2. am conectat doar bmp 280 la arduino asa :VCC- 3.3 v; gnd-gnd; scl-a5; sda-a4, si cand citesc cu putty imi vin date de temp si presiune, dar cand folosesc si lcd (se lumineaza displayul dar nu afiseaza nimik)
      PS: am alimentat bmp280 si pe 5 v dar tot nimik

  6. RESPECT pt ceea ce faci si pt faptul ca invetii si pe altii.blogul tau e o comoara informationala .LA CIT MAI MULTE PROIECTE BRAVO !