A
A
artanets2014-05-14 15:42:07
Arduino
artanets, 2014-05-14 15:42:07

How to stabilize barometric sensor (BMP085) connected to Arduino?

Good afternoon.
The BMP085 sensor is a good thing, I wanted to use it as a variometer, but the pressure readings of the sensor constantly jump, even when it lies on the table, in fact, based on this, the height also jumps by 2-3 meters.
Used the Adafruit_BMP085 library. And their example:

#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 
  ----> https://www.adafruit.com/products/391

  These displays use I2C to communicate, 2 pins are required to  
  interface
  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

Adafruit_BMP085 bmp;
  
void setup() {
  Serial.begin(9600);
  if (!bmp.begin()) {
  Serial.println("Could not find a valid BMP085 sensor, check wiring!");
  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 altitude assuming 'standard' barometric
    // pressure of 1013.25 millibar = 101325 Pascal
    Serial.print("Altitude = ");
    Serial.print(bmp.readAltitude());
    Serial.println(" meters");

  // 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("Real altitude = ");
    Serial.print(bmp.readAltitude(101500));
    Serial.println(" meters");
    
    Serial.println();
    delay(500);
}

This is what the readings look like:
Temperature = 23.93 *C
Pressure = 99798 Pa
Altitude = 127.41 meters
Real altitude = 141.34 meters
Temperature = 23.94 *C
Pressure = 99800 Pa
Altitude = 127.75 meters
Real altitude = 142.26 meters
Temperature = 23.94 *C
Pressure = 99794 Pa
Altitude = 127.58 meters
Real altitude = 142.94 meters
Temperature = 23.93 *C
Pressure = 99795 Pa
Altitude = 128.25 meters
Real altitude = 142.43 meters
Temperature = 23.93 *C
Pressure = 99791 Pa
Altitude = 128.25 meters
Real altitude = 141.92 meters
Temperature = 23.94 *C
Pressure = 99803 Pa
Altitude = 127.75 meters
Real altitude = 141.84 meters

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
schroeder, 2014-05-14
@schroeder

habrahabr.ru/post/166693

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question