QT's temperature and humidity display system

Hello everyone, here is Shi Kankan's blog, welcome to discuss

This article introduces the Qt5.6-based application of DHT11 on 2440


The block diagram of the temperature and humidity monitoring system based on the microcontroller system is shown in Figure 2-1.


Figure 2-1 System structure block diagram

The system uses the single-chip microcomputer s3c2440 as the core element of this design. The LCD is used as the display device, and the touch screen is used as the user interface input device. The first line displays the current real-time temperature and humidity, and the second line sequentially displays the highest temperature and humidity at historical moments. The third line is a text box, which records all the temperature and humidity data at the beginning of the program execution.

Secondly, we use QT as the interface GUI development in the design. QT is well-known for its beautiful interface and elegant code. Qt is a cross-platform C++ graphical user interface application development framework developed by QtCompany in 1991 . It can develop GUI programs as well as non-GUI programs, such as console tools and servers. Qt is an object-oriented framework that uses special code generation extensions and some macros. Qt is easy to extend and allows real component programming.


 

Figure 2-2 Interface function diagram

Real-time display function

In terms of design, the principle of driver and application layering is implemented. After DHT11 is loaded and DHT11 devices have been registered, GUI APP design is carried out.

In the app design, the interface refresh speed of 100ms is achieved by calling the timer. After reading the device information, the current temperature and humidity parameters are displayed on the first line of the GUI interface.

Historical highest value setting

On the basis of real-time monitoring of the current temperature and humidity, the last temperature and humidity data are recorded and compared to update the highest value data to the user interface.

View historical data

   The temperature and humidity data received by the system every time are stored in the text box for users to view, and the data can be transmitted to the computer through the FTP service.

Working process of temperature and humidity monitoring system

The working process of the entire temperature and humidity monitoring system is as follows: the board is powered on and executes BootLoader first, initializes RAM, serial port, detects processor type, and calls Linux kernel image.

Start the kernel, create the exception vector table and initialize the interrupt handling function, initialize the system core process scheduler and clock interrupt handling mechanism; initialize the serial-console; ARM-Linux generally initializes a serial port as the kernel during the initialization process Console, so that the kernel can output information through the serial port during the startup process so that developers or users can understand the startup process of the system. Create and initialize system cache to provide cache for various memory calling mechanisms, including; dynamic memory allocation, virtual file system (VirtualFile System) and page cache. Initialize memory management, detect memory size and memory occupied by the kernel; initialize the system's inter-process communication mechanism (IPC).

Start the file system, the file system starts the QT application, and runs test.

This is the user can observe the current and historical temperature and humidity data through the interface, and view the historical information by sliding the scroll bar on the touch screen. The power-off procedure ends.

According to the above description, first carry out the idea of ​​the main program flowchart:

The main program design flowchart is shown in Figure 4-2:

                                                             

Figure 4-2 Main program design flow chart

    First, we design the system software. The figure above is the main program flow chart design, the system is initialized, then the sensor data is read, the data is processed accordingly, and the highest value in history is obtained. The data is saved, and then the timing processing is performed. The last is display processing, the interface is refreshed every 0.1S. It is a cyclic process from reading data to display processing. After the display processing is judged, the reading function processing is repeated back and forth.
Resource link: https://download.csdn.net/download/zxpcus/10280117

Guess you like

Origin blog.csdn.net/zxpcus/article/details/79514948