DHT11: InvalidPulseCount: Expected 84 but got 76 pulses

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: DHT11: InvalidPulseCount: Expected 84 but got 76 pulses

Post by Roberthh » Fri Nov 05, 2021 1:18 pm

You could try to change lines 162, 163 from

Code: Select all

                humidity=value[0] & 0x7f
                temperature=value[2] 
to

Code: Select all

                humidity = (value[0] & 0x7f) + value[1] / 10.0
                temperature = value[2] + value[3] / 10.0
According to the data sheet, that should be right. But it may be, that this data in value[1] and value[3] is always 0, in which case you get a float out of this setting with the decimal being 0 all the time. The standard driver does not use this nmbers as well. In case that you sensor is actually a DHT22 model, you should change the call.

Komfibrot
Posts: 7
Joined: Wed Oct 27, 2021 2:08 pm

Re: DHT11: InvalidPulseCount: Expected 84 but got 76 pulses

Post by Komfibrot » Mon Nov 08, 2021 8:45 am

Thank you, I changed the Line 135 & 136 according to your new code and I get float values. thank you!

Now I get no further questions about it. You helped me a lot!

Post Reply