Learn to Build Arduino Weather Station using DHT11, Soil Sensor, and Nokia Display
In this project tutorial, we are going to make an Arduino weather station using 2 sensors; FC-28 soil moisture sensor to measure the moisture and the DHT22 sensor to measure the temperature, humidity and the heat index. All the measured parameters (with the help of sensors) will be displayed using Nokia 5110 LCD.
Before we proceed further building our Arduino weather station, let’s see some tutorials which is a prerequisite to successfully implement this project. You may learn how to use Soil moisture sensor with Arduino and also you may learn how DHT11 is interfaced with Arduino. Finally, learn how to use Nokia5110 LCD with Arduino. Once you cover all those three tutorials, you are ready to build a weather station using Arduino.
The required components for this project are as follows
- Arduino Uno
- Nokia 5110 LCD
- DHT22 Temperature and humidity sensor
- FC-28 Soil moisture sensor
- Connecting wires
- 1k potentiometer
- 4 X 10k resistors
- 1k resistor
- 330 ohm resistor
Working: Weather Station using Arduino
In this weather station project, we are going to use two sensors. One is for measuring the moisture of the soil and the other is for reading the temperature, humidity and the heat index.
The FC- 28 soil moisture sensor gives us reading in the form of analog voltage from 0 to 1023. When the soil is dry, the output value of FC-28 sensor will be closer to 1023 and when the soil is wet, the value will be closer to zero. Moisture is measured in percentage, so we need to convert these values to a new scale measuring zer0 to 100. This percentage is then be displayed on the Nokia 5110 LCD.
The DHT22 sensor can measure temperature, humidity, and heat index. The DHT22 sensor gives output in the digital form and is fed directly through the digital I/O pins of Arduino. The Arduino reads this output and calculates temperature, humidity, and the heat index. These values are then displayed on the Nokia 5110 LCD.
First of all, let’s connect the Nokia 5110 LCD with the Arduino. Follow the instructions below.
- Connect the RST pin of Nokia 5110 LCD to the pin 6 of Arduino through the 10k resistor
- Connect the SCE pin of Nokia 5110 LCD to the pin 7 of Arduino through the 1k resistor
- Connect the D/C pin of Nokia 5110 LCD to the pin 5 of Arduino through the 10k resistor
- Connect the DIN pin of Nokia 5110 LCD to the pin 4 of Arduino through the 10k resistor
- Connect the CLK pin of Nokia 5110 LCD to the pin 3 of Arduino through the 10k resistor
- Connect the VCC pin of Nokia 5110 LCD to the 3.3V pin of Arduino
- Connect the LED pin of Nokia 5110 LCD to the middle pin of 1k potentiometer through the 330 ohm resistor and connect the other two ends of the potentiometer to the VCC and the GND.
- Connect the GND pin of Nokia 5110 LCD to the GND pin 6 of Arduino
After that, make the connections of the DHT22 sensor and FC-28 soil moisture with the Arduino.
Connections for DHT22 with Arduino
- Connect pin 1 (VCC pin) of DHT22 sensor to the 5V pin of Arduino
- Connect pin 2 (Data pin) of DHT22 to the pin 8 of Arduino
- Connect pin 4 (GND pin) of DHT22 to the GND pin of Arduino
Connections for FC-28 with Arduino
- Connect VCC pin of FC-28 to 5V of Arduino
- Connect A0 pin of FC-28 to A0 of Arduino
- Connect GND pin of FC-28 to GND of Arduino
First of all, we need to include the libraries for the Nokia 5110 LCD and the DHT22 sensor. After adding the libraries, we initialized a variable named ‘lcd’ of type PCD8544 and a variable named ‘temp_hum_sensor’ of type DHT. Then we declared the pin 8 for DHT22.
#include <PCD8544.h> PCD8544 lcd; #include "DHT.h" #define DHTPIN 8 #define DHTTYPE DHT22 DHT temp_hum_sensor(DHTPIN, DHTTYPE);
In the setup function, we started the communication with the Nokia 5110 LCD at ’84 X 48’ dimensions and printed “Reading From the Sensors” on the LCD screen. Then we started the communication with the DHT22 sensor.
lcd.begin(84, 48); lcd.print("Reading From the Sensors"); temp_hum_sensor.begin();
In the loop function, we took the values from the soil moisture sensor and stored in the variable. The soil moisture sensor will give us values from 0 to 1023, we need to convert these into percentage to measure the moisture. So, we converted the values from 550 to 40 into the 0 to 100. We converted the values from 550 to 0 because 550 is the value that sensor gives us when the soil was dry and when the soil was completely wet, when it gives us value of 40.
output_value= analogRead(sensor_pin); output_value = map(output_value, 550, 40, 0, 100);
After that, we took the reading of the temperature, humidity and heat index from the DHT22 temperature and humidity sensor and stored these in the variable. Then, we showed these line by line on Nokia 5110 LCD.
float hum = temp_hum_sensor.readHumidity(); float temp = temp_hum_sensor.readTemperature(); float fah = temp_hum_sensor.readTemperature(true); lcd.print("Hi: "); lcd.print(heat_index); lcd.println(" *F ");
So that’s it! We have finished our tutorial on building an Arduino weather station project using two sensors (FC-28 soil moisture sensor and the DHT11 humidity/temperature sensor) and the Nokia 5110 LCD display. Do the project yourself and see how it goes!