Indoor Weather Station
The most important indoor weather parameters useful to us are air temperature and relative humidity. Relative humidity is the percentage of amount of moisture present in the air compared with maximum amount of moisture possible at that temperature. Typical indoor temperature range is 10°C to 35°C. Relative humidity can vary between 0% and 100%, depending whether the are is costal or mountainous, dry or rainy etc.

Temperature can be measured by sensors like thermocouples or thermistors while humidity can be typically be measured using capacitive sensors.
In this project we will use temperature & humidity sensor block which uses a DHT-22 sensor. The DHT-22 sensor uses Negative Temperature Coefficient (NTC) thermistor to measure temperature and a capacitive element to measure relative humidity. It can measure temperatures between -40°C to 80°C and relative humidity of 0% to 100%.
We will use Liquid Crystal Display block to display the temperature and humidity readings. Check out the project on using LCD screen before proceeding with this project.
Components
- Microcontroller Block
- Temperature & Humidity Sensor Block
- LCD Screen Block
- Battery Block
- Connectors
Connections
The temperature and humidity sensor has 3 wires. Connect the red terminal to the 5V pin and the black terminal to the ground (negative) pin on the microcontroller block. Connect the yellow terminal to a digital I/O pin, say D4.
Connect the LCD block red terminal to 5V pin and black terminal to ground (negative) pin of the battery block. Connect the white terminal to pin A4 & green terminal to pin A5 of the microcontroller block.

Code
Follow the procedure mentioned in the LCD screen board project to identify LCD I2C address. Keep the address handy for using it in the code.
The DHT-22 sensor used in temperature & humidity sensor can be integrated using a library. Go to manage libraries and download library named “DHT”.

The code for reading temperature & humidity and displaying it on LCD sensor is as below.
/*
program to read temperature and relative humidity with DHT-22 sensor
and display it on LCD screen with I2C connection
@Makernova Robotics 2025
*/
#include <LiquidCrystal_I2C.h> // add library for I2C communication with LCD display
#include <dht.h> // add library for DHT sensor
LiquidCrystal_I2C lcd(0x27, 16, 2); // 0x27 is the I2C address of LCD. This is from i2c scanner
const int dataPin = 5; // Digital pin D5 connected to temperature sensor block data pin
dht DHT; //creates an object called DHT
void setup() {
// put your setup code here, to run once:
lcd.init(); // initialize lcd screen
lcd.clear(); // clears data on lcd screen
lcd.backlight(); // switches backlight of LCD screen
}
void loop() {
int readData = DHT.read22(dataPin); // DHT sensor data is read into a variable
// put your main code here, to run repeatedly:
float temp = DHT.temperature; // captures temperature
int humidity = DHT.humidity; // captures humidity
lcd.clear(); //clear LCD screen
lcd.setCursor(1, 0); //Set cursor to character 2 on line 0
lcd.print("Temp: "); // prints TEMP:
//lcd.setCursor(0,9); //Set cursor to character 2 on line 0
lcd.print(temp); // prints the value of temperature from sensor
//lcd.setCursor(0,11); //Set cursor to character 2 on line 0
lcd.print(char(223)); // prints degrees symbol
//lcd.setCursor(0,12); //Set cursor to character 2 on line 0
lcd.print("C");
lcd.setCursor(1, 1); //Set cursor to character 2 on line 0
lcd.print("Humidity: "); // prints Humidity:
lcd.print(humidity); // prints value of humidity from sensor
lcd.print("%");
delay(5000); // refresh every 5 seconds
}


