Skip to content

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

@fabianmuehlberger

Description

@fabianmuehlberger
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions