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