Help with DHT22 (am2302) error messages

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
bobs409
 
Posts: 13
Joined: Sat Sep 05, 2020 6:30 pm

Help with DHT22 (am2302) error messages

Post by bobs409 »

A newbie here so be gentle. lol

For a few weeks now, I've been torturing myself trying to get an AM2302 sensor to display the readings to my SSH terminal and eventually I want to use a 16 x 2 LCD screen with my raspberry pi. I have found many sites that have guides on how to do both and have tried them all. The code uses the Adafruit dht library shown here: https://github.com/adafruit/Adafruit_Py ... /README.md

When I try to run it, I get this:

Code: Select all

Traceback (most recent call last):
  File "/home/pi/humidity.py", line 7, in <module>
    humidity, temperature = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_DHT/common.py", line 94, in read_retry
    humidity, temperature = read(sensor, pin, platform)
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_DHT/common.py", line 80, in read
    platform = get_platform()
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_DHT/common.py", line 60, in get_platform
    from . import Beaglebone_Black
  File "/usr/local/lib/python3.7/dist-packages/Adafruit_DHT/Beaglebone_Black.py", line 24, in <module>
    from . import Beaglebone_Black_Driver as driver
ImportError: cannot import name 'Beaglebone_Black_Driver' from 'Adafruit_DHT' (/usr/local/lib/python3.7/dist-packages/Adafruit_DHT/__init__.py)
I have found others with the exact same error messages but haven't found anyone that actually replied to them with the cure.

Can anyone make any sense of this? I checked and the common.py file is where it should be.


Thank you in advance,


Bob

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Help with DHT22 (am2302) error messages

Post by adafruit_support_mike »

The library you're using is an older one we don't update any more. The code it uses to identify the kind of computer running the code doesn't recognize your RasPi's hardware ID.

Try using our newer CircuitPython system:

https://learn.adafruit.com/circuitpytho ... spberry-pi

It's a hardware abstraction layer that manages things like pin locations and interface libraries so the same code can run on multiple platforms.. microcontrollers or a RasPi.

Once you have that, you can use our current DHT22/AM2303 library:

https://learn.adafruit.com/dht-humidity ... thon-setup

User avatar
bobs409
 
Posts: 13
Joined: Sat Sep 05, 2020 6:30 pm

Re: Help with DHT22 (am2302) error messages

Post by bobs409 »

Thank you Mike! I'll certainly check all that out.


Bob

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”