Weather Station based on TFT LCD and Arduino

Works done? Proud of it? Show off here! Let's see what you've built can help inspire others.

Weather Station based on TFT LCD and Arduino

Postby Mars » Tue Jun 22, 2021 1:25 pm


A weather station is a facility, either on land or sea, with instruments and equipment for measuring atmospheric conditions to provide information for weather forecasts and to study the weather and climate. But here we are going to build, which will detect the atmospheric temperature and humidity.
In this project we will use a DHT-11 sensor which has the capability to detect both things temperature and humidity, then this information we will send to the STONE-HMI display with the help of Arduino, so let’s start.First will design the GUI part then go for the circuit part let’s jump to the GUI design.

GUI Design

For this project we are using a TFT display, this display has a software that is a GUI software with this help we are going to design an interface which will contain a designed image that will display the temperature and humidity.
For the GUI design first, you have to design an image on which you are going to display temperature & humidity. Here our design is this if you want you can design any other whatever you want.

But remember one thing that image which are you going to edit should be in the same resolution as your screen resolution, here we are using a 5’’ display so the resolution of this is [800X480] so we have selected for this at the time of new project selection.

This is the GUI for adding a good image



In this circuit there are two things which is connected with Arduino first is display and another one is sensor which sending the data to the Arduino then Arduino sending the data to display using software-serial library.

Let’s see how DHT-11 sensor is working:

The DHT11 is a commonly used Temperature and humidity sensor. The sensor comes with a dedicated NTC to measure temperature and an 8-bit microcontroller to output the values of temperature and humidity as serial data. The sensor is also factory calibrated and hence easy to interface with other microcontrollers.
This DHT11 sensor can measure temperature from 0°C to 50°C and humidity from 20% to 90% with an accuracy of ±1°C and ±1%. So as you saw this temperature gives us accurate value so these are the reasons we have used this sensor in this project.
The DHT11 Sensor is factory calibrated and outputs serial data and hence it is highly easy to set it up. The connection diagram for this sensor is shown below.This is same connection as we have given above in the circuit.
As you can see the data pin is connected to an I/O pin of the MCU . This data pin outputs the value of both temperature and humidity as serial data and this data we are sending using serial library but for this sensor output we also required a DHT11 library so first we have added in our code we will discuss about this in code section.
The output given out by the data pin will be in the order of 8bit humidity integer data + 8bit the Humidity decimal data +8 bit temperature integer data + 8bit fractional temperature data +8 bit parity bit. To request the DHT11 module to send these data the I/O pin has to be momentarily made low and then held high as shown in the timing diagram below.

Arduino Code:
#include "DHT.h"
#define DHTPIN 6     // Digital pin connected to the DHT sensor
#define DHTTYPE DHT11   // DHT 11

#include <SoftwareSerial.h>
SoftwareSerial screenserial(2, 3); // RX, TX

#define hd 0x86
#define td 0x96
unsigned char h_send[8]= {0xA5, 0x5A, 0x05, 0x82, 0x00, hd, 0x00, 0x00};
unsigned char t_send[8]= {0xA5, 0x5A, 0x05, 0x82, 0x00, td, 0x00, 0x00};

void setup()
  Serial.println(F("DHTxx test!"));
void loop()
  // Wait a few seconds between measurements.
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  int h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  int t = dht.readTemperature();

  // Check if any reads failed and exit early (to try again).
 if (isnan(h) || isnan(t))
    Serial.println(F("Failed to read from DHT sensor!"));
  Serial.print(F(" Humidity: "));
  Serial.print(F("%  Temperature: "));
  Serial.println(F("C "));



As we have discussed we are using software-serial library to transfer the key value over a address,for this we have added <SoftwareSerial.h> in this code, this is giving a interface to connection with Arduino and STON-HMI display and for the purpose of sensor we have added a library #include "DHT.h" this library giving the both temperature and humidity value as we have discussed in the timing diagram.
For humidity here we have defined the address as ‘0x86’ over this address we are sending 8-bit data as you can see in the last of the code similarly we have defined for temperature and done the same thing ,remember both code and in the display part address should be same other wise it will not work.
Posts: 28
Joined: Tue Jun 22, 2021 11:10 am

Return to Project Showcase

Who is online

Users browsing this forum: No registered users and 4 guests