Hello, I have a Raspberry PI 2 and a couple new PI 4s. I have been using a DHT22 connected to the PI2 successfully using Adafruit/examples/AdafruitDHT.py successfully.
I connect power to pin 1, data to pin 7 (gpio4) and ground to pin 9. running the script it returns temperature and humidity using sudo python AdafruitDHT.py 22 4.
The problem is when I connect the same and run the same on a couple different PI 4s it does not work.
Is there something different about the PI4? I have tried other GPIO pins on the PI 4s unsuccessfully and tested successfully on the PI2 with other pins.
DHT22 works on PI2 but not PI4
Moderators: adafruit_support_bill, adafruit
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
- adafruit2
- Posts: 22145
- Joined: Fri Mar 11, 2005 7:36 pm
Re: DHT22 works on PI2 but not PI4
DHT22 is really really annoying to use. please use a different sensor, like the AHT20
https://www.adafruit.com/product/5183
https://www.adafruit.com/product/5183
- FruitIncognito
- Posts: 2
- Joined: Fri Aug 20, 2021 11:06 am
Re: DHT22 works on PI2 but not PI4
Okay I get your recommendation, thank you for that. It would be helpful to understand what is different. Why does the DHT22 work just fine on an older raspberry PI but not on a pi4. What is different?
- adafruit2
- Posts: 22145
- Joined: Fri Mar 11, 2005 7:36 pm
Re: DHT22 works on PI2 but not PI4
linux just doesn't work well with this sensor, it is timing specific
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.