Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

OSError: [Errno 5] EIO #1

Open
YachtMango opened this issue Jul 18, 2024 · 4 comments
Open

OSError: [Errno 5] EIO #1

YachtMango opened this issue Jul 18, 2024 · 4 comments

Comments

@YachtMango
Copy link

Hi,

Tried to use this on a number of RP2040 based micro-controllers:

Pico W + hat that has STEMMA QT / Qwiic connector
Pimorono Pico Lipo
Pimoroni Badger.

All examples above can see the sht40 on I2C hexadecimal address: 0x44 so the wiring looks ok but as soon as I instantiate the sht40 object and get a reading I get.

MPY: soft reboot
Traceback (most recent call last):
File "", line 9, in
File "/lib/micropython_sht4x/sht4x.py", line 152, in measurements
OSError: [Errno 5] EIO

Typically this indicates a wiring issue but as noted the sht40 can be seen in i2c.

Researching this I found this same/similar but doesn't looked like they ever raised an issue?

https://github.com/orgs/micropython/discussions/14334

@jposada202020
Copy link
Owner

What kind of sensor are you using?

@YachtMango
Copy link
Author

Adafruit Sensirion SHT40 Temperature & Humidity Sensor.

Using circuit python and the https://github.com/adafruit/Adafruit_CircuitPython_SHT4x it works reliably

However the rest of my project is on micropython so keen to get a working MP solution. TIA

@jposada202020
Copy link
Owner

Interesting, libraries are not that different. Could you try in your code a reset of the sensor. If this does not work need to see what happens with my sensor. (I do not have my MicroPython setup right now, as I wanted to work in some CircuitPython Projets this winter :) )

import time
from machine import Pin, I2C
from micropython_sht4x import sht4x

i2c = I2C(1, sda=Pin(2), scl=Pin(3))  # Correct I2C pins for RP2040
sht = sht4x.SHT4X(i2c)
sht.reset()

while True:
    temperature, relative_humidity = sht.measurements
    print(f"Temperature: {temperature:.2f}°C")
    print(f"Relative Humidity: {relative_humidity:.2%}%")
    print("")
    time.sleep(0.5)

@YachtMango
Copy link
Author

Adding the reset() gives

Traceback (most recent call last):
File "", line 27, in
File "/lib/micropython_sht4x/sht4x.py", line 257, in reset
OSError: [Errno 110] ETIMEDOUT

If I handle the OSError: [Errno 5] EIO I can get readings but the count of the number of error keeps going up for each iteration

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants