PiicoDev BME280 with Pi Pico W

I’m down a wormhole here… I’m trying to write some code for a single button/command version of Michael’s https://core-electronics.com.au/projects/wifi-garage-door-controller-with-raspberry-pi-pico-w-smart-home-project/
Anyhow I got to the point of wanting asynchronous updates to WWW to show the door status and started trying some sensors on the Pico-W…
Now the problem is that I2C seems to be VERY unstable on thePico-W.
I’m trying the BME280 stuff here: GitHub - CoreElectronics/CE-PiicoDev-BME280-MicroPython-Module: This is the firmware repo for the Core Electronics PiicoDev® Atmospheric Sensor BME280 and the code hangs. When you re-power the Pico-W you get:

Unable to connect to COM16: could not open port ‘COM16’: PermissionError(13, ‘Access is denied.’, None, 5)
If you have serial connection to the device from another program, then disconnect it there first.
Process ended with exit code 1.

OS is Win 10, using Thony 4.0.0. even a simple I2C scan produces nothing…

2 Likes

Hey @dave50358 - can you tell us what version of MicroPython is running? Reports indicate that the latest version (v1.19.1) has a bug and fails to communicate over I2C.

3 Likes

I’ve had similar problems.
This happened after I upgraded to Thonny 4.0.
Also have one where the back end of Thonny no longer works to the device.

Found only solution was to disconnect Pico W and shutdown Thonny. Restart of Thonny sometimes worked sometimes not. In some cases had to restart PC.

Reserving my opinion on this one, yet to go back to old version of Thonny. It might be Thonny as the loading of firmware to the Pico is flacky as well.

Regards
Jim

UPDATE: Testing today on Pico and no problems, back on Pico W and happens again.
Changed my mind, don’t think it is Thonny now.

3 Likes

Michael, probably the same problem. I pulled down an update

MicroPython v1.19.1 on 2022-09-20; Raspberry Pi Pico W with RP2040
note the different date, same version number.

I’ve gone back to my main code and am ignoring the BME for now.

Just tried it again. same problem:

PiicoDev could not communicate with module at address 0x77, check wiring
Traceback (most recent call last):
File “”, line 4, in
File “/lib/PiicoDev_BME280.py”, line 32, in init
File “/lib/PiicoDev_BME280.py”, line 29, in init
File “/lib/PiicoDev_BME280.py”, line 64, in _read16
OSError: [Errno 5] EIO

and a simple I2C scan

import machine

print(“Creating I2C object”)

Create I2C object

i2c = machine.I2C(0, scl=machine.Pin(9), sda=machine.Pin(8), freq= 400000)
print(“Object created”)

Print out any addresses found

devices = i2c.scan()
print(“Scan done”)

devices = i2c.scan()

if len(devices) == 0:
print(“No i2c device !”)
else:
print(‘i2c devices found:’,len(devices))
for device in devices:
print("At address: ",hex(device))

finds no i2c device…
Dave

2 Likes

Hmmm, i2c bus termination!!!
Added a solder bridge to the piicoDev module and all OK

Dave :rage:

4 Likes

That’s curious - where did you apply the solder bridge?
From the Factory the I2C pullups are enabled by default and can only be disabled by cutting some jumpers.
In any case, happy that things seem to have worked out.

2 Likes

Michael,
there seem to be two versions of the PiicoDevBME280. Mine does not have the address switch and is marked ‘piicodev/p2’.

2 Likes

Thanks for sharing the image @dave50358
If the I2C PU jumpers were cut previously and there are no other I2C pullups in the system then yes, the jumpers would need to be resoldered.
All PiicoDev modules feature cuttable I2C pullup jumpers - though these are connected by default.

4 Likes

I have the exact same issue…

1 Like

Hi Phil,

We think we’ve found a fix for this issue, seems to be a bug in the nightly micropython firmware that breaks I2C.

2 Likes

Hi Trent,

I am assuming this is similar fix for the ESP32 issue that I have?
Have you or anyone else had luck with getting the ESP32 going with Micropython / PiicoDev BME280?

2 Likes

Hi Phil,

I haven’t used the ESP32 with micropython myself but I think @Liam has had some success lately with the ESP32.

2 Likes

thanks @Trent5487676. I’ve put this on the back burner for the moment due work and study commitments. I’ve got the Pico W’s now that seem to be working, so will focus on that.

Phil

3 Likes

Hey Phil,

The issue with the Pico W was the firmware messing around with the Pico, the ESP32 is a whole other beast.

Feel free to jump back on your other topic when you have a moment as there are some other troubleshooting steps that we could try to get it working - I’ll also get my code uploaded for MQTT.

2 Likes