Attempting to read BME280 sensor from WiPy 2.0 but having trouble ...

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
User avatar
Roberthh
Posts: 1166
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Attempting to read BME280 sensor from WiPy 2.0 but having trouble ...

Post by Roberthh » Sun Oct 28, 2018 1:40 pm

It is hard to understand why against all hints you are insisting to post in this forum. Nevertheless, i tried a BME280 with a LoPy4 module, which should behave identical to the WiPy2 for this purpose. The module I tried is this one: https://www.amazon.com/BME280-Pressure- ... ref=sr_1_6.
I tried this library: https://github.com/catdog2/mpy_bme280_e ... /bme280.py, not for a specific reason. The device was connected to;

Code: Select all

BME280     LoPy
-----------------------
VIN        3.3V
GND        GND
SDA        P9 (aka G16)
SCL        P10 (aka G17)
The statements I used for testing were:

Code: Select all

from machine import I2C
from bme280 import *
i2c = I2C()
bme280 = BME280(address=0x76, i2c=i2c)
bme.values
The default address in the code is 0x77. If you change that to the address of your device, you do not need the address parameter in the call. If i2c.scan() does not return any address, then check your wiring of SDA and SCL, and maybe replace the wires. There exists something like broken cables.
P.S.: I should add the my sensor returns values for relative humidity that are substantially lower than all the other sensors in my drawer (35% instead of ~50%). So I'm trying one of the recalibration procedures now: put it for 4 days into the freezer at -25°C.

sealyons
Posts: 13
Joined: Tue Oct 23, 2018 6:33 am

Re: Attempting to read BME280 sensor from WiPy 2.0 but having trouble ...

Post by sealyons » Sun Oct 28, 2018 3:18 pm

Thanks for your reply. I have posted to the Pycom forum but haven't received any replies as of yet.

So, you are saying that what I've done as far as setting up the I2C communication path should be correct and I should be seeing something coming back from the i2c.scan() function, correct? Setting baudrate to 100000 is correct? I know I2C baudrate is generally between 100-400K. What would be causing the hang? Is that normal? I've tried different cables, no difference. There's just 4 connections, so I'm pretty sure it's not a connection problem. Guess there might be wrong with my BME280. I did get 2, so I can try the other one. But I do have other I2C devices and I cannot seem to get scan() to return addresses for any of the ones I've tried.

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

Re: Attempting to read BME280 sensor from WiPy 2.0 but having trouble ...

Post by Roberthh » Sun Oct 28, 2018 3:53 pm

What kind of BME280 set-up do you use. DO you use a breakout board, and if yes, which one? Or did you just get the bare BME280 and trying to connect? I'm asking because the BME280 supports I2C and SPI connections, The selection is done trough CS. For I2C, this has to be at VDD during power on.
P.S:: I've seen your post at the Pycom board. So the question is, where to continue the talk.

sealyons
Posts: 13
Joined: Tue Oct 23, 2018 6:33 am

Re: Attempting to read BME280 sensor from WiPy 2.0 but having trouble ...

Post by sealyons » Sun Oct 28, 2018 4:00 pm

It's on a breakout board. It has 6 pins; Vcc, GND, SCL, SDA, CSB and SDO. I'm connecting for I2C using just the first 4 pins. We can communicate here.

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

Re: Attempting to read BME280 sensor from WiPy 2.0 but having trouble ...

Post by Roberthh » Sun Oct 28, 2018 4:05 pm

Pleasse connect CSB to Vcc, forcing to use I2C.

sealyons
Posts: 13
Joined: Tue Oct 23, 2018 6:33 am

Re: Attempting to read BME280 sensor from WiPy 2.0 but having trouble ...

Post by sealyons » Sun Oct 28, 2018 4:13 pm

Still hanging.

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

Re: Attempting to read BME280 sensor from WiPy 2.0 but having trouble ...

Post by Roberthh » Sun Oct 28, 2018 4:34 pm

Did you power cycle the board after connecting CSB? And of you say hanging? i2c.scan() should always return. If it does not find something, it returns an empty list.

sealyons
Posts: 13
Joined: Tue Oct 23, 2018 6:33 am

Re: Attempting to read BME280 sensor from WiPy 2.0 but having trouble ...

Post by sealyons » Sun Oct 28, 2018 4:56 pm

Yes, I cycled power. As I stated previously, when I run the scan() function, I get a flashing cursor in REPL for about 30 seconds and then I get [] showing that it has found nothing. It is acting exactly as it did before I connected CSB to Vcc.

sealyons
Posts: 13
Joined: Tue Oct 23, 2018 6:33 am

Re: Attempting to read BME280 sensor from WiPy 2.0 but having trouble ...

Post by sealyons » Sun Oct 28, 2018 4:57 pm

Actually it's taking longer than 30 seconds before it returns. It's taking minutes. But it will return if I wait long enough. I'm guessing this isn't normal.

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

Re: Attempting to read BME280 sensor from WiPy 2.0 but having trouble ...

Post by Roberthh » Sun Oct 28, 2018 5:01 pm

That#s not right. It should return immediately with an empty list. You can verify that with not connecting anything to the WiPy2 and run scan()

Post Reply