Shop OBEX P1 Docs P2 Docs Learn Events
AM3201 DHT21 Temperature and Humidity Sensor Object — Parallax Forums

AM3201 DHT21 Temperature and Humidity Sensor Object

Prophead100Prophead100 Posts: 192
edited 2012-09-20 22:30 in Propeller 1
For those who like odd little serial communication, I put together an object to read the temperature and humidity from an AM3201/DHT21 Sensor using a unique 1-wire serial protocol with 5 byte packets where 0s are 26uS long and 1s are 70uS. Its and interesting protocol that can be handled easily on the Prop. The object launches another cog and automatically returns the temperature and humidity to variables in memory every few seconds as degrees F and relative percent respectively. It also returns an error byte where true means the data received had correct parity. For C programmers, I'll post the related MIT license C code when I post it to the OBEX. These sensors are not as nice as the Sensirion temperature and humidity sensor but they're cheap for low precision projects like running a vent fan. If you have one of these sensors, feel free to try it and send me any feedback.

Spin Files: DHT21.zip

MIT Lic. C Files from Adafruit DHT CPP Example.zip
Sign In or Register to comment.