The DHT temperature and humidity sensors are very popular. This projects support DHT10, DHT11, DHT12, DHT21(AM2301), DHT22(AM2302).
// GPIO Pin
using (Dht11 dht = new Dht11(26))
{
Temperature temperature = dht.Temperature;
double humidity = dht.Humidity;
}
Only DHT12 can use I2C protocol.
I2cConnectionSettings settings = new I2cConnectionSettings(1, DhtSensor.DefaultI2cAddressDht12);
I2cDevice device = I2cDevice.Create(settings);
using (Dht12 dht = new Dht12(device))
{
Temperature temperature = dht.Temperature;
double humidity = dht.Humidity;
}
- DHT10 datasheet (Currently only Chinese)
- DHT11 datasheet
- DHT12 datasheet
- DHT21 datasheet
- DHT22 datasheet