I was testing DHT21 sensor in Uno for a project, which printed weird value so i changed.
With no success so i went to another. Again, no difference.
I do not want to believe that we have 4 sensors, and all of them is faulty,
while printing exact same wrong values.
This is my wiring, no resistors as I was told 21 comes internal.
#include <dht.h>
dht DHT;
#define DHT21_PIN 4
float hum;
float temp;
void setup() {
Serial.begin(9600);
}
void loop() {
int chk = DHT.read21(DHT21_PIN);
hum = DHT.humidity;
temp = DHT.temperature;
Serial.print("Humidity: ");
Serial.print(hum);
Serial.print(" %, Temp: ");
Serial.print(temp);
Serial.println(" Celsius");
delay(2000);
}
I used DHTlib from Mr.Tillaart, also tried DHTsensorlibrary of Adafruit,
which seems flawlessly working with others,
and this is what I get.
17:12:34.772 -> Humidity: 49.90 %, Temp: -101.90 Celsius
17:12:36.776 -> Humidity: 49.90 %, Temp: -101.90 Celsius
17:12:38.803 -> Humidity: 49.90 %, Temp: -102.00 Celsius
17:12:40.817 -> Humidity: 49.90 %, Temp: -102.00 Celsius
17:12:42.850 -> Humidity: 49.90 %, Temp: -101.90 Celsius
17:12:44.846 -> Humidity: 49.90 %, Temp: -101.90 Celsius
What's with my sensor and what should i try next?
2 posts - 2 participants