Error trying to run Atmospheric monitor on PiicoDev

Error trying to run Atmospheric monitor on PiicoDev. Sorry. I am a newbie.
Have now tried three different modules and none will connect

Traceback (most recent call last):
  File "<stdin>", line 9, in <module>
  File "PiicoDev_BME280.py", line 28, in __init__
  File "PiicoDev_BME280.py", line 60, in _read16
OSError: [Errno 5] EIO
3 Likes

Hi Graeme,

Could you please post your code or link to code that you’re running? Generally, others have solved this with a small delay after writing to I2C, but we’d have to take a look at your code to work out whether this is a fix we need to do in the library, or your code.

https://forum.micropython.org/viewtopic.php?t=4746

Keen to get to the bottom of this!
-James

2 Likes

It’s the code unaltered from your tutorials. Failing to communicate with the three sensors I have installed.

3 Likes

Hi Graeme,

Sorry to hear you are running into issues, which dev board were you using and on your string of sensors do you have any duplicates? Although you can string many along with PiicoDev at the same time, I’d get them working individually then you can jump into more :smiley:

Liam.

2 Likes

All different sensors. Am using latest version of dev board which seems to be dated 2020
Have just been trying one sensor at a time anyway

3 Likes

Here is the code I am trying to run

# PiicoDev Atmospheric Sensor BME280 minimal example code
# This program reads Temperature, Pressure and Relative Humididty
# from the PiicoDev Atmospheric Sensor. An altitude reading is also
# available

from PiicoDev_BME280 import PiicoDev_BME280
from PiicoDev_Unified import sleep_ms # cross-platform compatible sleep function

sensor = PiicoDev_BME280() # initialise the sensor
zeroAlt = sensor.altitude() # take an initial altitude reading

while True:
    # Print data
    tempC, presPa, humRH = sensor.values() # read all data from the sensor
    pres_hPa = presPa / 100 # convert air pressurr Pascals -> hPa (or mbar, if you prefer)
    print(str(tempC)+" °C  " + str(pres_hPa)+" hPa  " + str(humRH)+" %RH")
    
    # Altitude demo
#     print(sensor.altitude() - zeroAlt) # Print the pressure CHANGE since the script began
    sleep_ms(100)
2 Likes

Hi Graeme,

Thanks for posting your code, I can’t see anything on the software side that might cause this, I’ve brought this to the attention of the rest of Tech Support, and the product design team, to see if there’s any bug fixes that need to happen.

In the meantime, could you please post a picture of how you’ve got everything hooked up? It might seem obvious, but we might be able to spot something

-James

2 Likes

Hi @Graeme150393 - an EIO error is most commonly triggered by a connection problem. Something somewhere is either unconnected or broken.

Aside: if you were to run your code with no module plugged in, you would receive the same error

If you’ve independently checked with 3 separate modules then that removes doubt about the module. Now we’re down to the cable and/or adapter.

As @James mentioned this is where some pictures would be great. What dev board are you working with? Pico? Microbit?

We try to include a helpful message when there is this kind of error at startup - I’ve modified the BME280 driver to include more helpful feedback.

4 Likes


Here’s the photo. I have also tried different leads with same result
This is result with updated BME280.

PiicoDev could not communicate with module at address 0x77, check wiring
Traceback (most recent call last):
  File "<stdin>", line 9, in <module>
  File "PiicoDev_BME280.py", line 32, in __init__
  File "PiicoDev_BME280.py", line 29, in __init__
  File "PiicoDev_BME280.py", line 64, in _read16
OSError: [Errno 5] EIO
1 Like

Hi Graeme,

Thanks for sending through a photo, I think your Pico may be installed in the adapter upside down.
Rotate the Pico in the adapter so that the USB connector is next to pin Zero.

Hopefully that’s all that’s holding you up and the modules should then work, if it doesn’t let us know and we’ll work through any other barriers!

3 Likes

Very embarassed! You were right of course. Sorry for taking up your time

3 Likes

Hi Graeme,

No worries, it happens all the time.
If it helps your embarrassment, you can sleep easy knowing that beginners may see this thread and learn from your experience.
Anyone who says they’ve never plugged something in backwards isn’t telling the truth! :grin:

2 Likes

Hi Graeme,

I can admit that I’ve fumbled around on the same mistake for a while, on my main experimental expansion board I have a white peice of electrical tape to specify the ‘top’ of the Pico. I also remember that power comes in on the same end, LiPo and USB.

Do you think there would be a seamless way to make it known on the expansion board which is the correct orientation?
PS: no such thing as time lost if someone learns something :smiley:

2 Likes

I think it’s clear in your installation instructions! You know - who needs to read the manual? :slight_smile: :grin:

2 Likes

I’ve just run into exactly the same problem:
“PiicoDev could not communicate with module at address 0x77, check wiring”
I do have the board in the correct way, though!
I tried a different USB cable, then a different USB port straight off the PC motherboard.
I tried two different connecting cables, tried them both into both connectors, even tried turning on the switch on the sensor and doing it all again… heck, I pull the cable out entirely and still get the same error.
What gives? Any clues?

1 Like

Welcome Steve!

If you run the following code what gets returned?

from machine import I2C
i2c = I2C(0)
i2c.scan()

Which module were you using and would it be possible to send through a quick photo of your setup?

The error is caused by the module not being recognised on the address that it thinks it should be.

1 Like

Hi Liam,

Thanks for the reply!

I have the Pi Pico, PiicoDev expansion board, PiicoDev SSD1306, and PiicoDev BME280 (the weather station starter kit).

I’ve thoroughly read through, and followed, the instructions from the business card - ie, How to Setup and Code on a Raspberry Pi Pico Using Thonny - Video Tutorial Australia etc. as well as all the documentation I can possibly find on the website, including your GitHub and Repositories.

I have only tried one module at a time, and the switch on both is set to ‘off’.

I have tried two different connecting cables (both came with the kit). I tried connecting them to either connector on each module.

I then removed the cable and used jumpers from +3.3v and ground, and from ‘D’ to pin 8, and from ‘C’ to pin 9.

In both cases I do get a green power-on light, but that is all.

I have tested the Pico - I successfully use Thonny to connect, and I have tried two different firmware updates. I can get it to work with print(‘hello’).

I have checked that my Pico is inserted the correct way.

I have tried different USB cables in different USB ports.

I have tried connecting a LiPo battery.

In doing all of the above, I have tried every sample script I can find in your GitHub, and I’ve checked the code content of both sensors’ .py files. I have also visited the weblinks inside the opening comments of the library files and tried sample code from other website.

This screenshot shows the answer to the question, “what code gets returned…”

Here’s a photo of what I have set up:

Looking forward to figuring this out!

1 Like

Hey Steve,

Thanks for sending those through and checking everything out😁

Other than the connectors possible not being all the way in I’d say everything looks as if it should be working.
If you try plugging them in a little more and chain the two can you get a response from the I2C code above? (maybe try putting the atmospheric sensor in the middle)
I’d also try reflashing the firmware with the UF2 listed in James’s topic: Raspberry Pi Pico W I2C/Piicodev Bug [Solved]

The USB connection looks alright and the cable Core includes with the kit works well. This can definitely be checked off the list of possible issues.

Let us know how you go with the above, if neither work I’d get in touch with Core!

2 Likes

Thanks Liam,

Once I updated the firmware to the one you suggested, all was peachy and rosy. Hells bells.

I do try to be as thorough as possible! That’s why I was banging my head when trying to figure this out…

Your assistance is greatly appreciated! I’ll let Graham know that maybe a small update on the ce-guides.com is in order, and stop anyone else stumbling on this one.

1 Like

Hi Steve,

Awesome!! Glad to hear you have it running and thanks for circling back and updating the topic with how you solved it :smiley:
And thorough you were, it was just the gotchas of nightly builds.
Fingers crossed I2C gets patched soon

1 Like