Tuesday, April 19, 2016

Arduino Temperature and BMP085 pressure - Module GY-65

Today I will show you how to interface BMP085 atmospheric pressure sensor module with arduino, which is the temperature module and BMP085 pressure , like the one below:


BMP085 sensor interface with arduino
The name BMP085 comes from the name given to the sensor itself, as we see in the datasheet . In the case of the photo above module, the module code is GY-65. The module works with a voltage of 1.8 to 3.6V. Its pressure reading range is 300 to 1100 hPa (hectoPascal), which determines altitudes from 9000 meters above sea level by -500m. The connection to the controller is made ​​by only 2 pins, using the I2C interface. I use a library Adafruit, which you can download at that address . A parenthesis about this library is that when decompressing, the folder name is "Adafruit-BMP085-Library-master" . Unfortunately , the IDE does not accept name folder libraries with numbers and special characters, then rename the folder just for " BMP085 ". . Use the 1.0.5 version of the Arduino IDE, I do not know if it happens in other versions Library downloaded and installed, go to the circuit:


BMP085 Sensor Interface with Arduino

Take care not to reverse any connection to connect the wires, because usually the marking pins comes under the plate, getting hidden when you fit into the breadboard. The program below is based on the test program that comes along with the library, with the due translations to facilitate understanding:

// Program: Pressure test module BMP085 
// Author: Adafruit 
// translations and commentaries: Arduino and Co.

#include <Wire.h> 
#include <Adafruit_BMP085.h>

// Connect Vcc pin of the BMP085 to the Arduino pin 3.3V (5.0V NOT USE!) 
// Connect GND pin module to the Arduino GND 
// Connect the SCL pin module to analog pin 5 Arduino 
// Connect pin SDA module to pin 4 of analog Arduino 
// pin EOC (end of conversion) unused 
// XCLR pin is a reset pin is not used

Adafruit_BMP085 bmp;

void setup ()
{
  Serial.begin ( 9600 );
   if (bmp.begin ()) {
  Serial.println ( "Sensor BMP085 not found, check the connections!" );
   While ( 1 ) {}
  }
}

void loop ()
{
    Serial.print ( "Temperature =" );
    Serial.print (bmp.readTemperature ());
    Serial.println ( "C *" );

    Serial.print ( "Pressure =" );
    Serial.print (bmp.readPressure ());
    Serial.println ( "Pa" );

    // Calculate the elevation using the barometric pressure pattern 
    // of 1013.25 millibar = 101325 Pascal 
    Serial.print ( "Altitude =" );
    Serial.print (bmp.readAltitude ());
    Serial.println ( "m" );

  // It is possible to draw a more accurate measurement if you know 
  // the pressure at sea level, which varies with time / climate. 
  // If it is 1015 millibars, equals 101,500 Pascals.

    Serial.print ( "real Altitude =" );
    Serial.print (bmp.readAltitude ( 101500 ));
    Serial.println ( "m" );
    Serial.println ();

    delay ( 5000 );
}

Run the program and open the serial monitor. Arduino Mega, you must use pin 20 (SDA) and 21 (SCL). 


No comments:

Post a Comment