2 Design of the host computer monitoring software system 2.1 System composition of MCGS configuration software MCGS configuration software consists of two systems: configuration environment and operating environment. The two are independent of each other and related to each other. In the configuration environment, users design configuration projects according to their own needs, which mainly includes the design of animations and the writing of related programs. The generated configuration database has an extension of . The project file of mcg, which together with the MCGS operating environment constitutes the user application system. The real-time database is the core of the entire system, which mainly refers to real-time reading and object encapsulation, that is, multiple attributes or actions of an object are integrated in the database, which connects various parts of the MCGS project into a whole. The variables in the entire project are defined in this window. These variables of different types and names are the objects used in data collection, processing, control output and driving equipment [4]. The structure of MCGS software system is shown in Figure 2.
2.2 Equipment channel connection settings In this system, the main external hardware connected to the upper monitoring layer is the two sensors, namely the soil temperature and humidity transmitter, and the temperature, humidity, carbon dioxide and illuminance transmitter. According to the sensor instructions in the device window Set relevant properties, correctly set device connection channels, corresponding data objects and other parameters according to the setup wizard, and establish a connection with the system. In this way, when the host computer sends a query command, the slave computer (transmitter) will respond and transmit the data to the host computer through the RS-485 interface. The system can obtain the environmental parameters collected by the transmitter and implement them according to the relevant settings. Control of the base site. Using MCGS to write the host computer does not require writing a driver. This project uses the Modbus RTU driver, so the channel connection only needs to be configured correctly.
MCGS provides device drivers for commonly used industrial control products at home and abroad. The device window is the hub for MCGS to communicate with external devices. In this window, the environmental parameters of external hardware devices are collected through components and sent to the real-time database, or into the real-time database. The data is output to the external device [5]. When using it, you only need to find the hardware device you want to use from the device toolbox, and correctly set the device connection channel, corresponding data object and other parameters according to the type of external hardware device, so that the system can read data from the external hardware device for processing and analysis, so as to base On-site control [6]. In this project, on-site data are collected through soil temperature and humidity transmitters and temperature, humidity and carbon dioxide illumination transmitters, and then enter the host computer through the RS-485 port. Since MCGS provides the ModbusRTU driver, there is no need to write related drivers. In the monitoring system of this project, first set the universal serial port parent device in the device management menu of MCGS, then find Modicon ModbusRTU from the device toolbox and hook it to the universal serial port parent device, and then define it according to the system requirements. and set the configuration of the device, the on-site environmental parameters can be transferred to the configuration software for processing.
2.3 Design of monitoring interface The agricultural greenhouse monitoring interface designed by MCGS configuration software mainly includes four: real-time data, alarm settings, manual equipment control, and alarm record display, as shown in Figure 3. Reasonable upper and lower limits can be set for environmental parameters based on different greenhouses and plant growth. When real-time data exceeds the set range, the indicator light will generate an alarm. According to the alarm, not only can water pumps, ventilators, heating equipment, roller shutters, spray equipment, fluorescent lamps and other equipment be manually switched on and off, but also the opening and closing of related equipment can be automatically controlled to achieve the best growth environment.
3. Remote transmission of agricultural base data
When the number of greenhouses in the base reaches a certain scale, how to transmit the information in the many scattered greenhouses to the management center is another core issue of this project. This study proposes to use DTUGPRS for remote communication to transmit the environmental parameters and control status of the base site to the management center for data analysis and timely and effective remote control.
3.1 Introduction to GPRS technology GPRS is the abbreviation of General Packet Radio Service and is a standard technology for packet switching data. GPRS technology is an upgrade of GSM technology. It requires relatively little investment but can achieve full network coverage. GPRS adopts a new encoding method based on GSM, and adopts a packet switching method in the core network part, so that the transmission rate of GPRS can be increased to a maximum of 114kb/s, breaking through the circuit network’s transmission rate of only 64kb/s. [7]. GPRS only modifies some wireless parameters of GSM, improves the utilization of wireless resources, is beneficial to operators’ network optimization, improves the data communication capabilities of GSM networks, and cultivates the mobile data service market. At the same time, GPRS technology combines the essence of GSM and IP technology, maintaining good mobility while possessing the flexibility of IP technology. The time for GPRS users to establish a connection with the external data network is relatively short. When the network quality is relatively good, it only takes 1 to 1.25 seconds. The charging method is more reasonable and cheaper. The charges for GPRS users are calculated based on the transmission unit rather than the entire channel. Because the GPRS channel can be shared, packets will be generated only when users need them. GPRS technology also introduces APN access point to facilitate global roaming of services [8].
3.2 DTU communication principle DTU is to transfer terminal data to the server through the network port or serial port through the wireless network to realize mutual conversion between the TCP/IP protocol and the serial port data stream. It is the abbreviation of data transmission unit. Using transparent transmission, divided into data uplink and data downlink, it can provide wireless communication capabilities for devices without TCP/IP protocol processing capability management.
Data downlink: In information management, the control commands are encapsulated into IP packets according to the customized frame format, and sent to the DTU through the Internet/GPRS network. After the DTU receives the IP packet, it is passed to the M through the RS-232 serial port. CGS, MCGS According to the custom frame format, data is restored to realize various states of motor terminals such as water pumps and ventilation equipment.
Data upstream: MCGS sends status data through the RS-232 serial port, which is encapsulated into IP packets after DTU and sent to the information management center through the GPRS network; the data center software will store the received IP packets according to the customized frame format. After entering the database, staff can view the data through a browser or client software, and then make judgments and decisions on the information.
3.3 How to configure DTU parameters This system uses Mingyu Electronics MY1000GPRSDTU. The main configuration process is as follows: (1) The DTU serial port is connected to the computer serial port through a serial port cable. Open the DTU configuration software. In the “Computer Serial Port Settings” section, select the corresponding serial port number. If you are using a USB to serial port module, you should select it in the system’s “Computer Serial Port Settings” section. Check the serial number mapped after installing the driver in “Device Manager”. Select baud rate 9600, parity bit NONE, data bit 8, stop bit 1. After these are configured, power on the DTU, and then click the “Enter Settings” button within 5 seconds to send the serial port command to start setting to the DTU. (2) Then enter the setting state, enter the “Terminal Networking Parameters” interface, and automatically query some of the terminal’s current networking parameters. In the “Access Center IP” area, you can fill in the IP of the server PC on the public network. (3) The access center port can keep the default value of 10000, select TCP protocol as the center protocol, and the GPRS user name and password remain unchanged. APN name, if it is China Unicom, it is UNINET, and if it is China Mobile, it is CMNET. The terminal number is 4 digits, which can be set by yourself. Each terminal is different and can be programmed starting from 0001. The SIM card number is the mobile phone card number that the user inserts into the terminal. The heartbeat packet is generally set to the default 60, so that the DTU parameters are configured. (4) Then configure the DTU serial port and external hardware device parameters. Select the “Terminal Serial Port” option to enter the setting interface. Currently, the baud rate range supported by DTU is 1200~115200, and the interface verification method supports: NONE (no verification), ODD (odd verification), and EVEN (even verification). The supported data bits are 8 bits and the stop bit is 1 bit. (5) If the set serial port parameters are 115200, E, 8, 1. Before the DTU is connected to the central server, it will still maintain the parameters of 9600, N, 8, and 1. You will only see the set serial port parameters after logging in to the central software. After the setting is successful, finally click the “Exit Settings” icon, DTU will restart and start connecting to the central server according to the set parameters. 4. The remote monitoring layer management center is composed of network access equipment and working computers. It is used to complete the collection, storage and display of base on-site environmental parameter information, and at the same time realize remote manual control of base video and remote control of base environmental parameters. The main interface designed for this system is shown in Figure 4: (1) After setting options such as historical reports, alarm settings, and historical curves, click the corresponding button and the corresponding interface will pop up. Users can refer to relevant interface displays to make reasonable judgments. Each interface can be printed out for easy archiving. (2) Real-time display of air temperature and humidity, ammonia concentration, soil temperature and humidity, illumination and other parameters of each base. At the same time, virtual devices such as fertilizer spreaders, ventilators, and water pumps are configured. Users only need to click on the virtual devices to realize the on/off operation of remote devices. (3) The information management center can set relevant parameters based on the environmental parameters transmitted by the two sensors to realize automatic control of the environmental parameters of the agricultural base.
5 Conclusion The agricultural vegetable base remote monitoring system based on MCGS and DTU designed by this research has been applied in a vegetable production base in Xuzhou City. The use results show that the system is stable and reliable, and has improved the production monitoring and management level and economic benefits of the base. At present, DTU and configuration software are developing rapidly in China. The agricultural base monitoring system developed using these two can significantly improve the automation control and management level of each base, and obtain an agricultural base that is better monitored and maintained with a relatively small investment. Remote control system. The system has good versatility. By selecting different sensors and changing some parameter settings, it can be applied to different applications, such as smart homes, Internet of Vehicles, etc.