BME280 driver that works with ESP32?
Posted: Mon Apr 23, 2018 6:50 pm
Hi,
i'm trying to interface an ESP32 board (TT GO, latest loboris port) with a bme280 sensor (I2C, temperature, humidity, barometric pressure).
I couldn't find a driver for ESP32 so i tried the next best thing, which was catdo2's driver for the esp8266
(https://github.com/catdog2/mpy_bme280_esp8266).
Unfortunately it refuses to work.
When using bme280.py like this:
[code]
import machine
import micropython
import bme280
i2c = machine.I2C(scl=machine.Pin(22), sda=machine.Pin(21))
print(i2c.scan())
micropython.mem_info()
bme = bme280.BME280(i2c=i2c, address=118)
print(bme.values)
[/code]
I get this:
[code]
[80, 104, 118]
stack: 784 out of 19456
GC: total: 80000, used: 19872, free: 60128
No. of 1-blocks: 50, 2-blocks: 11, max blk sz: 530, max free sz: 2593
Traceback (most recent call last):
File "<stdin>", line 7, in <module>
AttributeError: 'module' object has no attribute 'BME280'
[/code]
My understanding is, that ESP8266 and ESP32 are slightly different animals, so that the ESP8266 code might not work as expected on ESP32.
Because my Python knowledge is basic at best, i have no idea what to do next.
Could someone more knowledgeable than me try to nudge me in the right direction?
Thank you very much in advance
Blechi
i'm trying to interface an ESP32 board (TT GO, latest loboris port) with a bme280 sensor (I2C, temperature, humidity, barometric pressure).
I couldn't find a driver for ESP32 so i tried the next best thing, which was catdo2's driver for the esp8266
(https://github.com/catdog2/mpy_bme280_esp8266).
Unfortunately it refuses to work.
When using bme280.py like this:
[code]
import machine
import micropython
import bme280
i2c = machine.I2C(scl=machine.Pin(22), sda=machine.Pin(21))
print(i2c.scan())
micropython.mem_info()
bme = bme280.BME280(i2c=i2c, address=118)
print(bme.values)
[/code]
I get this:
[code]
[80, 104, 118]
stack: 784 out of 19456
GC: total: 80000, used: 19872, free: 60128
No. of 1-blocks: 50, 2-blocks: 11, max blk sz: 530, max free sz: 2593
Traceback (most recent call last):
File "<stdin>", line 7, in <module>
AttributeError: 'module' object has no attribute 'BME280'
[/code]
My understanding is, that ESP8266 and ESP32 are slightly different animals, so that the ESP8266 code might not work as expected on ESP32.
Because my Python knowledge is basic at best, i have no idea what to do next.
Could someone more knowledgeable than me try to nudge me in the right direction?
Thank you very much in advance
Blechi