-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32: need a module DHT21/22/AM2301 #1874
Comments
I'd propose to use the RMT peripheral to implement the low-level protocol for talking to this family of sensors. An RX channel can capture data bits from the sensor in read direction and decoding to '0' and '1' is done based on the duration between the signal edges. This worked very well for the The start impulse in TX direction can be done with simple gpio writes, roughly timed by |
Had a look at the existing |
There's a draft version available in my repo over at https://github.com/devsaurus/nodemcu-firmware/tree/dev-esp32-dht I've tested it with an AM2302 sensor that happened to be in my stock. Checking against a DHT11 is still required before merge to upstream since this variant triggers substantially different paths in the code. |
@devsaurus
|
Thanks for reporting @LDmitryL! I'll have a look. |
Running the contained functions triggers an error message in the RMT driver code. I've reported this to Espressif and suggested a fix with espressif/esp-idf#492. Furthermore, there appear to be interoperability issues between this module and the @jmattsson: |
Yes, indeed there is a bug in the module DHT module in conjunction with the OW. Separately they work but together no.
the message after the call |
Fixed in |
Module merged into |
I tried to build a release version, but got
BTW, I did not select dht module. |
I ran a build on |
I meant choosing |
I see. The error was correct and I just pushed a fix for it. Strangely it's not reported for a debug build... |
@devsaurus Managed to overcome the problem with RMT? |
Interoperability with onewire remains problematic since espressif/esp-idf#486 is still waiting for a resolution. |
@devsaurus I noticed that the problem with RMT was fixed. (message |
No, the root cause for that is espressif/esp-idf#486. |
I updated to latest esp-idf which contains a fix for espressif/esp-idf#486. Waiting for a response to espressif/esp-idf#719. |
…source only when all the handlers disabled. also document handlers sharing a same source. TW#13454, nodemcu/nodemcu-firmware#1874 Breaking change: handles assigned to a same source should have the same flag now.
@devsaurus This fix is already included? |
Missing feature
Need the library to support reading the sensors of the type DHT21/22/AM2301
Justification
This is the most convenient and easy way to get humidity.
And most importantly low cost!
Which is very important for home automation.
Workarounds
API for module
dht
from ESP8266 goodSubset of API from ESP8266.
dht.read2x(pin)
Read a DHT21/22/AM2301 sensor at given
pin
.Returns
status
,temp
,humi
,temp_dec
,humi_dec
with repsective support for float and integer build.dht.read11(pin)
Read a DHT11 sensor at given
pin
.Returns
status
,temp
,humi
,temp_dec
,humi_dec
with repsective support for float and integer build.The text was updated successfully, but these errors were encountered: