01-05-2017, 20:00
Hello, I know that my question it isnt't related to the weatherduino pro 2, but thats why I'm writing this message on General Discussion. I'm begginer with arduino, and I'm also trying to set up a weather station with him.
So, firstly, I'm picking the sensors and programming them on the Arduino. One of the sensors that I had chose was the BMP280 (adafruit version) - (https://learn.adafruit.com/adafruit-bmp2...g-and-test)
"But there's a problem"...
I have the arduino's programation code for this sensor, but with this code I can only get a real(absolute) atmospheric pressure according my altitude, and not the sea level atmospheric pressure.
The actual sea level pressure in my location is 1022.57 hPa (according the closest weather station). I had put this value on my arduino code "altimeter = bmp.readAltitude (1022.57)", and the pressure read by the sensor is 98766.37 Pa (987,66hPa). This pressure keeps being the absolute pressure and not the relative pressure (sea level pressure).
What do I have to do in the programming code, to the sensor starts doing the compensation/conversion of the absolute pressure reading, to the sea level pressure?
That is, what I have to do, to the sensor read sea level pressures values as the closest weather station?
This is my arduino's code of BMP280:
CODE: SELECT ALL | TOGGLE FULL SIZE
These were some of the values I had got:
![[Image: Nxm4WwN.png]](http://i.imgur.com/Nxm4WwN.png)
Thanks for your time, and I apologize my ignorance, and I also apologize for possible language errors.
So, firstly, I'm picking the sensors and programming them on the Arduino. One of the sensors that I had chose was the BMP280 (adafruit version) - (https://learn.adafruit.com/adafruit-bmp2...g-and-test)
"But there's a problem"...
I have the arduino's programation code for this sensor, but with this code I can only get a real(absolute) atmospheric pressure according my altitude, and not the sea level atmospheric pressure.
The actual sea level pressure in my location is 1022.57 hPa (according the closest weather station). I had put this value on my arduino code "altimeter = bmp.readAltitude (1022.57)", and the pressure read by the sensor is 98766.37 Pa (987,66hPa). This pressure keeps being the absolute pressure and not the relative pressure (sea level pressure).
What do I have to do in the programming code, to the sensor starts doing the compensation/conversion of the absolute pressure reading, to the sea level pressure?
That is, what I have to do, to the sensor read sea level pressures values as the closest weather station?
This is my arduino's code of BMP280:
CODE: SELECT ALL | TOGGLE FULL SIZE
Code:
#include <Wire.h>
#include "SPI.h" //Why? Because library supports SPI and I2C connection
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
//Setup connection of the sensor
Adafruit_BMP280 bmp; // I2C
/*//For SPI connection!
#define BMP_SCK 13
#define BMP_MISO 12
#define BMP_MOSI 11
#define BMP_CS 10
//Adafruit_BMP280 bme(BMP_CS); // hardware SPI
//Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);
*/
//Variables
float pressure; //To store the barometric pressure (Pa)
float temperature; //To store the temperature (oC)
int altimeter; //To store the altimeter (m) (you can also use it as a float variable)
void setup() {
bmp.begin(); //Begin the sensor
Serial.begin(9600); //Begin serial communication at 9600bps
Serial.println("Adafruit BMP280 test:");
}
void loop() {
//Read values from the sensor:
pressure = bmp.readPressure();
temperature = bmp.readTemperature();
altimeter = bmp.readAltitude (1022.57); //Change the "1050.35" to your city current barrometric pressure
//Print values to serial monitor:
Serial.print(F("Pressure: "));
Serial.print(pressure);
Serial.print(" Pa");
Serial.print("\t");
Serial.print(("Temp: "));
Serial.print(temperature);
Serial.print(" oC");
Serial.print("\t");
Serial.print("Altimeter: ");
Serial.print(altimeter); // this should be adjusted to your local forcase
Serial.println(" m");
delay(5000); //Update every 5 sec
}These were some of the values I had got:
![[Image: Nxm4WwN.png]](http://i.imgur.com/Nxm4WwN.png)
Thanks for your time, and I apologize my ignorance, and I also apologize for possible language errors.
L.V.
Ps: I also accept answers in Portuguese.



. I'm going to try to implement this formula in the arduino's programming code of the BMP280.
