-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
Hi,
I'm testing a DHT22 on a RPi 4.
It works well using both the example code from node-dht-sensor and Adafruit CircuitPython.
However, after a number of iteration I found out that Python almost always give me a higher humidity than Node.
After a number of iterations using Python the first iteration using Node is showing a "Python high" humidity value, but the following iterations if showing a lower value. It is easily reproducible.
Any hints on why there at all may be a difference?
This is the code snippets:
var sensor = require("node-dht-sensor");
sensor.read(22, 4, function(err, temperature, humidity) {
if (!err) {
console.log(`temp: ${temperature}°C, humidity: ${humidity}%`);
}
});
import adafruit_dht
from board import *
# GPIO17
SENSOR_PIN = D4
dht22 = adafruit_dht.DHT22(SENSOR_PIN, use_pulseio=False)
temperature = dht22.temperature
humidity = dht22.humidity
print(f"Humidity= {humidity:.2f}")
print(f"Temperature= {temperature:.2f}°C")
Metadata
Metadata
Assignees
Labels
No labels