Vuzi / raspi-sensors

Deprecated - Nodejs C++ plugin, allowing to easily read data from raspberryPi's sensors.
https://www.npmjs.com/package/raspi-sensors
Apache License 2.0
26 stars 3 forks source link

DHT11 support #6

Closed adifah closed 7 years ago

adifah commented 8 years ago

Hi,

are there any plans on supporting the DHT11 sensor, which is very similar to the DHT22 sensor (not that accurate but cheaper). I already get data from my DHT11 with your lib, but the protocol seems to differ, so the data isn't very useful.

Thanks in advance!

Vuzi commented 8 years ago

The protocol seems actually simpler with the DHT11, I might add some support. I'll look into it this weekend !

Vuzi commented 8 years ago

Okay, so I've update master (and the npm version) with support for the DHT11, but as I don't have one myself, I can't really test if it works properly.

Can you check if the results given by the sensor are corrects ?

mechdrew commented 7 years ago

Hi @Vuzi, I have tried two different DHT11 modules, the humidity values appear to work but the temperature reads too high, 35-36 when it is actually closer to 20-21. I haven't tried a different location yet, but both sensors were consistently wrong on the temp.

mechdrew commented 7 years ago

I think I figured it out. I had used this with hap-nodejs for HomeKit usage, and it was converting to Fahrenheit (mistake 1), the actual temperature readings were ~2.0 C. The temperature data is being divided by 10 in the source, which I believe is wrong when looking at other DHT11 implementations. The temperatures look much more accurate if I multiply them by 10. I believe the humidity is fine (I honestly don't know on that one) but I think the division by 10 needs to be removed for the temperature.

Vuzi commented 7 years ago

Oh you're right, actually the result only needs to be divided by 10 for the DHT22/21 but not for the DHT11 , both for temperature and humidity. I'll fix that as soon as possible!

Vuzi commented 7 years ago

(I'll push the fix on npm a bit later)