Table of Contents

DHT22

The DHT22 is perhaps the best iteration of the DHT22 sensors giving maximal performance for the buck with a very low and negligible error.

Code Hints

The DHT22 library by dam74 (dvarrel) works best for this device:

#include <DHT22.h>
 
//DHT_PIN_ANALOG is the analog GPIO pin connected to the DHT22 analog output
DHT22 dht22(DHT_PIN_ANALOG);
 
float t = dht22.getTemperature();
float h = dht22.getHumidity();
 
if (dht22.getLastError() != dht22.OK) {
    Serial.println("Last error: " + dht22.getLastError());
    return;
}
 
if(isnan(t)) {
    Serial.println(t);
}
 
if(isnan(h)) {
    Serial.println(t);
}

Index


iot/sensors_rundown/dht-series_of_sensors_dht11_dht12_dht22/dht22.txt ยท Last modified: 2025/03/31 13:45 by office

Wizardry and Steamworks

© 2025 Wizardry and Steamworks

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.