- -4°C to +125°C temperature range with +/-0.5°C accuracy
- 0-100% relative humidity with 2-5% accuracy
- 0.5Hz sample rate (one sample every 2 seconds)
- 3 to 5V operation
- Power consumption just 4.3mA during reads, even less when idle
- Blue power LED
- Dimensions: 31(W) x 23(H) x 4(D)mm
- VIN: Connect to 5V on your microcontroller.
- DATA: Connect to a digital I/O line on your microcontroller (e.g Pin 13).
- GND: Connect to GND (0V) on your microcontroller.
#define DHTPIN 13
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(t) || isnan(h))
Serial.println("Error reading DHT!");
Values before and after breathing into the sensor.
I was saving the DHT driver files (DHT.h) to “C:\Program Files (x86)\Arduino\libraries\DHT” and not “%UserProfile%\My Documents\Arduino\libraries”. This is common knowledge but no one says this here, here or here.