Skip to content
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

AM2301 support? #28

Open
hakwik opened this issue Feb 11, 2021 · 3 comments
Open

AM2301 support? #28

hakwik opened this issue Feb 11, 2021 · 3 comments

Comments

@hakwik
Copy link

hakwik commented Feb 11, 2021

Would it be possible to add support for the AM2301 (DHT21)? That would be much appreciated since it is one of the easiest available DHT sensors to me.

Datasheet is available here: http://www.haoyuelectronics.com/Attachment/AM2301/AM2301.pdf

@d2r2
Copy link
Owner

d2r2 commented Feb 13, 2021

@hakwik, did you try to use DHT22 or AM2302 setting to communicate with DHT21/AM2301 sensor?

I don't have this sensor in my assortment and I never test it, but what I see in this pdf looks very similar to what we have in AM2302/DHT22 docs: same 0 bit spec (26-28 microseconds 50 microseconds low plus high), same 1 bit spec (50 microseconds low to 70 microseconds high), and also data high level specs (2 bytes of humidity, 2 bytes of temperature, plus 1 byte control sum).

Can you try to test it in this way?

@hakwik
Copy link
Author

hakwik commented Feb 13, 2021

Thank you. It appears you're right, it is almost identical it seems. Still I can't make it work with these tools:

2021-02-13T10:43:53.807 [     dht] WARN  Can't decode pulse array received from DHTxx sensor, since incorrect length: 124
2021-02-13T10:43:55.343 [     dht] WARN  Can't decode pulse array received from DHTxx sensor, since incorrect length: 132
2021-02-13T10:43:56.879 [     dht] WARN  Can't decode pulse array received from DHTxx sensor, since incorrect length: 130

This sensor does work with Python and their deprecated Adafruit_DHT package, although I take it they use some other approach? My sensor here is old and perhaps it's time for me to move on from it anyway, it does not seem to be as accurate as it once were.

@d2r2
Copy link
Owner

d2r2 commented Feb 17, 2021

@hakwik, I can only recommend that you change the code yourself trying to make this sensor working... Additionally you can modify GetHandshakeDuration() function timeouts, probably this may help. Sorry, that I can't test it and fix the code myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants