Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 11, No. 3, 2024 250 Research on Intelligent Agricultural System based on STM32 Single Chip Microcomputer and PLC Leisheng Zhang *, Quanhang Hu, Tao Wang Shaanxi University of Science and Technology haojing college, Xianyang, 712046, China * Corresponding author: Leisheng Zhang (Email: 1375944125@qq.com) Abstract: This paper mainly introduces an intelligent agricultural system based on STM32 single chip microcomputer and PLC, aiming to realize the automation and intelligence of agricultural production. The system uses STM32 single chip microcomputer to collect environmental data, and uses PLC to control it in real time, to optimize agricultural production environment. Specifically, the system collects environmental data such as soil moisture, air temperature and humidity, and light intensity through STM32 microcontroller, and upload the data to the cloud using MQTT protocol to achieve remote monitoring. At the same time, the system uses PLC to analyze the collected data in real time, and automatically adjust the agricultural production equipment, such as pumps, ventilation fans, etc., to achieve automatic control. This system can not only reduce the labor intensity of farmers, but also improve agricultural output and product quality, and has a good application prospect. Keywords: STM32 MCU; PLC; Intelligent Agriculture; Automation; Data Acquisition. 1. Introduction With the accelerated development of urbanization, a large number of rural labor forces have moved to cities, resulting in an increasingly serious problem of rural population aging, and the shortage of agricultural labor forces has become an important factor restricting agricultural development. In order to cope with this challenge, agricultural automation technology came into being, it can not only improve agricultural production efficiency, reduce farmers' labor intensity, but also help to save resources and achieve sustainable development of agricultural production[1-3]. In this context, our team has developed an automated intelligent agricultural system called "intelligent farming" in order to contribute to the development of China's agricultural modernization. The "intelligent movement agriculture" system integrates a variety of sensors for real-time monitoring of environmental parameters, and realizes automatic irrigation, ventilation and other control through PLC controller to ensure that crops grow in the most suitable environment[4]. The system can also be remotely monitored and controlled through WeChat mini programs, which greatly reduces the work burden of farmers and improves production efficiency. In addition, emerging technologies such as big data and artificial intelligence have brought new opportunities for agricultural development. By collecting and analyzing agricultural data, we can better understand the growth status of crops, predict future agricultural trends, and provide precise decision support for farmers. The application of automation equipment such as drones and robots will also greatly improve the production efficiency and quality of agriculture[5]. However, the development of agricultural automation also faces some challenges. First, there are the technical difficulties. The agricultural environment is complex and variable, requiring highly accurate and adaptive automation technologies. Second, farmers' acceptance of the new technology is also an issue. Many farmers are on the fence about new technologies and need to improve their technological literacy through education and training. In addition, the high cost of agricultural automation equipment requires strong support from the government and all sectors of society. Despite the challenges, we believe that through technological innovation and government support, the development prospects of agricultural automation in China are bright. Agricultural automation can not only improve the production efficiency and quality of agriculture, but also improve farmers' lives and promote the sustainable development of agriculture. In the future, we will continue to work hard to contribute wisdom and strength to the development of agricultural automation and contribute to the realization of agricultural modernization. 2. Product Introduction and Service Planning 2.1. Product Introduction "Intelligent movement joint agriculture" is an equipment for agricultural automation, using STM32 SCM AD function real-time monitoring of environmental factors such as light intensity, air temperature and humidity, carbon dioxide concentration, soil humidity and pH, and combustible gas concentration. The STM32 microcontroller makes corresponding analysis and processing of the collected data, and displays a series of detected environmental parameters on the OLED screen in real time. The serial port function of the STM32 microcontroller and the MQTT communication protocol in the network are sent to the PLC processing system, and the serial port assistant function is used to upload the data to the cloud through the WIFI module in real time. The user can not only remotely view the real-time growing environment of crops through the WeChat mini program, but also achieve remote control of the device through the mobile phone. 2.1.1. Product Technology (1) Related technical introduction and advantages based on PLC processing system PLC (Programmable Logic Controller) is a digital 251 computer commonly used in industrial control systems, which uses a special programming language to program and control various sensors and actuators for automatic control. PLC processing system is widely used in modern manufacturing enterprises, can be used to control and monitor all production processes, machines, equipment, energy and other aspects. The main function of the PLC processing system is to control the running state of each mechanical part and equipment on the automated production line, so as to realize the automatic control of the manufacturing process. The PLC system detects changes in the external environment by receiving signal input, and automatically adjusts or controls the operation of related machines and equipment according to preset procedures. PLC can also transfer the stored information to other systems, such as data acquisition, analysis, etc., to help enterprises monitor the production process in real time and make corresponding decisions. Figure 1. PLC processor (a) and WIFI module (b) (1) Collection and transmission of MQTT communication protocol and Wiff module MQTT (Message Queuing Telemetry Transport) is a lightweight communication protocol based on a publish/subscribe model for Internet of Things (IoT) and M2M (Machine to Machine) scenarios. The protocol can not only decoupage the information publisher and subscriber, but also decentralize the transmission of information and enhance the scalability and reliability of the network. It also provides a variety of secure authorization and authentication mechanisms, such as TLS/SSL, user name and password authentication, and digital certificates, and it also provides a variety of capabilities that can be used for data risk analysis to ensure the security of information. It is simple, lightweight, efficient, secure, reliable and flexible, suitable for handling a large number of event streams and real-time interactions, and has become one of the important communication protocols in the Internet of Things and M2M market. It has expanded the use of communication protocols and made important contributions to the development of Industry 4.0 and smart cities. (2) STM32 MCU serial port function and AD collection principle Serial communication is one of the important ways of data exchange between microcontroller and peripherals or other systems. It is widely used in embedded systems because of its simple operation and easy control. STM32 MCU has multiple USART, UART, SPI and other different interfaces, among which USART interface supports more complex serial communication applications. The STM32's USART hardware architecture consists of a separate data line TXD and RXD input lines. They are connected by a common signal with a protective circuit. The data output is generated via USART on the TXD line. The data detected by the RXD input line is received by USART and moved to a register. The STM32 USART is suitable for asynchronous communication protocols. In asynchronous mode, they use a start bit to separate each byte and an optional stop bit at the receiving end to identify the end of the byte. In addition, the STM32 USART also supports hardware flow control, which can prevent the transmission of data errors. In STM32, serial port baud rate, data bit, check bit, stop bit and other parameters need to be set when configuring USART. The common configuration method is to adjust the value of USART related registers. For different application requirements, STM32 supports a variety of working modes such as sending, receiving and simultaneously sending/receiving, and programmers can choose different modes according to specific circumstances. 2.1.2. Main Products and Services "Smart farming" is not only applicable to the planting of some small ornamental industries such as gardens, but also can be applied to greenhouses and some large-scale agricultural planting scenes. Through the fully automated management of the system and real-time monitoring of the environment, it ensures that the crop is in the most suitable growing environment, improves the quality of the crop and the user's planting efficiency, and reduces the user's operating burden One of the main services of this product is the real-time monitoring and analysis of environmental factors in order to optimize the crop growing environment. Among them, the ADC conversion function of STM32 single chip microcomputer uses DHT11 sensor, MQ-2 module, soil moisture sensor, PH sensor module, photosensitive module, etc., to help farmers and growers real-time monitoring of light intensity, air temperature and humidity, carbon dioxide concentration, soil humidity and pH, concentration of fuel gas and other key environmental parameters. Through the accurate monitoring and analysis of these data, growers can adjust the planting environment in time to provide the most suitable growth conditions for crops. In addition, using the serial port function of STM32 microcontroller and the MQTT communication protocol in the network, intelligent agricultural products can also display the detected environmental parameters on the OLED screen in real time and send them to the PLC processing system. More importantly, the device uses the serial assistant function to upload environmental data to the cloud in real time through the WIFI module, so that users can remotely view the real- time growing environment of crops and remote control. At the same time, smart agricultural products also support WeChat mini programs, so that users can remotely view the planting environment at any time and anywhere through their mobile phones, timely understand the growth status of crops and make corresponding adjustments to improve the yield and quality of crops. Therefore, intelligent agricultural products using STM32 microcontroller and other related technologies have the characteristics of precision, efficiency and convenience, which can help growers improve their ability to understand the growing environment of crops and production efficiency, and inject new vitality into modern agriculture. When the product studio system finds that some parameters in the environment are not optimal, the PLC processing system will operate the equipment on the site in real time after receiving the data. For example: When the light intensity in the environment is too low, PLC will automatically control 252 the opening of the fill light, when the soil humidity is too low or the soil pH is abnormal, PLC will automatically control the opening of the water pump, when the carbon dioxide in the air or the temperature is too high, PLC will automatically open the ventilator and achieve the effect of ventilation and cooling through the stepper motor. At the same time, users can not only operate the fill light, water pump, etc. Ventilation fans and other equipment to achieve crop management. Moreover, it can also send instructions to STM32 MCU through WeChat mini program, to realize remote control of PLC processing system indirectly by MCU. 2.2. Future Product and Service Planning 2.2.1. Realize Convenient and Automatic Planting Management Future smart agricultural products will be more diversified and high-tech, providing growers and farmers with more comprehensive and convenient services. The following are some possible future product and service plans: Artificial Intelligence decision support system: Using artificial intelligence algorithms to analyze historical data and current environmental factors, to provide growers with accurate decision support, including recommendations and timing for sowing, fertilization, spraying and other work. Smart farm visual management system: Through sensors, data acquisition equipment and cloud technology, to achieve monitoring and control of all aspects of the farm, such as irrigation, ventilation, temperature, etc., growers can remotely control the entire farm operation through mobile phones or computers. Agricultural big data analysis platform: Collect, analyze and integrate global agricultural resource information to help growers make decisions, but also provide relevant industry data early warning and analysis for governments and companies. Agricultural Internet of Things terminal equipment: Connect key points such as fields, greenhouses and other nodes through the Internet of Things technology, improve the interoperability and automatic control level between devices, and enhance the intelligence and real-time management. Personalized customized services: play the role of big data and Internet of Things technology to provide exclusive product consultation and recommendation of planting mode and planting parameters for each farmer. In general, future smart agricultural products will be more comprehensive, advanced and technological, bringing more convenience to growers and companies, and should seize the opportunities of new technologies to continuously improve the level of industry development. 2.2.2. Technical Planning for Future Development Direction Future smart agricultural products will become more diverse, more high-tech, and bring more value and convenience. For the future development direction may have the following aspects. (1) Holographic projection technology: In the future, farmers or growers can use holographic projection technology to simulate different agricultural scenarios, which can quickly perform real-time data analysis, reduce labor costs and material resource consumption, improve commodity production efficiency and reduce risks. (2) UAV technology: In the future, drones will play a greater role in agriculture, it can through aerial monitoring, so that farmers, growers, and even the government to understand the farm in a new perspective, and provide it with automatic lighting, fertilizer and other areas of coverage of high precision technical support and services. (3) Modular smart farm system: The smart agricultural products of the future will adopt a modular design, that is, there is good interoperability between various components, optional and flexible. For example, you can upgrade your existing equipment, add components, and eventually build a custom smart farm system. Blockchain applications: Blockchain technology has been widely used in financial markets and supply chain management worldwide, and it is more likely to be used in agricultural production processes in the future. Blockchain technology can comprehensively track the traceability of agricultural products and data cleaning and processing, optimize and simplify the operating costs of logistics and settlement of various platforms, and enhance their credibility and intelligent management level. (4) Multi-sensor equipment: In the future, in order to better accuracy and adaptability, a variety of sensors will be used in farming, fertilization, watering and other aspects of the work to obtain more agricultural data, with a special system integration, and the use of big data analysis technology real-time feedback, improve production efficiency and quality. 3. Service and Support 3.1. Technical Support With the continuous upgrading of modern technology, intelligent agricultural products will become more popular and advanced in the future development. However, the operation of various high-tech equipment depends on professional technical support and services. This paper will focus on the technical service support of intelligent agricultural products and the corresponding measures. (1) Importance of technical support At present, intelligent agricultural products on the market have voice control, gesture recognition, automatic execution and other functions, and the production efficiency and output quality have been significantly improved. However, with the increasing complexity of these high-tech equipment, problems such as hardware damage, software failure and network delay are prone to occur in the actual use process, affecting farmers' ability to operate, repair and maintenance equipment. Only through adequate technical support, can ensure the normal work of the machine, but also improve the user's sense of security and trust. (2) Technical support measures Establish a perfect after-sales service system: The key to technical service support is first to establish a complete after- sales service system, for different intelligent agricultural products, establish a after-sales service team covering product installation, account registration, hardware and software configuration and troubleshooting, whether it is online consultation, telephone return visit or on-site service, professionals need to make a timely and specific reply. Update technical manual continuously: Create detailed technical manual for all equipment operation and related software, including equipment description, application methods, common problems and solutions, etc. And to ensure timely update, to ensure that users can understand the latest product technology, and reach a higher level in the corresponding field. 253 To provide customers with online technical support: provide 24-hour online technical support, establish the corresponding communication channels, in all kinds of user feedback platform timely reply to customer questions, answer customer concerns, so that customers have a comprehensive sense of trust and dependence. Provide remote assistance tools: For the case that it is not possible to reach and solve the user's problem quickly, you can repair or assist the customer through the remote control tool, and you can also conduct coaching operations through the video sharing system to help the customer solve the actual problem more efficiently. 3.2. Logistics Service With the development of intelligent agricultural technology, more and more intelligent agricultural products have been introduced into modern agricultural production, improving the efficiency and quality of agricultural production. However, smart agricultural products have also encountered difficulties in transportation, warehousing and logistics. Therefore, logistics services are a very important part of the process of exporting, importing and selling smart agricultural products. This paper will discuss the logistics service support of intelligent agricultural products and corresponding measures. (1) The importance of logistics services The production of smart agricultural products largely relies on advanced technologies, which not only involve machinery and equipment, but also include information and logistics services. The international and domestic trade of intelligent agricultural products requires logistics transport carriers to carry out reliable, safe, fast and efficient cargo transport. (2) Measures for logistics services Establish a sound management system: starting from the two aspects of warehousing and transportation, focus on strengthening the management of the loading, transportation and unloading operations of intelligent agricultural products, especially for the logistics management and safety activities of complex and precision live instruments. Secondly, establish a logistics complaint handling mechanism with comprehensive coverage and reasonable rights and interests. The development of intelligent logistics, through the increase of intelligent logistics facilities, technology applications and other ways to promote the construction of intelligent logistics, such as the realization of drones, thermal imaging instruments, AGV cars, Internet of things and other scientific and technological means in agricultural products planting, transportation and storage applications, improve logistics efficiency and accuracy, to ensure the quality and accuracy of logistics services. Enhance logistics service level: Innovate logistics service models and business processes, emphasize logistics customer experience and market feedback, and ensure safe, reliable and fast delivery of goods. 3.2.1. Partner Support With the development of science and technology, intelligent agricultural products are playing an increasingly important role in modern agriculture. In order to further improve product quality and customer experience, partner support is becoming increasingly important. This paper will focus on the cooperative support strategies and measures for smart agricultural products. (1) The importance of partners The knowledge and technology required for smart agricultural products is very complex, and the market competition is also very fierce. Therefore, good partnerships in areas such as logistics, technology and sales are crucial to achieving sustainable growth. Partner support helps products get to market quickly, reduce marketing costs, and improve the overall service level of the product. (2) Measures supported by partners Establish a strong logistics network: In order to ensure that smart agricultural products can be delivered to farmers in a timely manner, a strong logistics network needs to be established. Smart agricultural products involve processes such as planting, breeding, harvesting, etc., requiring comprehensive tracking of operations and ensuring optimal transport times and safety. Therefore, it is necessary to establish a long-term and stable cooperative relationship with a professional logistics company. Provide professional technical services: With the rapid development of smart agricultural products, the market competition is very fierce. Working with experienced technical service companies to provide professional, high quality technical service support is essential to ensure rapid response and maintenance of product services. This not only provides customers with high-quality after-sales service, but also greatly improves the credibility and use value of the product. Strengthen sales and promotion strategies: A strong partner system can bring many customers and better revenue, which is of strategic importance. 3.2.2. WeChat Mini Program Intelligent agriculture has become an important development direction of modern agriculture. With the continuous improvement of science and technology, farmers and agricultural enterprises are increasingly relying on high- tech planting, breeding and management technology. With the rise of WeChat mini programs, it also makes more and more sense to develop a WeChat mini program specifically for smart agriculture. The team combines intelligent agriculture with WeChat mini program, which will provide rich and practical services for farmers and agricultural enterprises and help the development of agriculture. (1) Recommendation of personalized planting plan In the smart agriculture WeChat mini program, users can input their planting needs, such as geographical location, planting crops and other information, and the system will recommend personalized planting plans for users according to different factors. This function is mainly based on big data and AI technology to achieve the recommendation of planting programs, which can better meet the needs of users. (2) Early warning of crop diseases and pests This feature is an important service that users cannot live without. Through the smart agriculture WeChat mini program, users can learn about crop diseases and pests and other information in real time, and take corresponding protective and treatment measures in time to reduce the adverse impact of production. This function is to realize the early warning of crop diseases and pests and provide treatment suggestions through sensors and intelligent identification technology. (3) Monitoring of environmental parameters Weather plays an important role in agriculture. Smart agriculture WeChat mini program can easily provide users with local weather and meteorological data, including temperature, humidity, wind direction, precipitation and other related information. Moreover, it can also freely control the functions of the product, so that users can carry out corresponding operation planning and arrangement according 254 to their own needs, in order to maximize the output and efficiency of agriculture. (4) Exchanges and cooperation The smart agriculture WeChat mini program also provides users with a platform for communication and cooperation. Users can communicate with other farmers or agricultural enterprises through this small program to share planting and breeding experience and technology. On this platform, users can also find partners to jointly carry out agricultural projects and achieve multi-win. The above functions are the main content of the intelligent agriculture WeChat mini program, hoping to contribute to the development of agriculture and the improvement of farmers' lives. The small program will rely on technological innovation to serve agriculture, make agriculture more modern and intelligent, and increase vitality and power for agriculture. 3.2.3. Platform Services Intelligent agriculture is a hot field of agricultural development at present, and its development direction is to adopt new technologies, new models and new formats to improve production efficiency and quality, so as to achieve the purpose of reducing agricultural costs and improving farmers' lives. The combination of intelligent agriculture and the Internet of Things, the establishment of environmental monitoring with the characteristics of anytime and anywhere monitoring and automatic control, and the protection of farmers' rights and interests of the e-commerce platform, not only can promote the development of agricultural industrialization, but also can bring rich economic benefits to farmers. This paper focuses on the platform service of intelligent agricultural products, and expounds its characteristics and advantages. (1) Intelligent environmental monitoring The platform service of smart agricultural products provides environmental monitoring functions, which monitor the environment in which crops are grown in real time through multiple sensors. At the same time, according to the needs of planting crops, reasonable "preparation breath" is carried out and automatic control is carried out to make the crops grow in the best growing environment. (2) Product sales The platform service of intelligent agricultural products can also help farmers to sell and promote products, and establish a perfect e-commerce platform. On this platform, relevant sales functions will be provided to improve farmers' product exposure, increase sales, and bring real economic benefits to farmers. (3) Agricultural guidance The platform service of smart agricultural products will also provide advanced agricultural guidance services, and provide practical technical support and training for farmers. To ensure that farmers in the production process will not appear the problem of omission, improve production efficiency and output. (4) Energy consumption management In order to achieve the goal of saving energy and reducing consumption of smart agricultural products, the platform will also provide energy management functions. This function can help farmers to save energy and reduce emissions, and achieve the best management of energy consumption through intelligent control technology. (5) Production data analysis The platform will provide advanced data analysis capabilities for farmers to understand production data, thus providing an important reference for future agricultural operations and planning. Data analysis can make farmers more clearly understand the trend of agricultural development, market demand and technological changes and other factors, so data analysis has an important role in promoting the development of agriculture. The above functions make the platform service of smart agricultural products a strong support for agricultural development, allowing farmers to experience the true meaning of smart agricultural products, and also contribute to the production efficiency and environmental protection and sustainable development of agriculture. In the future development of agriculture, intelligent agriculture will become an important direction of agricultural technology and development, bringing more development opportunities for agriculture. 4. Conclusion This paper presents an intelligent agricultural system based on STM32 microcontroller and PLC. The system uses STM32 microcontroller to collect environmental data, and controls it in real time through PLC, so as to realize the automation and intelligence of agricultural production. This system not only reduces the labor intensity of farmers, but also improves agricultural output and product quality. Therefore, the system has a broad application prospect in agricultural production. In the future, with the continuous development of technology, the system can also introduce more intelligent technologies, such as artificial intelligence, big data, etc., to further improve the efficiency and quality of agricultural production. References [1] Neranjan N, Khalid M A ,Zakaria Z , et al.A novel cloud enabled smart carbon neutral hydroponic setup for stem cutting propagation of tropical tree species[J].Computers and Electronics in Agriculture,2024,218108724. [2] Ruba B U ,Talucder A S M ,Zaman N M , et al.The status of implemented climate smart agriculture practices preferred by farmers of haor area as a climate resilient approach[J]. Heliyon, 2024,10(4):e25780. [3] Alex Z, Majaliwa G J M ,Britta T , et al.Maize yield under a changing climate in Uganda: long-term impacts for climate smart agriculture[J].Regional Environmental Change, 2024, 24 (1). [4] Maraveas C, Konar D ,Michopoulos K D , et al.Harnessing quantum computing for smart agriculture: Empowering sustainable crop management and yield optimization [J]. Computers and Electronics in Agriculture,2024,218108680. [5] Federico D, Brent J ,Faisal N , et al.Finding climate smart agriculture in civil-society initiatives[J].Mitigation and Adaptation Strategies for Global Change,2024,29(2).