electricimp / reference

Electric Imp Reference Code
MIT License
94 stars 65 forks source link

ZERO timing is 1uS too fast for AM2302 device #31

Closed jimconner closed 9 years ago

jimconner commented 9 years ago

Timings didn't work for me with zero at 26uS, but after extensive debugging I managed to get it all working by chaning the timing for a zero to 27us

static ZERO              = 0.000027; // 27 us high for "0"

Can't confirm whether this 27uS timing will also work on the DHT22 as I only have the AM2302 to test with. According to the spec sheet on the AM2032 the max permissible for ZERO is 30uS so we should probably cater for 30uS really.

ersatzavian commented 9 years ago

Interesting. What datasheets I can dig up indicate that the AM2032 and DHT22 use the same timing, so that should be fine.

The timing diagrams show 26 to 28 µs, so I would not recommend setting the timing to 30µs; that just puts you up against the other limit. Looks like 27µs is what I should have used from the start.

Thanks for raising the issue!