BME280 tutorial fail library?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
Posts: 3
Joined: Sun Jan 06, 2019 3:48 pm

BME280 tutorial fail library?

Post by Ksanto » Mon Jan 28, 2019 11:20 pm


I am trying to fulfil a tutorial on this site: ... E-DYMZCe-m

I use an Lolin D32 Pro, the same OLED display and the newest firmware '''esp32spiram-20190125-v1.10.bin'''.
The display works. It is recognised as a I2C device (Scan i2c bus...i2c devices found: 1 60) and BME KO
is blinking all the time.
The BME280 doesn't seem to get recognised by the I2C scan...

I am using this library for the BME280: ... /
There are like 5-6 other libraries and I don't know which one to use.
import esp
import machine
import main

import machine, time, ssd1306, bme280
from ssd1306 import SSD1306, SSD1306_I2C
from bme280 import BME280
pinScl = 22 #ESP8266 GPIO5 (D1)
pinSda = 21 #ESP8266 GPIO4 (D2)
addrOled = 60 #0x3c
addrBME280 = 118 #0x76
hSize = 64 # Hauteur ecran en pixels | display heigh in pixels
wSize = 128 # Largeur ecran en pixels | display width in pixels

oledIsConnected = False
bmeIsConnected = False
temp = 0
pa = 0
hum = 0

# init ic2 object
i2c = machine.I2C(scl=machine.Pin(22), sda=machine.Pin(21)) #ESP8266 5/4

library name: and

User avatar
Posts: 1461
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: BME280 tutorial fail library?

Post by Roberthh » Tue Jan 29, 2019 7:36 am

I just tried this library on an ESP32 with v1.10 firmware:
The test code:

Code: Select all

# Example. Using I2C at Pin 12 and 13
from machine import I2C, Pin
from bme280_int import *
i2c=I2C(scl=Pin(12), sda=Pin(13), freq=1000000)
bme280 = BME280(i2c=i2c)
The Pin were chose arbitrary. The device returns proper values. The lib was ported from a Adafruit lib. I did not add a note about my own contribution, because it was minor: just changing the I2C calls and fixing a computation error (with a PR upstream).

Posts: 3
Joined: Sun Jan 06, 2019 3:48 pm

Re: BME280 tutorial fail library?

Post by Ksanto » Wed Apr 03, 2019 8:19 am

Thanks sry for the delay.
Everything is working :)

Post Reply