I recently tried out the DIYMalls DHT11 temperature and humidity (DHT11) sensors with an Arduino Uno. With simple 3 wire set up (+5 volts, ground, and data) and the Adafruit DHT library, it was super simple to get readings streaming over the serial monitor.
Example code is as follows:
// Must install Adafruit DHT library and unified sensor library. // Code below borrows heavily from their example code, but distills it down to the bare minimum. #include <DHT.h> // Connect the yellow/Signal/data line to pin 4 // Connect the GND/black line to GND // Connect the Red/VCC line to 5V #define DHTPIN 4 #define DHTTYPE DHT11 DHT dht(DHTPIN, DHTTYPE); void setup() { Serial.begin(9600); Serial.println("DHT11 test!"); dht.begin(); } void loop() { // Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) float h = dht.readHumidity(); // Read temperature as Fahrenheit (isFahrenheit = true) float f = dht.readTemperature(true); Serial.print(F("Humidity: ")); Serial.print(h); Serial.print(F("% Temperature: ")); Serial.print(f); Serial.println(); delay(2000); }