Need help with DHT11 with Raspberry Pi Pico

June 20, 2024, 14:34

dethress

Hey, I just installed a DHT11 sensor on my breadboard, connected rp pico to my PC, installed dht.py library onto it and triet running a simple code to test if it works but all I get is :
MPY: soft reboot
Invalid pulse count error: Expected 84 but got 1 pulses
Invalid pulse count error: Expected 84 but got 1 pulses
GND is connected to GND, Data to GPIO26 and VCC to 3v3. Also here's the link where I got dht.py from: https://www.instructables.com/DHT11-With-Raspberry-Pi-Pico/

oops.se

And you modified the code to the pin of your choosing ?

dethress

Correct

dethress

Otherwise I'd be getting 0 pulses

oops.se

True with some exceptions.

dethress

I tried other pins just to check if it's valid and yeah, I get 0 pulses on empty GPIO pins. Any idea why am I getting 1 pulse instead? FIY I have burned my previous DHT11 cause I have connected power inaccurately. Could it be that something on my Pico got damaged? Although a temperature module (not dht11) works fine and records the temperature, LCD works as well.

oops.se

the comments in the URL can give some hints

oops.se

Have you check them?

dethress

I have yet to try self.close() as well as changin lib name to dhtlib.py as I've seen a comment saying that apparently raspberry might already have a dht library

dethress

Any other ideas other than that?

oops.se

Noop, you catch the two reasons I can think of from the comments.

dethress

So, saving lib as dhtlib.py didn't help and when I tried addint the self.close() to lib file I got the following error: Traceback (most recent call last): File "<stdin>", line 9, in <module> File "dhtlib.py", line 53, in temperature File "dhtlib.py", line 38, in measure AttributeError: 'DHT11' object has no attribute 'close'