BMP 085  Barometric Modul

Hier das ältere Breakoutboard BMP085.

BMP 085 Digital Barometric Modul

bmp085Links zeigt das Modul mit dem Sensor von Bosch. Zwei 4K7 Widerstände im I²C Bus sind schon integriert. es Scheint auch ein Spannungsregler auf der Platine zu sein. Auf älteren Beschreibungen steht zwar 3,3 Volt. Mit 5Volt werde ich aber nicht testen zumal der Arduino ja auch 3,3V hergibt.

Rechts die Anschlüsse. Neben der Betriebspannung wird nur SCA und SCL benötigt.

 

 

 

 Hier ein kleines Programm von Ladyada zum testen. Das Bild rechts zeigt sie Ausgabe der Messwerte auf das Terminal. Es wird auch die Temperatur gemessen.BMP085 Messwerte

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>

/* This driver uses the Adafruit unified sensor library (Adafruit_Sensor),
   which provides a common 'type' for sensor data and some helper functions.
   
   To use this driver you will also need to download the Adafruit_Sensor
   library and include it in your libraries folder.

   You should also assign a unique ID to this sensor for use with
   the Adafruit Sensor API so that you can identify this particular
   sensor in any data logs, etc.  To assign a unique ID, simply
   provide an appropriate value in the constructor below (12345
   is used by default in this example).
   
   Connections
   ===========
   Connect SCL to analog 5
   Connect SDA to analog 4
   Connect VDD to 3.3V DC
   Connect GROUND to common ground
    
   History
   =======
   2013/JUN/17  - Updated altitude calculations (KTOWN)
   2013/FEB/13  - First version (KTOWN)
*/
   
Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);

/**************************************************************************/
/*
    Displays some basic information on this sensor from the unified
    sensor API sensor_t type (see Adafruit_Sensor for more information)
*/
/**************************************************************************/
void displaySensorDetails(void)
{
  sensor_t sensor;
  bmp.getSensor(&sensor);
  Serial.println("------------------------------------");
  Serial.print  ("Sensor:       "); Serial.println(sensor.name);
  Serial.print  ("Driver Ver:   "); Serial.println(sensor.version);
  Serial.print  ("Unique ID:    "); Serial.println(sensor.sensor_id);
  Serial.print  ("Max Value:    "); Serial.print(sensor.max_value); Serial.println(" hPa");
  Serial.print  ("Min Value:    "); Serial.print(sensor.min_value); Serial.println(" hPa");
  Serial.print  ("Resolution:   "); Serial.print(sensor.resolution); Serial.println(" hPa");  
  Serial.println("------------------------------------");
  Serial.println("");
  delay(500);
}

/**************************************************************************/
/*
    Arduino setup function (automatically called at startup)
*/
/**************************************************************************/
void setup(void)
{
  Serial.begin(9600);
  Serial.println("Pressure Sensor Test"); Serial.println("");
 
  /* Initialise the sensor */
  if(!bmp.begin())
  {
    /* There was a problem detecting the BMP085 ... check your connections */
    Serial.print("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!");
    while(1);
  }
 
  /* Display some basic information on this sensor */
  displaySensorDetails();
}

/**************************************************************************/
/*
    Arduino loop function, called once 'setup' is complete (your own code
    should go here)
*/
/**************************************************************************/
void loop(void)
{
  /* Get a new sensor event */
  sensors_event_t event;
  bmp.getEvent(&event);
 
  /* Display the results (barometric pressure is measure in hPa) */
  if (event.pressure)
  {
    /* Display atmospheric pressue in hPa */
    Serial.print("Pressure:    ");
    Serial.print(event.pressure);
    Serial.println(" hPa");
    
    /* Calculating altitude with reasonable accuracy requires pressure    *
     * sea level pressure for your position at the moment the data is     *
     * converted, as well as the ambient temperature in degress           *
     * celcius.  If you don't have these values, a 'generic' value of     *
     * 1013.25 hPa can be used (defined as SENSORS_PRESSURE_SEALEVELHPA   *
     * in sensors.h), but this isn't ideal and will give variable         *
     * results from one day to the next.                                  *
     *                                                                    *
     * You can usually find the current SLP value by looking at weather   *
     * websites or from environmental information centers near any major  *
     * airport.                                                           *
     *                                                                    *
     * For example, for Paris, France you can check the current mean      *
     * pressure and sea level at: http://bit.ly/16Au8ol                   */
     
    /* First we get the current temperature from the BMP085 */
    float temperature;
    bmp.getTemperature(&temperature);
    Serial.print("Temperature: ");
    Serial.print(temperature);
    Serial.println(" C");

    /* Then convert the atmospheric pressure, SLP and temp to altitude    */
    /* Update this next line with the current SLP for better results      */
    float seaLevelPressure = SENSORS_PRESSURE_SEALEVELHPA;
    Serial.print("Altitude:    ");
    Serial.print(bmp.pressureToAltitude(seaLevelPressure,
                                        event.pressure,
                                        temperature));
    Serial.println(" m");
    Serial.println("");
  }
  else
  {
    Serial.println("Sensor error");
  }
  delay(1000);
}


 

 Die Ergebnisse  decken sich mit den vom deutschen Wetterdienst.

Hier der Dowload der Adafruitlybrary.

Der BMP180 hat den BMP085 abgelöst.

Die Library ist aber kompatibel geblieben. Es wird aber immer noch BMP085 als Sensor angezeigt. Das sollte aber nicht stören da die Messwerte nicht abweichen. Auf dem Breakoutboard ist ein Spannungsregler und auch zwei 4k7 Pullupwiderstände. Ich habe diesmal mit 5V getestet.

Hier nochmal die Vorder und Rückansicht des BMP180.

 BMP180 von vornbmp180b

 

Jetzt aktuell der BMP280

 

BMP280

 

 

Der Bmp180 wurde nochmals überarbeiet und ist jetzt der BMP280. Was neu ist ist mir unbekannt.
Die Breakouts die ich jetzt bekommen habe bestehen auch nur aus dem Sensor und 4 Widerständen.
Achtung kein Spannungsregler. Es müssen unbedingt 3,3V sein.
Er funktioniert einwandfrei mit Anschluss an SPI in Verbindung mit dem Adafruit Treiber.

Normalerweise ist für den I2C Adresse 0x77 Standard.
Bei diesem hier ist es 0x76. Das muss in die Library Adafruit_BMP280.h geändert werden.
#define BMP280_ADDRESS     
(0x76)     Dann funktioniert es auch mit I2C

 

 

 Download BMP280 Library
 Download Sensor Library

 

 

 


Hier nochmal der Sketch oberhalbs des Setup habe ich den SPI aktiviert

 #include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>

#define BMP_SCK 13
#define BMP_MISO 12
#define BMP_MOSI 11
#define BMP_CS 10

//Adafruit_BMP280 bme; // I2C
//Adafruit_BMP280 bme(BMP_CS); // hardware SPI
Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);

void setup() {
Serial.begin(9600);
Serial.println(F("BMP280 test"));

if (!bme.begin()) {
Serial.println(F("Could not find a valid BMP280 sensor, check wiring!"));
while (1);
}
}

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

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

Serial.print(F("Approx altitude = "));
Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase
Serial.println(" m");

Serial.println();
delay(2000);
}

 

Login Form