New Bosch BME280 temperature, humidity, pressure sensor library
-
- Posts: 1
- Joined: Fri Aug 03, 2018 10:35 pm
New Bosch BME280 temperature, humidity, pressure sensor library
I wanted to share a new driver I wrote for the Bosch BME280.
https://github.com/triplepoint/micropython_bme280_i2c
Some of the work was heavily guided by the excellent prior work at:
https://github.com/catdog2/mpy_bme280_esp8266
but I wanted to expose more of the power mode and filtering functionality per the data sheet.
This driver is more or less a straight reading of the data sheet, combined with the reference C driver library at:
https://github.com/BoschSensortec/BME280_driver
If you've got some time and have a BME280 wired up with I2c, please give it a try and let me know how it works for you.
I recommend reading the data sheet sections 3.4, 3.5, and 3.6 to get an idea of what the extra configuration values can do.
https://ae-bst.resource.bosch.com/media ... 001-12.pdf
Thanks!
https://github.com/triplepoint/micropython_bme280_i2c
Some of the work was heavily guided by the excellent prior work at:
https://github.com/catdog2/mpy_bme280_esp8266
but I wanted to expose more of the power mode and filtering functionality per the data sheet.
This driver is more or less a straight reading of the data sheet, combined with the reference C driver library at:
https://github.com/BoschSensortec/BME280_driver
If you've got some time and have a BME280 wired up with I2c, please give it a try and let me know how it works for you.
I recommend reading the data sheet sections 3.4, 3.5, and 3.6 to get an idea of what the extra configuration values can do.
https://ae-bst.resource.bosch.com/media ... 001-12.pdf
Thanks!
-
- Posts: 168
- Joined: Tue Nov 07, 2017 11:45 pm
Re: New Bosch BME280 temperature, humidity, pressure sensor library
Subject: New Bosch BME280 temperature, humidity, pressure sensor library
i've just looked at your repository and there's a Licensing issue. i've got one of these and have written a class for raspberry pi. Bosch weren't happy i were porting their code to python and were *very* clear that the code has to have a copy of their license at the top and the repository is to be licensed by them. see my License.txt at https://github.com/rhubarbdog/bme280
hitriplepoint wrote: ↑Fri Aug 03, 2018 10:42 pmI wanted to share a new driver I wrote for the Bosch BME280.
https://github.com/triplepoint/micropython_bme280_i2c
Some of the work was heavily guided by the excellent prior work at:
https://github.com/catdog2/mpy_bme280_esp8266
i've just looked at your repository and there's a Licensing issue. i've got one of these and have written a class for raspberry pi. Bosch weren't happy i were porting their code to python and were *very* clear that the code has to have a copy of their license at the top and the repository is to be licensed by them. see my License.txt at https://github.com/rhubarbdog/bme280
Re: New Bosch BME280 temperature, humidity, pressure sensor library
You rewrote some of their library from scratch in a different language an they claimed copyright?
Their licenses looks like a BSD-3-Clause with an extra paragraph.
I'm no lawyer or software license expert, but if your work is interpreted as derivative work, then you should comply with their license.
If your work is completely original, there's a big grey area there, as your code relies on the same hardware/datasheet, there's only so many ways you can write the code.
Their licenses looks like a BSD-3-Clause with an extra paragraph.
I'm no lawyer or software license expert, but if your work is interpreted as derivative work, then you should comply with their license.
If your work is completely original, there's a big grey area there, as your code relies on the same hardware/datasheet, there's only so many ways you can write the code.
Re: New Bosch BME280 temperature, humidity, pressure sensor library
How the heck do you use module? What directory do I put it in? Great library I guess, but you provide no instructions on how to install the module? Especially for users that are using Windows and uPyCraft to program ESP8266 devices, no clue how to get the module seen by the development environment.
-
- Posts: 969
- Joined: Sat Feb 03, 2018 7:02 pm
Re: New Bosch BME280 temperature, humidity, pressure sensor library
You just copy the file onto the device using for example rshell, mpfshell or similar.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode
- Hasenradball
- Posts: 15
- Joined: Tue May 21, 2019 12:52 pm
- Location: Germany
- Contact:
Re: New Bosch BME280 temperature, humidity, pressure sensor library
Hi together,
I am searching for an micropython driver for the Bosch BME280 Sensor.
Do you have an Hint for me which library I should use?
Frank
I am searching for an micropython driver for the Bosch BME280 Sensor.
Do you have an Hint for me which library I should use?
Frank
Re: New Bosch BME280 temperature, humidity, pressure sensor library
Hi Frank,
Have you tried using triplepoint's library linked at the start of the thread?
Have you tried using triplepoint's library linked at the start of the thread?
Re: New Bosch BME280 temperature, humidity, pressure sensor library
I have one here https://github.com/robert-hh/BME280, which I adapted from the Adafruit driver. I tested them on a Pycom device and on a ESP32 with micropython.org v1.11 firmware. I mentioned every source I could find, Bosch too (Adafruit did not), especially since I used the data sheet to verify and fix the calculation for compensation data.
There are two variants, one using float calculation and one doing integer calculation, like in the original Bosch data sheet. The results are pretty much the same.
There are two variants, one using float calculation and one doing integer calculation, like in the original Bosch data sheet. The results are pretty much the same.
- Hasenradball
- Posts: 15
- Joined: Tue May 21, 2019 12:52 pm
- Location: Germany
- Contact:
Re: New Bosch BME280 temperature, humidity, pressure sensor library
Hi Robert,
thank for your Post.
When I use your lib as:
I get the following result:
Do I have to divide the pressure by 100?
And how is this used?
best regards Frank
thank for your Post.
When I use your lib as:
Code: Select all
def measureTempHumPres_BME280():
return BME.read_compensated_data()
# ### --- Main Schleife --- ###
while True:
# turn on LED
#LED.value(0)
utime.sleep(1)
vcc_voltage = measureVcc(adc)
(temperature, pressure, humidity) = measureTempHumPres_BME280()
print('Vcc-Voltage: {0:5.3f} V'.format(vcc_voltage))
print('BME280 Data: Temperature: {0}, Humidity: {1}, Pressure: {2}'.format(temperature, humidity, pressure))
#LED.value(1)
utime.sleep(3)
Code: Select all
MPY: soft reboot
Vcc-Voltage: 4.691 V
BME280 Data: Temperature: 22.5813, Humidity: 37.6937, Pressure: 98967.9
And how is this used?
Code: Select all
@property
def values(self):
""" human readable values """
t, p, h = self.read_compensated_data()
return ("{:.2f}C".format(t), "{:.2f}hPa".format(p/100),
"{:.2f}%".format(h))
Re: New Bosch BME280 temperature, humidity, pressure sensor library
Yes, the pressure value returned by read_compensated_data is Pascals (Pa). It has to be divided by 100 to get a value in hPa (= hecto-Pascal = Pascal / 100), which is usually used in weather reports. Note, that the returned values differ for the int and the float version. The returned values for the int version are scaled up to retain the fractional digits.
Values is a property. It is used like this, e.g.
So it is a function call that looks like a variable access. For both int and float version, bme.values returns the same ranges. The scaling required by the int version is done there.
Values is a property. It is used like this, e.g.
Code: Select all
from bme280_float import BME280
bme = BME280(...)
(temperature, pressure, humidity) = bme.values