ESP32 Weather Station based on HMI

Moderator: Mattk

Post Reply
Efrain Kenson
Fresh Boarder
Fresh Boarder
Posts: 6
Joined: Thu Jul 29, 2021 10:03 am

ESP32 Weather Station based on HMI

Post by Efrain Kenson »

Brief introduction

This application function is divided into three parts: temperature monitoring, humidity monitoring, and light monitoring. After startup, there will be a boot interface first. After a moment, you will enter the main function interface. In this interface, we can select the monitoring items, such as temperature, humidity, and illumination. There will be a text box under the temperature monitoring interface to display the temperature data transmitted from esp32, a "start" button, and a "stop" button to start and stop the temperature monitoring. If you want to exit the interface, you can select the "return" button; the second item is humidity monitoring, and there is also a text box under this interface for displaying esp 32. For the humidity data transmitted, the "start" and "stop" buttons are used to start and stop monitoring, and a return button is used to exit the current interface. The third item is light intensity monitoring. Different from the previous two functions, counting is used here, and one is added every time there is light.

Related devices

1. DHT11 * 1;

2. Photosensitive resistance sensor * 1;

3. DuPont line * 8;

4. Esp32 module * 1;

5. STONE TFT LCD screen * 1.

Information interaction between STONE HMI and esp32

1. The serial port screen of STONE HMI realizes the function of the button switching interface;

2. STONE HMI serial port screen can automatically jump to the main interface after startup;

3. The serial port screen of STONE HMI realizes variable display function;

4. The serial port screen of STONE HMI realizes data variable distribution;

Esp32 peripheral control

1. Esp32 realizes the data acquisition and analysis of photosensitive resistance sensor;

2. Esp32 realizes the data adoption and analysis of DHT11 temperature and humidity sensor;

3. Esp32 can upload valid data to the TFT LCD screen.

Brief schematic diagram of the project

Image

GUI design

Image

Code

Code: Select all

if(Serial.available() != 0)

  {

    for(cout_i = 0; cout_i < 9; cout_i ++)

    {

        RecievedTemp[cout_i] = Serial.read();

    }

    switch(RecievedTemp[5])

    {

    case 0x0D://Temperature start

        TemperatureBool = true;

        break;

    case 0x0E://Temperature stop

        TemperatureBool = false;

        TemperatureOutput[6] = 0;

        TemperatureOutput[7] = 0;

        Serial.write(TemperatureOutput, 8);

        break;

    case 0x0F://Temperature back

        TemperatureBool = false;

        break;

    case 0x11://Humidity start

      HumidityBool = true;

        break;

    case 0x12://Humidity stop

        HumidityBool = false;

        HumidityValue = 0;

        HumidityOutput[7] = HumidityValue;

        Serial.write(HumidityOutput, 8);

        break;

    case 0x10://Humidity back

        HumidityBool = false;

        break;

    case 0x14://illumination start

      illuminationBool = true;

      illuminationState = false;

        break;
The result

Image
Post Reply