Hi all,
I just recently got myself a Grove - Temperature & Humidity Sensor Pro (AM2302/DHT22). I plugged it into my Raspberry Pi 3B+ and Grove Base Hat PWM port and successfully read values of the sensor using Python3 and https://github.com/Seeed-Studio/Seeed_Python_DHT.
After about 2 - 3 hours the sensor stops working and keeps reporting the last successfully reading. The only thing that seems to reset it is to unplug the sensor and plug it in again or shutdown and startup your Raspberry Pi. Even a simple reboot of the Raspberry Pi doesn’t seem to do the trick either, so I assume it’s a power cycle that’s needed.
I observed this behavior the last three days and it’s always the same, after a couple of hours the sensor stops working and just repeats the last successful reading. In case the Python program is restarted, the readings come back with 0 for each, humidity and temperature.
I started looking at Seeed_Python_DHT and saw some commented print statements. I uncommented all of them and in the last run I can now observe that the library going into the “pullup by host 20-40us failed” section of the code, which explains the repeat of the same values (or 0 on startup of the program) - see <LINK_TEXT text=“https://github.com/Seeed-Studio/Seeed_P … #L131-L137”>https://github.com/Seeed-Studio/Seeed_Python_DHT/blob/master/seeed_dht.py#L131-L137</LINK_TEXT>
Unfortunately, I have no idea what “pullup by host 20-40us failed” means, nor how to correct that issue in software, rather than having to unplug the sensor. Any hints and insights are greatly appreciated!
Thanks,
Data-bus’s free status is high voltage level. When communication between MCU and DHT22 begin, program ofMCU will transform data-bus’s voltage level from high to low level and this process must beyond at least 1ms toensure DHT22 could detect MCU’s signal, then MCU will wait 20-40us for DHT22’s response.
Step 1: MCU send out start signal to DHT22:
<LINK_TEXT text=“https://www.sparkfun.com/datasheets/Sen … /DHT22.pdf”>https://www.sparkfun.com/datasheets/Sensors/Temperature/DHT22.pdf</LINK_TEXT>
Having the same issue here. Only poweroff “solves it” . since my knowledge in python is limited i can only ask for help