You are reading a single comment by @CanyonCasa and its replies. Click here to read the full conversation.
  • The negative temps readings are due to an error in line 39 of the module.

            temp : parseInt(d.substr(19,15),2)*0.2*(0.5-d[16])
    

    should be

            temp : parseInt(d.substr(19,15),2)*0.2*(0.5-d[18])
    

    as the data is offset by 2 leading bits. As such the sign is picking off the wrong bit, which inadvertently makes the temperature sign dependent on the value of the RH reading.

    My experience is that these sensors almost always fail on the first read as if there is some sort of initialization that the datasheet doesn't document. After that they always seem to read OK as long as the read rate is limited to 2 Hz per data sheet. Earlier code did not include the 500 ms delay (line 42) between repeat reads, which may explain some of the speed dependencies and why lengthening the read delay in earlier code helps (noted in another thread).

About

Avatar for CanyonCasa @CanyonCasa started