Using a DHT11 with a LoPy works with old firmware version but not new firmware?
-
I am constructing a demo-kit for use in education. The cheap DHT11 sensor is ideal. If a kid breaks it, it's only €3. After reading several posts and links to python libraries for the DHT11 temperature and humidity sensor i copied some code liberally from here Pure Python library for reading DHT sensor on Pycom boards and came up with a sample program for the LoPy.
My code is here: https://github.com/puthli/meet-de-klas/tree/master/micropython/demo-kit
It reads the DHT11 sensor and forwards the readings to 'the things network' over LoRa. If you don't have the things network coverage you can remove lines 34-37 and 61 and just view the DHT11 readings every 20 seconds.The code works for LoPy's straight out of the box on firmware version 1.8.6-237, but when i upgraded the firmware to the latest version with the pycom firmware update tool, the driver for the DHT11 no longer works. Now it only produces zeroes for the temperature and humidity readings. We have reproduced this on two separate LoPy's.
Downgrading LoPy firmware is complicated it seems and i am hesitant to go down that route.
But it is unclear why the DHT11 code no longer yields any data.
Any clues are welcome. It you have a LoPy and a DHT11, you can try out the code yourself.
-
hello,
@robin said in Using a DHT11 with a LoPy works with old firmware version but not new firmware?:JurassicPork's library did not work for me.
What code ?
I have two branches in my library :
master with the old method to collect the data .
and pulses_get using the new function pulses_get
Be careful in this branch the constructor has changed (see new examples)Friendly, J.P
-
@robin The link I gave is a new version of @Jurassic-Pork library, which worked for me. Confusingly, his code is now called dth.py. To be honest, I did not try it with 1.9.0 yet. It it does not work, there may be another problem.
-
Thanks @robert-hh
JurassicPork's library did not work for me.
I will try the pycom.pulses_get(pin, timeout) this evening.
-
@robin Please use in __collectinput() the method pycom.pulses_get(pin, timeout), which is more stable. There is also a DHT11 lib by @Jurassic-Pork which uses pulses_get. https://github.com/JurassicPork/DHT_PyCom/tree/pulses_get