BMP280 results are wrong when the board is powered on

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
nbenm
 
Posts: 4
Joined: Mon Sep 26, 2016 3:43 pm

BMP280 results are wrong when the board is powered on

Post by nbenm »

Hi,

I have a very strange problem.
My BMP280 breakout board gives me wrong results the first time temp and pressure are read after powering on the boar.
The second time (without disconnecting the board), results are ok.
If I try a loop, I have :
power on -> read temp and pressure (wrong results) -> wait and read (good results)
here's an other case:
power on -> read temp and pressure (wrong results) -> wait and read (good results) -> disconnect plus wire and reconnect -> wait and read (wrong results)

Can anyone help me to find what's happening ?

In fact, in any case results are wrong after powering the board. After that, results are always ok.
I use an Arduino pro mini 3.3V, but I have same problem with a 5V board.

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: BMP280 results are wrong when the board is powered on

Post by Franklin97355 »

What are you powering the board with and to what pins? Are the headers soldered?

User avatar
nbenm
 
Posts: 4
Joined: Mon Sep 26, 2016 3:43 pm

Re: BMP280 results are wrong when the board is powered on

Post by nbenm »

Hi Franklin,

I'm powering the board with either 3.3V FTDI or 4.5V batteries. Both work fine.
I try to save power. So I have tried:
- BMP280 board + connected to +. - is connected to D5 pin. D5 pin is an output high for the time reading temp and pressure
- same but using MOSFET. Gate to D5 pin, source to GND, and drain to BMP280 minus. And a resistor between pin 5 and GND (10K ohms)
- BMP280 connected to + and -

In all cases, the first read pressure is wrong

All I have found as a workarounds:
temperature = bmp.readTemperature();
pression = (bmp.readPressure()/100.0) + OFFSET;
delay(40);
temperature = bmp.readTemperature();
pression = (bmp.readPressure()/100.0) + OFFSET;
At the second read, results are correct
The delay is necessary, and a value of 40ms is a minimum for it works.

All headers are soldered

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: BMP280 results are wrong when the board is powered on

Post by adafruit_support_mike »

That's normal, actually.

The value you get from a BMP280 is the stored result from the previous measurement. Reading the value triggers the next measurement, whose value is stored and returned the next time you call the sensor for a value.

If you put a long delay between readings, or drop and reconnect power, the value you get from the first read won't be valid. The only solution is to do a dummy read to trigger a fresh measurement, then read again to get the data.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: BMP280 results are wrong when the board is powered on

Post by adafruit2 »

ooh that may be true, added to the FAQ - just read twice :)

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”