Bmp280 too high temperature readings

Hello,
I am a newbie and i am using a mega2560 with a bmp280 and a LCD robot shield to teach to my son something about weather..
I noticed that the readings are at least 1,2-1,5 °C higher than a professional thermometer (placed in the same place at the same time of the sensor); i have read the datasheet and it seems that the sensor is auto-heating after some time, so it is necessary to apply a compensation formula as in the Bosch datasheet..
Someone could help me please?
Thanks!
The code i use:

#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include <LiquidCrystal.h>

float temperature;
float pressure;

Adafruit_BMP280 bmp; // I2C

LiquidCrystal lcd(8,9,4,5,6,7); 

void setup(void) {

 lcd.begin(16, 2);
 lcd.print("Reading sensor");

 bool status;
   
   // default settings
   status = bmp.begin(0x76);  //The I2C address of the sensor I use is 0x76
   if (!status) {
       lcd.clear();
       lcd.print("Error. Check");
       lcd.setCursor(0,1);
       lcd.print("connections");
       while (1);
   }
}

void loop() {
 
delay(2000);

getPressure();
getTemperature();

lcd.clear(); 

//Printing Temperature
String temperatureString = String(temperature,1);
lcd.print("T:"); 
lcd.print(temperatureString);
lcd.print((char)223);
lcd.print("C ");


//Printing Pressure
lcd.setCursor(0,1);
lcd.print("P: ");
String pressureString = String(pressure,2);
lcd.print(pressureString);
lcd.print(" hPa");
}

float getTemperature()
{
 temperature = bmp.readTemperature();
}

float getPressure()
{
 pressure = bmp.readPressure();

 pressure = pressure/100.0F;
}

How did you connect the 5V Arduino board with the 3.3V sensor ?

I connected the sensor at the 5v pin, so that's the error? Doesn't have a shifting level circuitry? Thanks!

It depends on the BMP280 module.
This one from Adafruit has both a voltage regulator and I2C level shifting: Adafruit BMP280 I2C or SPI Barometric Pressure & Altitude Sensor [STEMMA QT] : ID 2651 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits.

The Arduino Mega 2560 is the only Arduino board with 10k pullup resistors from SDA and SCL to 5V. That could damage the BMP280 when you connect those SDA and SCL directy to the SDA and SCL pins of the BMP280. Your BMP280 could be damaged by now.

stewecar:
I connected the sensor at the 5v pin, so that's the error? Doesn't have a shifting level circuitry? Thanks!

You almost certainly have it on a breakout board as the sensor is about 2x2mm, no lead package. The sensor itself has no such circuitry built in, the breakout board may or may not have it.

Hello,
It's the same model (gy bmp280) that is in a weather station mega2560's project..
Anyway i used it before with a nodemcu lolin at 3,27v and temperature readings were even worse (from 1,4 to 2,2 °C higher).
It could be only a defective one and all my questions are futile..but i was curious that in the Bosch bmp280 datasheet i found some compensation formula that obviously means that something needs to be modified..
Thanks for the replies.
Stefano

stewecar:
It's the same model (gy bmp280) that is in a weather station mega2560's project..

Useless info, sorry. A photo of the actual module will be more helpful.

The sensor is this: https://goo.gl/images/6hSryk

No level shifter, no regulator. Connecting that module to 5V signals and a 5V supply will likely kill it.

If you power that with 5V instead of 3.3V, it gets certainly damaged.
If you connect those SDA and SCL to the Arduino Mega 2560 SDA and SCL it is no longer reliable. I don't know if that will permanent damage it, but it is not okay.

Oops, wvmarle already wrote this.

Thanks, so i have now a gy MC Donald fried one :slight_smile:
Anyway now i have putted it on a esp8266..pressure readings are OK, temperature at least 1,4 degrees higher..
Thanks again.
Stefano

Anyway now i have putted it on a esp8266..pressure readings are OK, temperature at least 1,4 degrees higher..

Throw the damaged sensor away, it can't be trusted and will probably fail completely at some point.