BMP280 / BME280 - new lib for testing

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
michap
Posts: 437
Joined: 26 Mar 2013 10:35
Contact:

BMP280 / BME280 - new lib for testing

Post 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) ..)
User avatar
10der
Posts: 80
Joined: 08 Jul 2016 00:23
Location: Ukraine - Berkeley, CA

Re: BMP280 / BME280 - new lib for testing

Post by 10der »

michap
Posts: 437
Joined: 26 Mar 2013 10:35
Contact:

Re: BMP280 / BME280 - new lib for testing

Post 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
User avatar
10der
Posts: 80
Joined: 08 Jul 2016 00:23
Location: Ukraine - Berkeley, CA

Re: BMP280 / BME280 - new lib for testing

Post 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
michap
Posts: 437
Joined: 26 Mar 2013 10:35
Contact:

Re: BMP280 / BME280 - new lib for testing

Post 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
User avatar
10der
Posts: 80
Joined: 08 Jul 2016 00:23
Location: Ukraine - Berkeley, CA

Re: BMP280 / BME280 - new lib for testing

Post by 10der »

>>Can you please change
will do! kk
User avatar
10der
Posts: 80
Joined: 08 Jul 2016 00:23
Location: Ukraine - Berkeley, CA

Re: BMP280 / BME280 - new lib for testing

Post by 10der »

issue still here

Image
User avatar
10der
Posts: 80
Joined: 08 Jul 2016 00:23
Location: Ukraine - Berkeley, CA

Re: BMP280 / BME280 - new lib for testing

Post 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!
Last edited by 10der on 07 Mar 2017 20:37, edited 1 time in total.
User avatar
10der
Posts: 80
Joined: 08 Jul 2016 00:23
Location: Ukraine - Berkeley, CA

Re: BMP280 / BME280 - new lib for testing

Post by 10der »

btw
after this operation
uH = (int16_t)data[6] << 8;
I got negative value...
michap
Posts: 437
Joined: 26 Mar 2013 10:35
Contact:

Re: BMP280 / BME280 - new lib for testing

Post 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
Post Reply