DHT does not work with root user using Raspberry Zero WH

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
javanxd
 
Posts: 3
Joined: Wed Sep 15, 2021 2:50 pm

DHT does not work with root user using Raspberry Zero WH

Post by javanxd »

Hello,

me and others are facing the following problem, that the most recent Adafruit DHT Library (the other libs are "deprecated") does not work with root user on Raspberry Pi Zero W.

I described all the other details in the GitHub issue: https://github.com/adafruit/Adafruit_Ci ... /issues/73 Because this did not receive any reply after 1 months I am creating this topic on the Adafruit forum. It would be great if someone from the Adafruit DHT Library team can work on this issue. Hopefully this receives some attention from an official or an DHT Library developer.

I noticed that I am not the only one affected by this issue:

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

Re: DHT does not work with root user using Raspberry Zero WH

Post by adafruit_support_mike »

The library is deprecated because the DHT sensors don't really use I2C, and the RasPi's microprocessor I2C interface doesn't support the kind of timing control necessary to make things work properly.

If the DHT sensors were high quality or had some feature that was hard to reproduce, it might be worth creating and maintaining a kernel module to make it work, but they aren't. They're middle-of-the-road sensors that whose features can be reproduced by other devices of similar price that are more compatible with the RasPi.

We see no advantage in spending time and effort encouraging people to use a sensor in a context where its performance is mediocre at best and buggy in general.

That said, all of our code is Open Source. Anyone who wants to improve it is free to do so, and in the OSS environment the correct answer to "why doesn't someone do X?" is "why don't you?"

User avatar
javanxd
 
Posts: 3
Joined: Wed Sep 15, 2021 2:50 pm

Re: DHT does not work with root user using Raspberry Zero WH

Post by javanxd »

adafruit_support_mike wrote:in the OSS environment the correct answer to "why doesn't someone do X?" is "why don't you?"
I spent many hours debugging it, researching for this issue (referenced other issues) until I figured out that the problem only occurs if I run it as "root" user. If I would have the knowledge I would have already fixed it because I am maintaining other OSS projects which are dependent on this Adadruit DHT library.

The library I am referring to is not deprecated: https://github.com/adafruit/Adafruit_CircuitPython_DHT
The other library (https://github.com/adafruit/Adafruit_Python_DHT ) is deprecated, now suggesting to use the lib from above.

User avatar
javanxd
 
Posts: 3
Joined: Wed Sep 15, 2021 2:50 pm

Re: DHT does not work with root user using Raspberry Zero WH

Post by javanxd »

Dear Support,

we noticed that not only the "adafruit-circuitpython-dht" library does not work on Raspi Zero WH but also the "adafruit-circuitpython-hcsr04" lib does have time same issue (not working if called with root user, ref: https://github.com/adafruit/Adafruit_Ci ... -957283221 ).

Especially after Raspberry announced it's new Raspi Zero 2 it would be great if you start supporting Raspi Zero devices.

Thank you

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

Return to “Microcontrollers”