Skip to content

DHT11 not working properly #66

Open
@yeyeto2788

Description

@yeyeto2788

Using version 3.5.8 in a loop it almost never gets a reading with the following code:

import time
import board
import adafruit_dht

dhtDevice = adafruit_dht.DHT11(board.PG6)


for try_number in range(1,200):
  print(f"Try number {try_number}")
  try:
    print(f"Got temp of: {dhtDevice.temperature}")
    print(f"And hum of: {dhtDevice.humidity}")
    break
  except RuntimeError as e:
    print(e)
    time.sleep(2.1)
  else:
    time.sleep(2.1)
  print("\n")

The weird part is that using the version 3.5.5 it actually get the readings correctly.

More data:
Python: 3.8.5
SBC: Orange Pi Lite
Installed libraries:

Adafruit-Blinka==6.4.1
adafruit-circuitpython-busdevice==5.0.6
adafruit-circuitpython-dht==3.5.5
adafruit-circuitpython-mcp3xxx==1.4.5
Adafruit-PlatformDetect==3.4.0
Adafruit-PureIO==1.1.8
appdirs==1.4.4
attrs==20.3.0
bcrypt==3.2.0
cached-property==1.5.2
certifi==2019.11.28
cffi==1.14.3
chardet==3.0.4
cryptography==3.2.1
dbus-python==1.2.16
distlib==0.3.1
distro==1.5.0
distro-info===0.23ubuntu1
docker==4.3.1
docker-compose==1.27.4
dockerpty==0.4.1
docopt==0.6.2
filelock==3.0.12
idna==2.8
iotop==0.6
jsonschema==3.2.0
mudpi==0.10.0
paho-mqtt==1.5.1
paramiko==2.7.2
pycparser==2.20
pyftdi==0.52.9
PyGObject==3.36.0
PyNaCl==1.4.0
pyrsistent==0.17.3
pyserial==3.5
python-apt==2.0.0+ubuntu0.20.4.4
python-dotenv==0.15.0
pyusb==1.1.1
PyYAML==5.3.1
redis==3.5.3
requests==2.22.0
requests-unixsocket==0.2.0
six==1.14.0
texttable==1.6.3
unattended-upgrades==0.1
urllib3==1.25.8
virtualenv==20.1.0
websocket-client==0.57.0

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