Design of Integrated Low-Power Irrigation Monitoring Terminal

. In order to realize low-cost automatic control of field irrigation and water metering, an integrated low-power irrigation monitoring terminal based on wireless data communication was designed. Powered by battery or solar, the terminal could acquire and store data of sensors and water meters in real-time. Taking valve as control object, the terminal can provide safe irrigation strategy based on multiple control logic, such as data overrun, time and manual operation. The detection of fault on-site and reasonable judgment of irrigation can be carried out by using self-check function, querying of local data and remote data transmission based on GPRS and Modbus Protocol. Experimental results showed that the terminal could work stably, and control irrigation water usage accurately with low power cost.


Introduction
With continuous growth of population and economic in China, increasing pressure has been placed on the water management and conservation, and continues to drive growing demand for improving water use efficiency for agricultural irrigation and developing water saving technology in China.Irrigation automatic control technology has been widely used, and water-saving agriculture also has become agricultural development strategy for many countries [1].China tops the list of farmland effective irrigation area in the world.In terms of water-saving automatic control, in the past few decades, China has introduced many advanced equipment and irrigation control system from abroad enterprises, including Eldar-Shanny, RainBird, Hunter, Toro, etc.However, high cost, poor compatibility with the characteristics of domestic irrigation and different user habits restricted its large-scale application [2][3][4].Agricultural water-saving information technology research was started in the 1950s and great progress was achieved in China.
Intelligent decision control model and control system were constructed based on information fusion technology.Jiangsu University developed winter wheat precise irrigation intelligent system based on fuzzy decision theory; Tianjin Normal University of engineering constructed soil water potential intelligent decision model and support system; National Engineering Technology Research Center for Information Technology in Agriculture developed water-saving irrigation automatic control system, which could realize water pump and valve automatic control [1].Those systems and applications mentioned above required the users to be professional, which hindered the promoting of information system.The No. 1 central file released by GOV.CN in 2011 put forward "Three Red Line" management system, which made specific limits on water use quantity, water use efficiency and in water pollution in function area.However, the actual situation is that stations for agricultural water information monitoring are concentrated and lack in number, which results in difficulties to accomplish real-time monitoring [5][6][7][8][9].To some extent, it has limited the development of information technology applied to the agricultural water-saving management.
A low power cost field irrigation control terminal was designed in this paper.Different application mode could be built, and a variety of irrigation control mode, information collection, storage and download function were also developed.Meanwhile, the introduction of simplified menu design, online data query and equipment local online self-check function could greatly help users with the controller useand improv the efficiency of equipment maintenance, which made the developed terminal easier to be promoted.

Hardware Structure
Considering that the equipment would be practically used in open field, where the stable utility power lines are not available, the terminal was powered by battery or solar.MCU C8051F964 was selected as its core chip, which was a high rate and low power cost single chip microcomputer of high-performance.The sleep-mode power consumption of this chip could be as low as 700nA.A built-in ultra-low power consumption clock provided the equipment with timing awaken resource.Two LDO served as independent power for main chip systems and peripherals.Independent external clock calendar served for equipment basic time and equipment operation.All the peripheral devices, including sensor, solenoid valve control, USB and Bluetooth, GPRS module, LCD display were controlled separately by power switch.
Communication part adopted the design of plug and play mode, and also reserved interfaces for standard RS485 BUS and GPRS module, which guaranteed the extending ability for networking functions, data remote transmission and local download function.The framework of the proposed system hardware and picture are shown in Figure 1.

System Function Design
The function was designed based on the requirements of end user, equipment practical applications and the possible problems that might arise in practical use.The reliability, convenience, protection and fault tolerance were all taken into consideration, in order to improve the performance of the equipment.

Sensor Data Acquisition
Sensor information acquisition, especially the soil moisture [10], is indispensable function in irrigation monitoring and control system.The obtained data can not only reflect real-time measurement of soil moisture, but also can be used as a reference index to guide irrigation control.Considering the particular occasions, there would be a sensor damage or malfunction, especially the short circuit fault.Therefore, in the sensor interface design, power independent control and OCP(Over Current Protection) were used, which meant power was activated only when data sampling happens through each channel and shut down for the rest of time.If voltage or current value over range was detected, the device would automatically cancel the measurements, shut off the power, and prompt error message, such as display hints or text message.
Using the proposed design, it can not only reduce the power consumption of the equipment running status, but also can avoid long time short-circuit fault which might lead to paralysis.

Water Meter Data Collection
In view of the increasingly serious situation of water resources and the present situation of the agricultural water inefficient use, in addition to irrigation control, accurate measurement of water consumption is equally important.The water use information can be used to help with water management.The irrigation water use information, including timing of data acquisition, water use accumulation in a certain area, water use accumulation of a specific valve, and the density of water use in different period of time could be analyzed, which could provide the basis for realizing effective water management [11].

Record Store and Download
Combined with section 2.1, using nonvolatile memory of external expansion, data record, store and download functions were developed for the logging system.The record types were divided into S (sensor data), T (time water record), and Q (fixed quantity of the water).In order to guarantee the consistency of the data format, fixed-length data package structure was used.Figure 2 shows the data store format.

Fig. 2. Data store format
History data could be checked locally, and downloaded through USB or Bluetooth.APP based on Android was developed to accomplish data download using smart phone.The maximum data records capacity was 8000, which meant the storage of half a year with saving interval by 30 minutes.All the data could be downloaded within 2 minutes with TXT or EXCEL file format.
RS485 communication mode was mainly used for multi-point network by external 433MHz or 2.4GHz wireless data transmission module.Data remote transmission was accomplished based on GPRS or SMS using embedded SIM900A module.In actual use, due to high current consumption GPRS at both starting and running period, SIM900A would be timed to start and connect.At the same time, many problems might lead to net connection failure, including module failure, SIM card error, network instability, default network interruption, server without electricity, and so on.In order to ensure the wireless communication reset function without frequent restarting the module, method by resetting times and reconnection time management was used to save power and ensure the GPRS general communication.The two communication modes both followed industry standard Modbus Protocol [12].
4 The Software Design

Task Partitioning
The main task for the software was to accomplish valve control and water management based on different logic.
According to the characteristic of time benchmark for the system, the main task was divided into several subtasks, including data acquisition, communication response, key press, calendar update, data storage, updating of operation parameters, and equipment status information display.Time slice polling and software timer mechanism accomplished the main function.Figure 3 shows the main program structure.The terms in Fig. 3 are explained as following:

Timer Program State Update
Control logic: Logical judgment and mission task started according to the user preset mode.
Timing of equipment running: In the main loop, the equipment start flag would be checked regularly and was used to start the counting down timer.Equipment running status would be updated when overflow flag was detected.
Update of equipment status: According to the countdown overflow, equipment running status would be updated, and the latest status of the equipment would be used as the factor for main program logic judgment.

Control Logic
In control logic design, mainstream irrigations control methods were referenced, such as Hunter, Netafim, etc.
Meanwhile, combining with the target user demand and domestic use, menu was simplified in order to make less information input by user and reduce the incidence of parameter errors in practical use.Four types of control logic, including transfinite control, timing control, quantitative control and manual control, were accomplished in the design, and protection mechanism was also taken into consideration as supplementary.

Sensor Limit Value Control
Control mode based on soil moisture sensor measurements has been widely used in actual irrigation control system and it could help to fill water in time while crop in water stress status.Its disadvantage is that, firstly unrepresentative install position of the sensor will greatly affect the reasonable irrigation.Secondly, sensor fault or damage would lead to decision errors, and serious consequences would happen under the extreme condition.
Aiming at the problems above, we focus on the analysis of sensor failure factors, which might lead to the measured value to be continuous high or low.Reasonable supplement irrigation and, limited irrigation mechanism were designed to avoid excessive and insufficient irrigation happening.According to empirical analysis, relatively low measured value might be caused by the following three factors: (1) Illogical measure point selection; (2) Pulling out of sensor; (3) Sensor damage or disconnection.
The reason that leads to larger measured value may probably lied in: (1) Illogical measure point selection, such as low-lying place; (2) Sensor h connection error.
If one of the above two conditions occurs, the changing trends of soil moisture would be like the charts shown in  To solve the problems above, overrun control setting parameters were designed as shown in table 1.Besides the commonly used preset, two additional parameters, 'maximum delay time' and 'daily maximum irrigation quantity', were added.They had higher priority than other parameters.The overrun control parameters are shown in Table 1.

Tab.1 Overrun control parameters setup list controlling condition parameter setup
The reference number of sensor(1-4) S1 The reference value (%) 15.0 Returned difference (%) 3.0 entry condition Ultra lower limit

Maximum delay time(DD) 02
The maximum daily amount of irrigation(m 3 ) 20 The terms in Table 1 are explained as following.
Maximum delay time: day was the smallest unit, after overrun irrigation program starting, the timer begins to countdown.If irrigation started again before the overflow of the countdown timer, the timer would reset and restart.If there was no restart during the maximum delay time, forced irrigation would be activated.Through this way, irrigation would start at least one time during the maximum delay time interval and ineffective irrigation caused by larger soil moisture value could be avoided.
The maximum daily amount of irrigation: If the sensor measurement was continuous too low to start irrigate and no action is taken, flood irrigation would happen due to the unchanging soil moisture.The maximum irrigation quantity could control the upper limit of daily irrigation water accumulation, which could avoid over irrigation.If no water meter was installed, the actual largest water should be converted to the largest irrigation time.
The two parameters introduced above could offer the protection for fault condition which might result in excessive or defective irrigation, and reduce the extreme damage to the crops.

Timing Control
Timing control was one of the most common automatic control irrigation methods, efficient irrigation time could be set in advance, and the system would automatically start the valve and complete the irrigation in the specified time.The advantage of timing control was that irrigation frequency could be guaranteed.However, if the irrigation cycle was too long and dry weather occurs during the time, crop would be withered for water shortage.
In order to solve the problem, 'supplementary irrigation' mechanism was applied to ensure crop hydrate properly in the occasional extremely dry weather conditions, and to reduce the resulting losses.While 'supplementary irrigation' happening, 'the largest irrigation quantity' was also set to avoid over-irrigation in the condition of sensor error occurred.

Fig. 1 .
Fig. 1.Framework of system hardware and picture

The equipment has 4
channels of remote meter signal acquisition interface of impulse type.Using MCU's pulse detection and level matching function, it achieved the real time measurement of water use.The operating principle is: two continuously impulse generated by water meter separately means the preset smallest unit.In practical use, external interference signal jitter could produce continuous single pulse on one signal wire.Low pass filtering in MCU could effectively prevent the happening of such error.Port match level flip function could also prevent the water meter signal from deadlock, which might cause program to enter infinite loop.The combination of both protection procedures could ensure water pulse measurement accurate and reliable.