Help with BME280 on Wipy 3.0 + Expansion Board 3.0



  • Hi there, so Im having some trouble with the BME 280. I have already tried the following bme280 libraries :

    https://bitbucket.org/oscarBravo/wipy_bme280(Currently using this)
    https://github.com/catdog2/mpy_bme280_esp8266 (Just because it worked on my pyboard).

    I keep running into the same issue every time. Using normal code in .py doesn't work period. So I tried to do a work around multiple ways with REPL based on what other people said about Lora and Wipy 2.0 however I keep running into the same issue:

    from machine import I2C
    >>> from bme280 import *
    >>> i2c = I2C()
    >>> bme280 = BME280(address=0x76, i2c=i2c)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "bme280.py", line 149, in __init__
      File "bme280.py", line 155, in _load_calibration
      File "bme280.py", line 115, in readU16LE
      File "bme280.py", line 98, in readU16
    TypeError: function missing 1 required positional arguments
    

    or

    >>> from machine import I2C
    >>> import bme280
    >>> i2c = I2C(0, I2C.MASTER, baudrate=100000)
    >>> i2c.scan()
    [118]
    >>> bme = bme280.BME280(i2c=i2c)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "bme280.py", line 149, in __init__
      File "bme280.py", line 155, in _load_calibration
      File "bme280.py", line 115, in readU16LE
      File "bme280.py", line 98, in readU16
    TypeError: function missing 1 required positional arguments
    

    Its always the same lines that are being the issue. But I know that the sensor works because I use it with my Pyboard. I am also running:
    Pycom MicroPython 1.18.0.r1 [v1.8.6-849-9569a73] on 2018-07-20; WiPy with ESP32

    Any help is greatly appreciated!



  • @robert-hh Works like a charm, thank you so much!



  • @dezert754 You could try this one: https://github.com/robert-hh/BME280
    I adapted them from the Adafruit files to PyCom devices. There are two variants: bme280_float.py and bme280_int.py.
    The API is the same, just the internal calculation method differs, resulting very small differences between the variants (like 0.01%).



Pycom on Twitter