I’ve built a simple indoor weather station using a Temperature and Humidity sensor and an LCD screen. Here are the instructions on how to build it yourself:
First, you need the following components
- Stanadrd 16 x 2 Character LCD Display Module
- DHT11 3-Pin Digital Temperature Humidity Sensor Module
- 10k Ohm Resistor
- 10k Ohm Variable Resistor
- Mini Prototype Printed Circuit Board Breadboard
- Arduino UNO rev3
Second, connect the components as shown in the diagram to the right. Note that the sensor has three pins, not four as shown in diagram.
Once all wires are connected, power up the Arduino by connecting the USB cable to a PC (or use a power supply). Adjust the 10k Ohm variable resister until you see some bright characters (probably nothing that makes sense at this point) contrasting against the dark background.
Third, compile and upload the following Sketch to your Arduino:
// A Sketch that reads a Temprature & Humidity sensor (DHT11) // and displays the output on an LCD module #include "DHT.h" #include #define DHTPIN 8 // set the signal pin of the sensor #define DHTTYPE DHT11 DHT dht(DHTPIN, DHTTYPE); // Initialize the LCD library with the numbers of the interface pins: // RS, Enable, D4, D5, D6, D7 LiquidCrystal lcd(12, 11, 5, 4, 3, 2); long REFRESH = 60000; // update every 60 sec void setup() { lcd.begin(16, 2); dht.begin(); Serial.begin(9600); } void loop() { float humi = dht.readHumidity(); float temp = dht.readTemperature(); if (isnan(temp) || isnan(humi)) { Serial.println("Failed to read from sensor"); lcd.setCursor(0, 0); lcd.print("Cannot read "); lcd.setCursor(0, 1); lcd.print("from sensor "); } else { lcd.setCursor(0, 0); lcd.print("Temp="); lcd.print(int(temp)); lcd.print(" *C "); lcd.setCursor(0, 1); lcd.print("Humidity="); lcd.print(int(humi)); lcd.print("% "); Serial.println(temp); } delay(REFRESH); }
Now, the temperature and humidity readings will update every 1 minute. An error message will appear on the LCD screen and the serial monitor if Arduino cannot read the sensor.