|
1.INTRODUCTIONSmart agriculture is an advanced stage of modern agricultural development, integrating advanced technologies such as the Internet of Things, big data, and artificial intelligence to achieve intelligent, refined, efficient, and green agricultural production. Currently, smart agriculture has received widespread attention and development worldwide. Internet of Things technology is widely used in smart agriculture, collecting soil moisture, temperature, lighting and other data through sensors to achieve real-time monitoring and remote control of farmland. In the process of collecting and controlling crop growth information, wireless communication technology plays an important role in agricultural information collection. Due to the complexity and diversity of agricultural production environments, traditional wired communication methods often fail to meet practical needs, while wireless communication technology can overcome these limitations and achieve flexible and efficient information collection and transmission. This article aims to study the use of short distance wireless communication technology ZigBee for perception layer networking, construction of multi node data acquisition and actuator control in smart agriculture systems, using industrial standard RS485 interface sensors, and analyzing the specific application of MQTT communication protocol used for data uplink and downlink. In the process of constructing a crop growth information collection system, solving the solar power supply problem of sensors is necessary to ensure the stable operation of the constructed system. The system gateway adopts an embedded microcontroller STM32 to ensure the RAM and ROM of the system operation, complete the conversion of custom communication protocols and Base64 encoding. The access of the network layer is implemented using DTU, and the subscription and publication topics of the MQTT protocol are configured on the DTU to ensure fast information collection and efficient control of the system. The application layer uses Web for data display, the front-end is implemented using Vue+element UI, and the server is implemented using Spring Boot+MyBatis. An MQTT server is built, and the data is stored in MySQL. 2.RESEARCH STATUSThe existing agricultural systems have a variety of sensors for data collection, but have not achieved industrial standard interfaces. The data collection for multiple nodes lacks a good system architecture and cannot complete the networking of multiple nodes. Even if wireless communication technology is used, the connection between wireless communication and wired communication is not discussed. The communication protocol used for data uplink and downlink is not mentioned. Based on the characteristics of agricultural data collection, it is necessary to design a power supply system to meet the problem of large-scale data collection. In response to the above issues, based on the rapidly developing Internet of Things technology, a three-layer Internet of Things framework was adopted to construct a smart agriculture system [1][2], which solved the system’s architecture problems. For the uplink and downlink of data, customized data communication protocols and heartbeat packets are used. The gateway completes the conversion of communication protocols, the DTU completes network layer access, and the MQTT protocol is used to upload data and control actuators [3], solving network layer access problems. The system has been designed to provide power, solving the power supply problem for large-scale data collection. 3.SYSTEM DESIGNThe smart agriculture system is suitable for adopting a three-layer Internet of Things architecture: perception layer, network layer, and application layer. The perception layer should adopt wireless communication technology to compensate for the shortcomings of wired communication and also adapt to the scene of crop planting sites. Common wireless communication technologies include ZigBee et al. [4][5], which are suitable for different agricultural information collection scenarios. If the system needs to use a low-power design, it is suitable to use wireless communication technology ZigBee for perception layer networking [6]. The communication distance of ZigBee, a short-distance wireless communication technology, is within 20 meters. The access of the Internet of Things network layer is achieved by selecting wireless terminal DTUs for data access to wired networks. The application layer of the Internet of Things can use web technology to display measured data, and the database selection is MySQL database. The three-layer architecture diagram of the system is shown in Figure 1. 3.1Perception layer designThe selection of sensors in the perception layer of the Internet of Things, the use of network layer communication protocols, and so on, all affect the performance of the system, as well as the power supply of the system, which is also a decisive factor in the system. 3.1.1Selection of sensorsVarious sensors using RS485 interface can measure the temperature, humidity, carbon dioxide concentration of crop growth environment, as well as soil temperature, humidity, conductivity, and pH value. The RS485 interface is an industrial standard interface, with reliable and stable connections and standardized usage. The RS485 interface sensor has an address, which can control the working mode of the sensor and read the measurement data of the sensor based on the address. The sensor with RS485 interface has a wide working voltage range, ranging from DC 5V to DC 24V, making system implementation easier. 3.1.2Perception layer networkingPerception layer networking, using short range wireless communication technology ZigBee, and using Ti’s CC2530 as the core control device; Based on the ZigBee wireless communication technology of CC2530, combined with the simulation operating system OSAL provided by Ti company, the self-organizing network can be completed by configuring Pan ID and channel, and power on. In OSAL, business logic processing is based on events, ensuring the stability and robustness of the system. 3.2GatewayThe gateway of the Internet of Things has the responsibility of communication protocol conversion [7], so it has requirements for the frequency, RAM, and ROM of the core chip. The system uses STM3f103C8T6 and has four UART interfaces, which meet the system’s functional requirements. At the same time, it can run an embedded operating system to complete communication protocol conversion in the operating system. Run the HTTP protocol on the gateway to upload data, run the MQTT protocol on the client to subscribe to application layer messages, and achieve data downlink. After the perception layer is networked, the data is aggregated to the coordinator, who sends the data to the gateway STM3f103C8T6 through a serial port. Base64 encoding was applied to the data, and the serial port of the gateway’s STM3f103C8T6 was converted to an RS485 interface, which was then connected to the DTU. 3.3Network layer accessThe selection of network layer access is achieved using DTU (Data Transmission Unit). There are many mature DTUs on the market, which can be configured to shorten project development time. DTUs can run HTTP and MQTT protocols, fully meeting system requirements. By connecting to the DTU morning gateway, data can be directly uploaded or received. Channel 1 of DTU is configured to work with the HTTP protocol: data is uploaded using the Get method, and the IP address is: http://101.42.12.228 The port number is 8098 and the URL is “/system/jkxx/API/receive? Payload=”. Channel 2 of DTU is configured to work with MQTT protocol: IP address is 101.42.12.228; Port number: 1883, username: admin; Password: dnui1234; Subscription topic: sub; Publication topic: pub; Service quality level QOS: 0; Channel 3 of DTU is configured in HTTP protocol debugging mode: IP address is 112.125.89.8; The port number needs to be configured and the website used for testing https://netlab.luatos.com/ The port numbers are consistent The system uses DTU, which meets the requirements of long-distance, stable, and secure agricultural data transmission scenarios. DTU can ensure the real-time and accuracy of data. 3.4System power supplyThe selection of network layer access is achieved using DTU (Data Transmission Unit). There are many mature DTUs on the market, which can be configured to shorten project development time. DTUs can run HTTP and MQTT protocols, fully meeting system requirements. By connecting to the DTU morning gateway, data can be directly uploaded or received. The system uses DTU, which meets the requirements of long-distance, stable, and secure agricultural data transmission scenarios. DTU can ensure the real-time and accuracy of data. 3.5Image acquisitionTo collect images of crop growth, a camera with RS485 interface can be used [8]. The camera can be directly connected to the DTU and programmed under QT to collect images. The collected images are directly stored on the server and can be called on the web and app ends. 3.6Actuator controlThe actuators of the system include fill lights, fans, sprinkler irrigation devices, roller shutter doors, etc. The MQTT protocol is used for subscription and publication in the system software to control the perception layer controller, and relays are used to control each actuator in the hardware. 4.SYSTEM IMPLEMENTATION4.1Hardware implementationThe system adopts TI’s CC2530 as the core control device, and uses SmartRF04EB simulator for simulation debugging and program download. The composition of the circuit board is shown in Figure 2. The power supply part uses the TPMPDJ chip to convert DC12V to DC5V, and the ASM1117 chip to convert it again to DC3.3V to supply power to the system. The chip MAX485ESA is used to convert the TTL level signal of the serial port into RS485 interface signal, and the various data acquisition sensors of the system are connected to the RS485 interface. The two relays of the system use transistor driven CMOS transistors to control the relays’ action, complete the isolation of strong and weak points, and achieve programming control of the relays. They can respectively control devices with AC 250V 10A and DC 30V 10A. The system’s fans, fill lights, and irrigation actuators can all be connected to the terminal relays. 4.2Embedded software designUsing TI’s open-source protocol stack as the foundation for embedded system development, the system is implemented based on event processing in the OSAL of the protocol stack. 4.2.1Terminal nodesThe terminal node of the perception layer calls the timer of the system, collects data in the events of the timer, encodes it according to the communication protocol, and then sends it to the coordinator through the wireless sending function under the protocol stack. In the wireless transmission and reception event of the terminal node, when receiving data sent wirelessly by the coordinator, the data is parsed and the actuator is controlled. The state transition diagram is shown in Figure 3. 4.2.2Coordinator nodesIn the serial callback event of the coordinator, the data sent by the gateway is received and wirelessly broadcasted to the terminal node. In the wireless transmission and reception event of the coordinator, the received data sent by the terminal node is encoded and packaged. In the timer event of the coordinator, data is sent to the gateway through the serial port. The state transition diagram is shown in Figure 4. 4.2.3Gateway program designConnect the serial port 1 of the coordinator and use the interrupt working mode. In the interrupt processing program, the received data is parsed according to a custom communication protocol, and then Base64 encoded. Through serial port 2, MAX485ESA is used to convert it into an RS485 signal, which is sent to the DTU. Serial port 2, which connects to the DTU, still operates in interrupt mode. In the interrupt handling program, the received data is parsed according to a custom communication protocol and sent to the coordinator through serial port 1. After receiving the data, the coordinator broadcasts it wirelessly to the terminal node. 4.3Web implementationAdopting a front-end and back-end separation development model: The front-end is developed using Vue+element UI, while the server-side is implemented using Spring Boot. The database adopts MySQL database and uses MyBatis to complete the ORM mapping from database fields to classes. The functions implemented by the system are shown in Figure 5. 5.CONCLUSIONThe smart agriculture system constructed in this article uses RS485 interface sensors to collect parameters such as air temperature, air humidity, light intensity, carbon dioxide concentration, soil temperature, soil humidity, soil pH value, soil nitrogen, phosphorus, potassium concentration, and soil conductivity, comprehensively perceiving the growth environment of crops. Based on the data collected by the smart agriculture system, crop growth models can be generated to guide agricultural production; By utilizing the images collected by the system, it is possible to identify pests and diseases, thereby preventing them; By utilizing the images collected by the system, it is also possible to establish a digital twin system. By combining the collected images with crop growth data, the maturity of crops can be identified, and so on. The key technologies elaborated in the article, such as the design and implementation of gateways and the configuration of DTUs, have certain guiding significance for the construction of IoT systems; The debugging of DTU provides a convenient debugging method for using DTU. For the working environment of the constructed smart agriculture system, the system provides a solar powered power supply method, which is green and environmentally friendly while saving resources. The smart agriculture system adopts short distance wireless communication technology ZigBee for the perception layer networking. If the communication distance becomes longer, the long distance wireless communication technology LoRa can be used to expand the data collection range of the system, indicating the direction for the iterative update of the system. REFERENCEWANG XianMei,
“Research on Information System Control Based on Crop Life Cycle[J],”
Journal of Agricultural Mechanization Research, 12
(12), 246
–248
(2020). Google Scholar
Ji Wenwen,
“Study on Smart Farmland Ecosystem in Mountainous Area Based On LoRa Technology[J],”
Electronic Technology, 50
(7), 206
–207
(2021). Google Scholar
Meng Xiang, Zhao Ying, Xu Zhuowei, Zhang Daqing,
“Design of intelligent irrigation system for farmland based on LoRa technology[J],”
Journal of Chinese Agricultural Mechanization, 50
(7), 206
–207
(2021). Google Scholar
Jiang ShiXuan, Li HuaiJiang, Wu Ruirui, Li Dong,
“Research on smart agriculture system based on ZigBee and NB-IoT [J],”
Electronic Test, 11
–15
(2022). Google Scholar
Cao Zhihao, Zhang Xinxin, Mu Shaomin, Qu Hongchun,
“Design of Farmland Environmental Monitoring System In Mountainous Area Based on ZigBee [J],”
Computer Application and Software, 40
(3), 66
–71
(2023). Google Scholar
Deng Bingyue,
“Design of a Smart Agricultural Environmental Monitoring System Based on ZigBee and NB-Iot [J]. Agriculture Engineering,”
Information, 43
(5), 20
–21
(2023). Google Scholar
CHAI Xilin, ZHANG Jing, SHAO Zhaoyong, LI Guoxin,
“Design of smart agricultural greenhouse monitoring system based on wireless sensor network and edge gateway[J],”
Industrial Instrumentation & Automation, 13
–17
(2024). Google Scholar
CHE Lina,
“Research and Application of Abnormal Data Detection Algorithm in Agricultural Greenhouse Environment Monitoring System Based on WSN[M],”
Liaoning University, 7
–22
(2023). Google Scholar
|