Skip to content

AM2315 OSError: [Errno 19] No such device #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fabianmuehlberger opened this issue Sep 13, 2022 · 3 comments · Fixed by #30
Closed

AM2315 OSError: [Errno 19] No such device #27

fabianmuehlberger opened this issue Sep 13, 2022 · 3 comments · Fixed by #30

Comments

@fabianmuehlberger
Copy link

Temperature:  25.9
Traceback (most recent call last):
  File "<stdin>", line 12, in <module>
  File "/lib/adafruit_am2320.py", line 149, in relative_humidity
  File "/lib/adafruit_am2320.py", line 123, in _read_register
OSError: [Errno 19] No such device

The error occurs if temperature and humidity are read without delay between readings.

following code is used:

import board
import busio
import time
import adafruit_am2320

i2c = busio.I2C(scl=board.GP17, sda=board.GP16)
am = adafruit_am2320.AM2320(i2c)

while True:
    print("Temperature: ", am.temperature)
    time.sleep(0.03) 
    print("Humidity: ", am.relative_humidity)
    time.sleep(1)

at least 0.03 seconds of sleep is needed for the code to run correctly.

running on a raspberry pico W
circuitpyton v 8.0.0
no other devices attached
10k resistors are used to decouple scl and sda
the sensor is supplied with 3.3 V

@tekktrik
Copy link
Member

@dhalbert @jepler were there any changes to I2C in CircuitPython 8.0? The fix could be here to just add some more delay between readings, but wanted to check.

@happy4pizza
Copy link

I believe the issue is caused because you are sending two data packets at the same time from a device with only one IC address, I think this is distorting the data so your microcontroller can't read it. I would just increase time.sleep. This seems to be a hardware limitation and can only be fixed if we change the board.

@tyeth
Copy link

tyeth commented Aug 21, 2023

Similar issue in arduino adafruit/Adafruit_AM2320#13

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

Successfully merging a pull request may close this issue.

4 participants