ESP32 Weather Station based on HMI

Hayden
Posts: 16
Joined: Thu Jul 01, 2021 8:10 am

ESP32 Weather Station based on HMI

Postby Hayden » Thu Jul 01, 2021 9:07 am

In the application of this paper, I will use the Stone tft lcd screen, ESP32 microprocessor, photosensitive resistance sensor and DHT11 temperature and humidity sensor to realize the real-time monitoring of the surrounding environment, and push the collected data to the TFT LCD screen for display. The communication mode of ESP32 and Stone tft lcd adopts serial port communication.
Image
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

Temperature and humidity sensor

The DHT11 temperature sensor I use can monitor the temperature and humidity of the surrounding environment. The working voltage is 3.3V ~ 5V, and the signal output form is a digital output. It is suitable for this project, but it is difficult to develop.

Image

Photosensitive sensor

This time, the sensitive photosensitive resistance sensor is used, and the comparator output is used. The signal is clean, the waveform is good, and the driving capacity is more than 15mA. The same working voltage is 3.3V and 5V. There are analog signal output and digital signal output respectively. It is very convenient to develop. When the ambient light brightness can not reach the set threshold, the do terminal outputs a high level, and when the ambient light brightness exceeds the set threshold value Do output a low level.

Image

ESP32

Esp32 is a general-purpose wifi-bt-BLE MCU module with powerful functions and wide applications. It can be used in low-power sensor networks and demanding tasks, such as voice coding, audio streaming, and MP3 decoding. It also integrates a wealth of peripherals, including a capacitive touch sensor, Hall sensor, low noise sensor amplifier, SD card interface, Ethernet-interface, high-speed SDIO / SPI, UART, I2S, and I2C. It can achieve a maximum range of wireless communication. It has the best performance in high integration, wireless transmission distance, power consumption, and network connectivity.

Image

STVC101WT-01

STVC101WT-01 module communicates with MCU through the serial port, which needs to be used in this project. We only need to add the designed UI picture through the upper computer through the menu bar options to buttons, text boxes, background pictures, and page logic, then generate the configuration file, and finally download it to the display screen to run.

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;
Connection

Image

The result

Image
Image

Who is online

Users browsing this forum: No registered users and 27 guests