Write a Review (requires login)
It definitely behaves like a DHT-11. After installing the Adafruit sensor library and dht library, this code will get it working off of pin 2 on an Uno:
#include "DHT.h"
DHT dht(2,DHT11);
void setup()
{
Serial.begin(9600);
dht.begin();
}
void loop()
{
float h,t;
delay(2000);
h = dht.readHumidity();
t = dht.readTemperature();
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" Temp: ");
Serial.println(t);
}
Unfortunately, these do not work like the data sheet says. According to the data sheet, the output is 2 bytes of H data followed by 2 bytes of T data, and then followed by a 1 byte check sum. You do get 5 bytes of output. However, there is only 1 byte of H data, followed by a zero byte, then 1 byte of T data, followed by a zero byte. Both data bytes appear to be more or less correct, as does the checksum, but you are limited to a resolution of 1% in H and 1C in T. The data sheet promises a resolution 10 times that.