Page 1 of 2

BMP280 / BME280 - new lib for testing

Posted: 18 Dec 2016 11:53
by michap
Attached a new lib for Bosch sensors BMP280 / BME280 for testing.

Library will detect sensor type - so if you have BME sensor you will get additional humidity values at output.

Please extract this zip file to your Arduino working folder, library should be in same directory, no changes needed.

Comments are welcome ;)

Michael

(Deleted attachment - lib is now inside he latest releases (from 2.1.4) ..)

Re: BMP280 / BME280 - new lib for testing

Posted: 02 Mar 2017 02:47
by 10der

Re: BMP280 / BME280 - new lib for testing

Posted: 02 Mar 2017 09:56
by michap
10der wrote:no humidity
What sensor you are using?
What firmware release of Z-Uno you are using?

Some more details would be great to understand the problem ;)

Michael

Re: BMP280 / BME280 - new lib for testing

Posted: 04 Mar 2017 20:38
by 10der
>>>What sensor you are using?
here is my init on rpi (where it work properly)
sensor3 = BME280(mode=BME280_OSAMPLE_8,address=0x76)
so, I have BME280 sensor

>>>What firmware release of Z-Uno you are using?
2.0.8

btw: RPI results

Code: Select all

#!/usr/bin/python
from Adafruit_BME280 import *

sensor3 = BME280(mode=BME280_OSAMPLE_8,address=0x76)
tempout = sensor3.read_temperature()
humidityout = sensor3.read_humidity()
pressure = sensor3.read_pressure()
print(tempout)
print(humidityout)
print(pressure / 133.322)

pi@rpi:~/My/Meteo $ ./test.py
8.0048760328
67.0146060325
770.573657513

Re: BMP280 / BME280 - new lib for testing

Posted: 05 Mar 2017 12:49
by michap
Strange, for my sensors it is still working -that's why haven't seen it...
----------
Sensor TypeBME 280
Temperature 22.63 C
Pressure 997 hPa
Humidity 35 %
----------
But I think I guess where maybe the problem - the oversampling procedure seems to be not full right.
So there maybe a timing problem.

Can you please change (for now) here in BME280::startMeasurement(void) (ZUNO_BME280.cpp)
from:
delay(mdelay);
result=getUncalValues();
to:
delay(45);
result=getUncalValues();

and tell me the result?

I will change the lib (oversampling settings) and test it again soon.

Please tell me if this change help.

Thanks,
Michael

Re: BMP280 / BME280 - new lib for testing

Posted: 06 Mar 2017 18:49
by 10der
>>Can you please change
will do! kk

Re: BMP280 / BME280 - new lib for testing

Posted: 07 Mar 2017 17:57
by 10der
issue still here

Image

Re: BMP280 / BME280 - new lib for testing

Posted: 07 Mar 2017 18:45
by 10der

Code: Select all

		if(chip_id == 0x60){
			Serial.println("!");
			//uH = (int16_t)data[6] << 8;
			uH = (int32_t)data[6] << 8;
			uH |= data[7];
			Serial.println(uH);
		}
it's may be strange but it solves my issue

here is python code

Code: Select all

    def read_raw_humidity(self):
        """Assumes that the temperature has already been read """
        """i.e. that enough delay has been provided"""
        msb = self._device.readU8(BME280_REGISTER_HUMIDITY_DATA)
        lsb = self._device.readU8(BME280_REGISTER_HUMIDITY_DATA + 1)
        raw = (msb << 8) | lsb
        return raw
Image

thank you!

Re: BMP280 / BME280 - new lib for testing

Posted: 07 Mar 2017 18:49
by 10der
btw
after this operation
uH = (int16_t)data[6] << 8;
I got negative value...

Re: BMP280 / BME280 - new lib for testing

Posted: 07 Mar 2017 21:33
by michap
Yes, you are right - there is a mistake - it should be *int32_t*, as defined before.

Thank you for debugging!
I will correct the sample soon.

Michael