Weather Station With Device Control Using Touch-Screen Display

- Advertisement -

This weather station provides such information as temperature and humidity at a place on a colourful touch-screen display. It can also control the temperature through the touch-screen user interface when it exceeds the set threshold level. The project can be easily converted to a personal weather station by adding more sensors to measure weather conditions outdoors or indoors.

The digital console provides easy readouts of the data collected by the sensor. The touch-screen has a microSD card memory slot. So, it can be connected to a personal computer where data can be displayed, stored, and uploaded to websites, or used for data ingestion or distribution systems. The author’s prototype is shown in Fig. 1.

Author’s prototype
Fig. 1: Author’s prototype

Components required for this project are mentioned in the Table.

- Advertisement -

Circuit and working

The circuit diagram of weather station with device control is shown in Fig. 2. It comprises Arduino Uno Board1, DHT22 temperature and humidity sensor, BC548 transistor T1, a 5V single changeover relay, light-emitting diode LED1, and resistors R1 and R2. The 6cm TFT touch-screen display to be mounted on top of the Arduino board is shown in Fig. 3.

Circuit diagram
Fig. 2: Circuit diagram
TFT touch-screen display
Fig. 3: TFT touch-screen display

A 9V-12V DC power supply is used to power the Arduino board. The touch-screen, DHT22 sensor, and BC548 device driver sections are powered by the 5V supply from Arduino board.

Arduino Uno

It is the heart of the project. Temperature and humidity data, TFT touch input display, and device control inputs are processed through Arduino programming.

TFT touch-screen

The 6cm TFT touch-screen display TS1 is basically an Arduino shield, which can be mounted on top of the Arduino Uno board. This is one of the advantages of this display because you don’t need any external wires to interface with Arduino.


This temperature and humidity sensor gives more accurate readings as compared to the popular DHT11 sensor. With this sensor, you can easily program to get humidity in %, temperature in °C and °F units. In this project, its output pin is connected to pin 11 of Arduino board.

DHT22 sensor can either be purchased as a sensor or as a module. The sensor comes as a 4-pin package out of which only three pins are used. The module comes as a 3-pin package, as shown in Fig. 4. The module has a filtering capacitor and pull-up resistor inbuilt, but for the sensor you must use them externally, if required. Otherwise, performance of both is same. The sensor is also factory calibrated and hence easy to interface with microcontrollers. It can measure temperature from -40°C to +80°C and humidity from 0% to 100%.

Pin details of DHT22 module
Fig. 4: Pin details of DHT22 module


This popular bipolar NPN transistor is used as driver for switching the electrical appliance connected across the relay module.

Relay module

This is an electromechanical sugar-cube, single-channel relay used to switch on/off the electrical device connected across its COM and NO terminals. You can use readily available single-channel relay module. In that case you can connect digital pin 11 of Arduino to IN pin of relay module. The pin details of relay module are shown in Fig. 5.

Relay module
Fig. 5: Relay module

The working of the circuit is simple. After uploading the code to Arduino Uno board and connecting all the components, as shown in the circuit, switch on the circuit. You will see the main panel on the TFT touch-screen, as shown in Fig. 7. Touch the Device Control option, using stylus or your fingertip, to turn on or turn off the appliance/device such as tube-light or air-conditioner. Otherwise, touch on the Weather Station option to check the current temperature and humidity.


The software (weather_light_control.ino) for this project is written in Arduino programming language. The project requires specific libraries for DHT22 and touch-screen display, such as DHT.h, SPFD5408_Adafruit_GFX.h, SPFD5408_Adafruit_TFTLCD.h and SPFD5408_TouchScreen.h

One of the challenges in the project is calibrating the touch points in the touch-screen display.

Depending on the model and size of the touch-screen display, you need to calibrate x and y coordinates. The calibrated values in the code used by the author are shown in Fig. 6.

The calibrated values for x and y coordinates
Fig. 6: The calibrated values for x and y coordinates

After uploading the code to Arduino Uno board, mount the TFT touch-screen on top of the Arduino board through the header pins already provided on Arduino board. You can carefully place it with a slight push on the touch-screen from top. Ensure the correct positions of the male header pins from touch-screen display are inserted into the corresponding female pins on the Arduino board.

Now you can connect the board to USB port of your PC/laptop or use a 9V-12V DC supply.
As soon as the power is on, the touch-screen display will turn on and you can see the main console panel on the TFT touch-screen, as shown in Fig. 7.

Main console
Fig. 7: Main console

To control the device, such as light or air-conditioner connected across the relay, touch the ‘Device Control’ option. There are on and off buttons in Device Control section, as shown in Fig. 8. When you touch ‘on’ button, the LED will glow and at the same time the electrical device/appliance connected across the relay will turn on. Touch the ‘off’ button to turn it off.

Device on
Fig. 8: Device on

If you touch the ‘Weather Station’ option, it will take you to another screen, as shown in Fig. 9. Here, you can see the current humidity and temperature values captured by the DHT22 sensor. The humidity here is basically the relative humidity expressed in percentage, which represents the amount of water vapour in the air at a given temperature compared with the maximum possible water vapour at that same temperature. Here the temperature values are read in both °C and °F units. So, no conversion is required.

Temperature and humidity readings
Fig. 9: Temperature and humidity readings

Construction and testing

The circuit can be assembled on a breadboard or Veroboard. The author used a 10x3cm size Veroboard to mount the relay, sensor, transistor, LED, 2-pin terminal connector (optional), and the two resistors.

Since most of the Arduino pins are used by the TFT touch-screen display, you need external wires to solder at digital pin 11 of Arduino for the relay driver and analogue pin A5 for the DHT22, as shown in Fig. 10. You also need to solder 5V and GND pins of Arduino for power supply to the Veroboard. If you are using DHT22 sensor instead of the module, make sure you connect a 5-kilo-ohm pull-up resistor at its output pin, otherwise you may not get correct temperature and humidity readings.

Soldered connections
Fig. 10: Soldered connections

Also note that some 6cm TFT touch-screen displays may not work. So, it is recommended to use the model shown in Fig. 3. If you want to control an appliance like cooler or AC, you need to replace the sugar-cube relay with a high-power relay having contact ratings above 16A.

Though you can power the circuit by connecting it to USB port of your PC, you can also power it with external power supply through the DC jack on the Arduino board. The author used a 9V DC power adaptor to power the Arduino board. When power is connected to the circuit you will get the main console screen, as shown in Fig. 7.

Download Source Code


- Advertisement -


Please enter your comment!
Please enter your name here


What's New @

Most Popular DIYs

Electronics Components

Design Guides

Truly Innovative Tech