Microclimate information acquisition system based on STM32 microcontroller
Through the microclimate information acquisition system based on the STM32 microcontroller, combined with a low-power wireless sensing network and a cloud computing platform, the data analysis is solved by using the BILSTM-CNN-Attention model, and the high cost and low cost of the existing microclimate monitoring system is solved. Accuracy issues achieve efficient and easy-to-deploy microclimate information collection and analysis, supporting scientific decision-making in agricultural production.
Patent Information
- Application Number
- CN202411083445.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2024-11-08
AI Technical Summary
Existing microclimate monitoring systems rely on high-cost equipment, are difficult to apply in small-scale and difficult-to-reach areas, and have shortcomings in real-time data transmission and high-precision analysis, so they cannot effectively monitor and manage microclimate changes in specific areas.
Adopt a microclimate information acquisition system based on STM32 microcontroller, integrating low-power wireless sensing network technology and cloud computing platform, collecting and analyzing microclimate data in real time through data acquisition, analysis and storage units, and through 4G communication module and RS485 The module realizes data transmission and combines the BILSTM-CNN-Attention deep learning model for data analysis.
It realizes a cost-effective and easy-to-deploy microclimate information acquisition system, which can realize high-precision data analysis and real-time monitoring, and provides scientific basis to adjust planting strategies for agricultural production and optimize yield and quality.
Smart Images

Figure CN118915581A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of environmental monitoring, and more specifically, particularly relates to a microclimate information acquisition system based on an STM32 microcontroller. Background Art
[0002] At present, agricultural production activities involve the planting of grain, cotton, oil, hemp, silk, tea, sugar, vegetables, tobacco, fruit trees, medicinal materials and other cash crops, which have strict requirements on environmental conditions. As the impact of climate change on agricultural production becomes increasingly significant, it is particularly important to carefully monitor microclimate changes in specific areas. The microclimate information collection system, as a small automatic meteorological information collection station designed for agricultural ecological environment monitoring, integrates multiple sensors such as temperature and humidity, light, photosynthesis, rainfall, wind speed and wind direction. This system can effectively prevent crop growth problems such as "oranges in the south and citrons in the north" caused by environmental inadaptability, and adjust planting strategies in time to meet the crop's environmental needs and optimize yield and quality.
[0003] However, existing microclimate monitoring systems often rely on large, high-cost equipment, and are limited in their application to small and hard-to-reach areas. They also have shortcomings in real-time data transmission and high-precision analysis. In addition, the system is not only suitable for agriculture, but can also be used in meteorological research in fields such as forestry and the environment. Therefore, it is particularly urgent to develop a microclimate information collection system that is cost-effective, easy to deploy, and capable of high-precision data analysis. This will greatly promote the real-time monitoring and precise management of climate conditions in small areas, and provide a scientific basis for agricultural production under global climate change. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a microclimate information acquisition system based on an STM32 microcontroller, which integrates low-power wireless sensor network technology and a cloud computing platform, and can collect and analyze microclimate data in real time and accurately to solve the problems raised in the above background technology.
[0005] To achieve the above objectives, the present invention is implemented through the following technical solutions: A microclimate information acquisition system based on an STM32 microcontroller, comprising a power supply unit, a data acquisition unit, a data analysis unit and a data storage unit, wherein the power supply unit is electrically connected to the data acquisition unit, the data analysis unit and the data storage unit, and is used for continuous operation of the equipment. The data storage unit is used to store air data, temperature data, humidity data, wind direction data, wind speed data, light data, and rainfall data; The data analysis unit is used to pre-process, clean and analyze air data, temperature data, humidity data, wind direction data, wind speed data, light data and rainfall data; The data acquisition unit is communicatively connected to the cloud server, the data acquisition unit is electrically connected to the data analysis unit, the data analysis unit is electrically connected to the data storage unit, the power supply unit adopts a lithium battery power supply system, and a control unit is arranged outside the data acquisition unit, the data analysis unit and the data storage unit. The control unit controls the data acquisition unit, the data analysis unit and the data storage unit to collect, analyze, compare and store the air, temperature, humidity, light, rainfall, wind speed and wind direction of the agricultural ecological environment, and formulates a corresponding agricultural production plan according to the comparison results. The control unit performs core processing based on the STM32 microcontroller, and one end of the cloud server is communicatively connected to the visualization front end, and the collected environmental data is remotely controlled and analyzed through the visualization front end.
[0006] As an optional solution of the present invention, the visualization front end provides a Web data acquisition and detection system front-end platform based on ruoyi development, and users can view environmental data and analysis results in real time.
[0007] As an optional solution of the present invention, the data acquisition unit is internally integrated with an acquisition module, and the acquisition module is used to collect air data, humidity data, temperature data, light data, rainfall data, wind speed data and wind direction data in the agricultural ecological environment; one end of the acquisition module is electrically connected to a communication module, and the communication module is communicatively connected to a cloud server, and is used to transmit the air data, temperature data, humidity data, wind direction data, wind speed data, light data, and rainfall data to the cloud server for data backup.
[0008] As an optional solution of the present invention, the communication module adopts a 4G communication module, the 4G communication module is electrically connected to an RS485 module, the 4G communication module realizes data transmission through the RS485 module, and the communication protocol adopts the Modbus protocol; the maximum operating voltage of the 4G communication module is set to 3.3V, and the maximum operating current of the 4G communication module is set to 72mA.
[0009] As an optional solution of the present invention, 16 RS485 communication data acquisition interfaces are set on the communication module to communicate with the RS485 modules respectively. However, only 13 communication data acquisition interfaces are used in the present system, and the remaining ones are used as backup for adding sensor types in the future. RS485 is a shared bus structure. Each interface can be connected to one or more devices through a connecting cable, and has the function of automatically selecting communication technology. It can automatically switch between BLE technology and 4G communication technology according to signal strength and data transmission rate to ensure the continuity and stability of data transmission.
[0010] As an optional solution of the present invention, the acquisition module is integrated with multiple environmental sensors, including but not limited to temperature and humidity sensors, atmospheric pressure sensors, soil temperature and humidity sensors, wind speed sensors, wind direction sensors, total radiation sensors, radiation hours sensors, carbon dioxide sensors, ozone sensors, soil pH sensors, soil salt sensors and rainfall sensors, and the baud rates are all set to 9600 bit / s.
[0011] As an optional solution of the present invention, the control unit performs core processing based on an STM32 microcontroller, has a Modbus communication protocol function, can communicate with each sensor and collect data, and the microcontroller includes a built-in data cache function for temporarily storing data received from the sensor. Specifically, an STM32F407 chip is used, and the specific model is STM32F407ZGT6. The STM32F407ZGT6 chip is internally provided with 1MB of built-in flash, and the running memory of the STM32F407ZGT6 chip is set to 192KB+4KB.
[0012] As an optional solution of the present invention, the cloud server uses a BILSTM-CNN-Attention deep learning model to analyze and process the received microclimate data. The model can identify time series features in the data and perform trend prediction. The output data analysis results include but are not limited to temperature changes, humidity change trends, wind speed change predictions, and light intensity distribution predictions.
[0013] The present invention provides a microclimate information acquisition system based on an STM32 microcontroller, which has the following beneficial effects: 1. Modular design: The whole system adopts modular design. Users can choose different sensors and communication modules according to their needs, which is easy to expand and customize.
[0014] 2. RS485 communication system: RS485 optimized design, and hardware circuit design optimized for environmental monitoring; this design takes into account energy efficiency and communication efficiency, and is suitable for environmental monitoring in remote and difficult-to-reach areas; the number of devices on the RS485 line is optimized to be affected by the cable type and baud rate.
[0015] 3. AI data processing: The BILSTM-CNN-Attention model was applied to the analysis of microclimate information for the first time, which improved the accuracy and prediction ability of data processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a structural block diagram of the system of the present invention; Figure 2 It is a detailed structural distribution diagram of the system of the present invention; Figure 3 It is a structural block diagram of the data acquisition unit of the present invention; Figure 4 This is a step diagram of the BILSTM-CNN-Attention model used in the present invention; Figure 5 This is a layout diagram of the BILSTM-CNN-Attention model used in the present invention; Figure 6 This is a structural diagram of the BILSTM-CNN-Attention model used in the present invention; Figure 7 This is a detailed structural distribution diagram of the BILSTM-CNN-Attention model used in the present invention; Figure 8 This is a comparison chart of the test set data of the BILSTM-CNN-Attention model used in the present invention; Fig. 9 This is the test set data error diagram of the BILSTM-CNN-Attention model used in the present invention; Fig.10 This is a circuit structure diagram of the 4G module of the present invention; Fig.11 It is a circuit structure diagram of RS485 module of the present invention. DETAILED DESCRIPTION
[0017] The following embodiments of the present invention are described in further detail in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0018] In the description of the present invention, unless otherwise specified, "plurality" means two or more than two; the orientations or positional relationships indicated by the terms "upper", "lower", "left", "right", "inner", "outer", "front end", "rear end", "head", "tail", etc. are based on the orientations or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", "third", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0019] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "connected" and "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0020] See also Figures 1 to 9 The present invention provides a technical solution: a microclimate information acquisition system based on an STM32 microcontroller, comprising a power supply unit, a data acquisition unit, a data analysis unit and a data storage unit, wherein the power supply unit is electrically connected to the data acquisition unit, the data analysis unit and the data storage unit, and is used for continuous operation of the equipment, the data acquisition unit is communicatively connected to a cloud server, the data acquisition unit is electrically connected to a data analysis unit, the data analysis unit is electrically connected to a data storage unit, the power supply unit adopts a lithium battery power supply system, which is safe and stable, and a control unit is arranged outside the data acquisition unit, the data analysis unit and the data storage unit, and the data acquisition unit, the data analysis unit and the data storage unit are controlled by the control unit to collect, analyze, compare and store the air, temperature, humidity, light, rainfall, wind speed and wind direction of the agricultural ecological environment, and a corresponding agricultural production plan is formulated according to the comparison results, one end of the cloud server is communicatively connected to a visualization front end, and the collected environmental data is remotely controlled and analyzed through the visualization front end, and the visualization front end provides a front-end platform of a Web data acquisition and detection system developed based on ruoyi, and users can view environmental data and analysis results in real time; like Figure 1-3 The data acquisition unit is internally integrated with an acquisition module, which is used to collect air data, humidity data, temperature data, light data, rainfall data, wind speed data and wind direction data in the agricultural ecological environment; one end of the acquisition module is electrically connected to the communication module, and the communication module is connected to the cloud server for communication, and is used to transmit air data, temperature data, humidity data, wind direction data, wind speed data, light data and rainfall data to the cloud server for data backup; the communication module adopts a 4G communication module, and the 4G communication module is electrically connected to an RS485 module. The 4G communication module realizes data transmission through the RS485 module, and the communication protocol adopts the Modbus protocol; the maximum operating voltage of the 4G communication module is set to 3.3V, and the maximum operating current of the 4G communication module is set to 72mA. Figure 10-11 As shown, the circuit structure diagram of the 4G module and the circuit structure diagram of the RS485 module can be clearly displayed; There are 16 RS485 communication data acquisition interfaces on the communication module to communicate with the RS485 modules respectively. However, only 13 communication data acquisition interfaces are used in this system, and the remaining ones are used as backup for adding sensor types in the future. RS485 is a shared bus structure. Each interface can be connected to one or more devices through a connecting cable, and has the function of automatically selecting communication technology. It can automatically switch between BLE technology and 4G communication technology according to signal strength and data transmission rate to ensure the continuity and stability of data transmission.
[0021] like Figure 1-3 The acquisition module integrates multiple environmental sensors, including but not limited to temperature and humidity sensors, atmospheric pressure sensors, soil temperature and humidity sensors, wind speed sensors, wind direction sensors, total radiation sensors, radiation hours sensors, carbon dioxide sensors, ozone sensors, soil pH sensors, soil salt sensors and rainfall sensors, and the baud rate is set to 9600 bit / s; the following is the data information of all its sensors: A data storage unit, the data storage unit is used to store air data, temperature data, humidity data, wind direction data, wind speed data, light data, and rainfall data; A data analysis unit, the data analysis unit is used to pre-process, clean and analyze air data, temperature data, humidity data, wind direction data, wind speed data, light data and rainfall data; The data analysis unit is used to pre-process, clean and analyze air data, temperature data, humidity data, wind direction data, wind speed data, light data and rainfall data, which specifically includes the following steps: 1. Classify and process air data, temperature data, humidity data, wind direction data, wind speed data, light data and rainfall data according to the collection time to obtain a data collection with time information; 2. Perform screening based on the data collection with time information to determine the time information corresponding to the missing data; 3. Access the cloud server based on the time information corresponding to the missing data to obtain specific data; 4. Modify the data collection with time information according to the specific data to obtain a complete data collection; 5. Perform data cleaning based on the complete data collection to obtain the reference data collection; 6. Analyze and process the reference data collection to determine the agricultural production plan.
[0022] Those skilled in the art will appreciate that environmental data of areas where agricultural production is required are collected through various sensors, the environmental data are analyzed, a variety of crops that can adapt to the environment are determined, trial production is carried out on the various crops, the yields of the trial production are analyzed, and the crops to be ultimately produced are determined.
[0023] The control unit is based on the STM32 microcontroller for core processing and has Modbus communication protocol function. It can communicate with various sensors and collect data. At the same time, the microcontroller includes a built-in data cache function for temporarily storing data received from the sensor. It specifically adopts the STM32F407 chip, the specific model is STM32F407ZGT6, and the STM32F407ZGT6 chip is equipped with 1MB of built-in flash. The running memory of the STM32F407ZGT6 chip is set to 192KB+4KB.
[0024] The STM32F407 has a wealth of communication interfaces, such as SPI, I2C, UART, etc.; it supports up to 3 12-bit ADC converters, 2 DAC converters, and high-resolution timers; the STM32F407 is widely used in various intelligent scenarios, including Internet of Things (IoT) devices; the low power consumption characteristics of the STM32F407 make it suitable as the core processing unit of IoT devices such as sensors and controllers.
[0025] like Figure 4-9 ,The cloud server uses the BILSTM-CNN-Attention deep learning model to analyze and process the received microclimate data. ,This model can identify the time series features in the data and make trend predictions. ,The output data analysis results include but are not limited to temperature changes, humidity change trends, wind speed change predictions, and light intensity distribution predictions.
[0026] The BILSTM-CNN-Attention model was used to model environmental data, and a parallel model comparison experiment was conducted to verify the prediction accuracy and technical superiority of the model. The innovation of this model lies in the integrated use of three technologies, which fully utilizes their respective advantages and improves the efficiency and accuracy of environmental data processing. The environmental data is formatted to adapt to the input requirements of the deep learning model; the composite model is trained using historical environmental data to optimize model parameters; the application of this model may also include real-time data processing and prediction. The system can receive new environmental data in real time, quickly process and update prediction results, and provide timely data support and decision-making assistance for environmental monitoring. The core value of this technology is to improve the accuracy and effectiveness of environmental monitoring, especially in situations where rapid response and processing of complex data are required.
[0027] Specific usage and function of this embodiment: After entering the system login interface through the visual front end, the personnel can observe the data collected by each sensor. If data is missing within a certain time period, the backup data of the time period is read from the cloud server. If the backup data is also missing, the corresponding sensor is repaired. After the repair, the subsequent collected data is monitored. If the data is no longer missing, it is determined that the fault has been eliminated. If the data continues to be missing, the data storage module is repaired.
[0028] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0029] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A microclimate information acquisition system based on STM32 microcontroller, characterized in that: It includes a power supply unit, a data acquisition unit, a data analysis unit and a data storage unit. The power supply unit is electrically connected to the data acquisition unit, the data analysis unit and the data storage unit for continuous operation of the device. The data storage unit is used to store air data, temperature data, humidity data, wind direction data, wind speed data, light data, and rainfall data; The data analysis unit is used to pre-process, clean and analyze air data, temperature data, humidity data, wind direction data, wind speed data, light data and rainfall data; The data acquisition unit is communicatively connected to the cloud server, the data acquisition unit is electrically connected to the data analysis unit, the data analysis unit is electrically connected to the data storage unit, the power supply unit adopts a lithium battery power supply system, and a control unit is arranged outside the data acquisition unit, the data analysis unit and the data storage unit. The control unit controls the data acquisition unit, the data analysis unit and the data storage unit to collect, analyze, compare and store the air, temperature, humidity, light, rainfall, wind speed and wind direction of the agricultural ecological environment, and formulates a corresponding agricultural production plan according to the comparison results. The control unit performs core processing based on the STM32 microcontroller, and one end of the cloud server is communicatively connected to the visualization front end, and the collected environmental data is remotely controlled and analyzed through the visualization front end.
2. A microclimate information acquisition system based on STM32 microcontroller according to claim 1, characterized in that: The visualization front end provides a Web data acquisition and detection system front-end platform based on ruoyi development, and users can view environmental data and analysis results in real time.
3. A microclimate information acquisition system based on STM32 microcontroller according to claim 1, characterized in that: The data acquisition unit has an integrated acquisition module inside, and the acquisition module is used to collect air data, humidity data, temperature data, light data, rainfall data, wind speed data and wind direction data in the agricultural ecological environment; one end of the acquisition module is electrically connected to the communication module, and the communication module is communicatively connected to the cloud server, and is used to transmit the air data, temperature data, humidity data, wind direction data, wind speed data, light data, and rainfall data to the cloud server for data backup.
4. A microclimate information acquisition system based on STM32 microcontroller according to claim 3, characterized in that: The communication module adopts a 4G communication module, the 4G communication module is electrically connected to an RS485 module, the 4G communication module realizes data transmission through the RS485 module, and the communication protocol adopts the Modbus protocol; the maximum operating voltage of the 4G communication module is set to 3.3V, and the maximum operating current of the 4G communication module is set to 72mA.
5. A microclimate information acquisition system based on STM32 microcontroller according to claim 4, characterized in that: The communication module is provided with 16 RS485 communication data acquisition interfaces, which communicate with the RS485 modules respectively. However, only 13 communication data acquisition interfaces are used in the present system, and the rest are used as backup for adding sensor types in the future. RS485 is a shared bus structure. Each interface can be connected to one or more devices through a connecting cable, and has the function of automatically selecting communication technology. It can automatically switch between BLE technology and 4G communication technology according to signal strength and data transmission rate to ensure the continuity and stability of data transmission.
6. A microclimate information acquisition system based on STM32 microcontroller according to claim 3, characterized in that: The acquisition module integrates multiple environmental sensors, including but not limited to temperature and humidity sensors, atmospheric pressure sensors, soil temperature and humidity sensors, wind speed sensors, wind direction sensors, total radiation sensors, radiation hours sensors, carbon dioxide sensors, ozone sensors, soil pH sensors, soil salt sensors and rainfall sensors, and the baud rate is set to 9600 bit / s.
7. A microclimate information acquisition system based on STM32 microcontroller according to claim 1, characterized in that: The control unit performs core processing based on an STM32 microcontroller, has a Modbus communication protocol function, can communicate with each sensor and collect data, and the microcontroller includes a built-in data cache function for temporarily storing data received from the sensor. The STM32F407 chip is specifically adopted, and the specific model is STM32F407ZGT6. The STM32F407ZGT6 chip is internally provided with a 1MB built-in flash, and the running memory of the STM32F407ZGT6 chip is set to 192KB+4KB.
8. The microclimate information acquisition system based on STM32 microcontroller according to claim 1, characterized in that: The cloud server uses the BILSTM-CNN-Attention deep learning model to analyze and process the received microclimate data. The model can identify the time series characteristics in the data and perform trend prediction. The output data analysis results include but are not limited to temperature changes, humidity change trends, wind speed change predictions, and light intensity distribution predictions.
