user35430: I have a BMP280 and BMP180 pressure sensor and I have both of them connected via I²C to a ESP8266.
For the BMP180, I can get the sea level air pressure when I pass the pressure and altitude like so:
// https://github.com/sparkfun/BMP180_Breakout_Arduino_Library
#include <SFE_BMP180.h>
SFE_BMP180 bmp180;
[...]
Serial.print(bmp180.sealevel(pressure, 800));

Is there a similar thing for the BMP280? Reading pressure and temperature works fine:
#include <Adafruit_BMP280.h>
Adafruit_BMP280 bmp280;
[...]
double temperature = bmp280.readTemperature();
double pressure = bmp280.readPressure() / 100;


user35430: It seems this was planned for the Adafruit BMP280 library but not implemented. Looking at Adafruit_BMP280.h we see commented code that has a method seaLevelForAltitude():
/*
class Adafruit_BMP280_Unified : public Adafruit_Sensor
{
  public:
    Adafruit_BMP280_Unified(int32_t sensorID = -1);

    bool  begin(uint8_t addr = BMP280_ADDRESS, uint8_t chipid = BMP280_CHIPID);
    void  getTemperature(float *temp);
    void  getPressure(float *pressure);
    float pressureToAltitude(float seaLevel, float atmospheric, float temp);
    float seaLevelForAltitude(float altitude, float atmospheric, float temp);
    void  getEvent(sensors_event_t*);
    void  getSensor(sensor_t*);

  private:
    uint8_t   _i2c_addr;
    int32_t   _sensorID;
};

*/

In another library, BMP280-arduino-library, I found a function that seems to work:
double BMP280::sealevel(double P, double A)
// Given a pressure P (mb) taken at a specific altitude (meters),
// return the equivalent pressure (mb) at sea level.
// This produces pressure readings that can be used for weather measurements.
{
    return(P/pow(1-(A/44330.0),5.255));
}

First, I just copied that function into my code (without the class name), due to the friendly pizza license. Later I switched to that library and it also worked fine.

user67140: Try this following segment: I used it myself and it worked fine.
As you don't get any default Method for returning the sea-level pressure from BMP280, I had to calculate on my own.
#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)
float SLpressure_mB;
int ELEVATION = 9;  //PUT HERE THE ELEVATION OF YOUR LOCATION IN METERS

void setup() {
  bmp.begin();    //Begin the sensor
    Serial.begin(9600); //Begin serial communication at 9600bps
    Serial.println("Equivalent Sea Level Pressure Test:");
}

void loop() {
  //Read values from the sensor:
  pressure = bmp.readPressure();
  temperature = bmp.readTemperature();
  SLpressure_mB = (((pressure * 100.0)/pow((1-((float)(ELEVATION))/44330), 5.255))/100.0)  
  //Print values to serial monitor:
  Serial.print(F("Pressure: "));
    Serial.print(pressure, 2);
    Serial.print(" Pa");
    Serial.print("\t");
    Serial.print(("Temp: "));
    Serial.print(temperature);
    Serial.print(" oC");
  Serial.print("\t");
    Serial.print("Equivalent Sea Level Pressure: ");
    Serial.print(SLpressure_mB, 2);
    Serial.println(" mB");
   
    delay(5000); //Update every 5 sec
}


35430: <p>I have a BMP280 and BMP180 pressure sensor and I have both of them connected via I²C to a ESP8266.</p>
<p>For the BMP180, I can get the sea level air pressure when I pass the pressure and altitude like so:</p>
<pre><code>// https://github.com/sparkfun/BMP180_Breakout_Arduino_Library
#include &lt;SFE_BMP180.h&gt;
SFE_BMP180 bmp180;
[...]
Serial.print(bmp180.sealevel(pressure, 800));
</code></pre>
<p>Is there a similar thing for the BMP280? Reading pressure and temperature works fine:</p>
<pre><code>#include &lt;Adafruit_BMP280.h&gt;
Adafruit_BMP280 bmp280;
[...]
double temperature = bmp280.readTemperature();
double pressure = bmp280.readPressure() / 100;
</code></pre>
 35430: <p>It seems this was planned for the Adafruit BMP280 library but not implemented. Looking at <code>Adafruit_BMP280.h</code> we see commented code that has a method <code>seaLevelForAltitude()</code>:</p>
<pre><code>/*
class Adafruit_BMP280_Unified : public Adafruit_Sensor
{
  public:
    Adafruit_BMP280_Unified(int32_t sensorID = -1);

    bool  begin(uint8_t addr = BMP280_ADDRESS, uint8_t chipid = BMP280_CHIPID);
    void  getTemperature(float *temp);
    void  getPressure(float *pressure);
    float pressureToAltitude(float seaLevel, float atmospheric, float temp);
    float seaLevelForAltitude(float altitude, float atmospheric, float temp);
    void  getEvent(sensors_event_t*);
    void  getSensor(sensor_t*);

  private:
    uint8_t   _i2c_addr;
    int32_t   _sensorID;
};

*/
</code></pre>
<p>In another library, <a href="https://github.com/mahfuz195/BMP280-arduino-library" rel="nofollow noreferrer">BMP280-arduino-library</a>, I found a function that seems to work:</p>
<pre><code>double BMP280::sealevel(double P, double A)
// Given a pressure P (mb) taken at a specific altitude (meters),
// return the equivalent pressure (mb) at sea level.
// This produces pressure readings that can be used for weather measurements.
{
    return(P/pow(1-(A/44330.0),5.255));
}
</code></pre>
<p>First, I just copied that function into my code (without the class name), due to the friendly pizza license. Later I switched to that library and it also worked fine.</p>
 67140: <p>Try this following segment: I used it myself and it worked fine.</p>
<p>As you don't get any default Method for returning the sea-level pressure from BMP280, I had to calculate on my own.</p>
<pre><code>#include &lt;Wire.h&gt;
#include &quot;SPI.h&quot; //Why? Because library supports SPI and I2C connection
#include &lt;Adafruit_Sensor.h&gt;
#include &lt;Adafruit_BMP280.h&gt;

//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)
float SLpressure_mB;
int ELEVATION = 9;  //PUT HERE THE ELEVATION OF YOUR LOCATION IN METERS

void setup() {
  bmp.begin();    //Begin the sensor
    Serial.begin(9600); //Begin serial communication at 9600bps
    Serial.println(&quot;Equivalent Sea Level Pressure Test:&quot;);
}

void loop() {
  //Read values from the sensor:
  pressure = bmp.readPressure();
  temperature = bmp.readTemperature();
  SLpressure_mB = (((pressure * 100.0)/pow((1-((float)(ELEVATION))/44330), 5.255))/100.0)  
  //Print values to serial monitor:
  Serial.print(F(&quot;Pressure: &quot;));
    Serial.print(pressure, 2);
    Serial.print(&quot; Pa&quot;);
    Serial.print(&quot;\t&quot;);
    Serial.print((&quot;Temp: &quot;));
    Serial.print(temperature);
    Serial.print(&quot; oC&quot;);
  Serial.print(&quot;\t&quot;);
    Serial.print(&quot;Equivalent Sea Level Pressure: &quot;);
    Serial.print(SLpressure_mB, 2);
    Serial.println(&quot; mB&quot;);
   
    delay(5000); //Update every 5 sec
}
</code></pre>
