A novel autonomous remote system applied in agriculture using transmission control protocol

,


INTRODUCTION
Recently agriculture sectors have been threatened by many different factors like the increased demand for agricultural products, climate changes, and decreased water resources.In addition, most irrigation systems are controlled by a manual operator where farmers periodically visit their agriculture fields to verify water requirements and irrigate the respective fields.Also, the farmer needs to wait for a certain period before turning off motors so that water can flow in sufficient quantity in the relevant fields.Consequently, this operation raises costs and consumes resources, such as water, time, and labour, especially when we irrigate multiple fields distributed in different geographic areas.
Moreover, Agriculture annually absorbs nearly 70% of the total volume of freshwater of the world, as mentioned in [1], making it one of the sectors with the highest water consumption.Furthermore, human errors and non-accuracy in irrigation stress plants and affect their growth by humidity pests.Otherwise, many irrigation systems are extensive and include hundreds of miles of pipes, depending on the size of the process.In addition, some systems located in sparsely populated areas may take hours for individuals to travel to for monitoring.Other areas are experiencing changes in extreme temperatures, leaving the system vulnerable to scorching temperatures and the costly problems that could ensue.Agricultural reports indicate that at least 15% of farmers over irrigate their crops, and excessive irrigation can reduce efficiency, increase resource costs, and ruin several types of crops, as indicated in [2].All these things put significant pressure on agriculture and increase the risk of disruption.
To defeat the competition, eliminate these problems.At the same time, liberating workers to focus on real issues, increase food production, and conserve natural resources, supervisory control and data acquisition (SCADA) technology can be used in many ways with irrigation systems.First, it can trigger or shut off irrigation remotely in real-time.So, we can avoid wasting time and labor.Second, it can predict the frost temperature and crop watering to save sensitive plants.Third, it can use sensors to determine when to water and how much water to use to save water, reduce run-off, leaching, and reduce evaporation.
We can design a SCADA irrigation system that is straightforward or as complex as necessary for the area concerned.For small farms, radio-controlled irrigation systems are adequate.In contrast, cellularcontrolled irrigation systems that rely on cellular modems for real-time monitoring may better serve large-scale farms.In this context, this work aims to develop an energy-efficient, cost-effective autonomous SCADA irrigation IoT system that senses, transmits data to the customer, and controls the water flow remotely.So we can reduce and calculate water consumption and make the work much more manageable.
The main contributions of this proposed paper are: i) Build an autonomous low-cost internet of things (IoT) device [3]- [5] that contributes to solving the previously mentioned problems taking into account data processing, storage capacity, and data transfer; ii) Create an embedded energy harvesting system to balance energy consumption; iii) Build Node.js server that manages communication effectively in real-time between the NewAgriCom device and MySQL database using transmission control protocol (TCP) protocols; iv) Create a Stand-alone and MySQL Database to store and process data; v) Create an ease-of-use user interface to control and supervise the NewAgriCom device; vi) Exploit different solution software and hardware to increase the lifetime of the IoT device [6].
Throughout the rest, this paper has organised thoughts in the following way.Section 2 gives related works of IoT irrigation systems.In Section 3, we present the proposed IoT Architecture and its components.This section shows the prototype of the NewAgriCom device and the different components used in it.The energy consumption of NewAgriCom and our strategy to save their energy and its cost estimation are presented.After we also offer our approach to store data in a stand-alone and wireless datalogger.Other components used in the proposed IoT architecture, such as Node.js,MySQL, Nexmo representational state transfer (REST) application programming interface (API), communication protocol, are investigated.Furthermore, the proposed graphical user interface (GUI) is given here, used to present data and provide an interface to command and monitor the IoT device.Finally, Section 4 concludes this work.

RELATED WORK
This section will present different types of linear and pivot irrigation systems [7] in which our NewAgriCom device can be used and some IoT irrigation systems.In irrigation, we can use linear or pivot irrigation types like spray, gravity, drip, micro-spray, flood, and variable rate irrigation (VRI) and make them more precise.Many solutions are proposed in the literature like: Sprinkler/spray irrigation is a method to control watering similarly to rainfall.The water distributed through a network consists of pumps to pressurise the water, valves to control the water flow, pipes to distribute the water, and sprinklers to spray the water into the air to create an artificial rain [7], [8].
Drip irrigation is a micro-irrigation system that can save water and nutrients by allowing water to drip slowly to the roots of plants and minimise evaporation [3].The drip irrigation system was designed for hilly and mountainous areas, often with terracing practice.The water is dripping on the soil at meagre rates (2-20 Litres/Hour, most commonly 3.5 L/H) from a small plastic pipeline system, so it only moistens the root zone plant in small quantities but more frequently.It is used to irrigate gardens and trees with a typical pressure range from 0.2 to 2 bars.This system is more efficient but implies more implementation costs [8], [9].
In the valley variable rate irrigation (VRI), the system allows for varying the rate of water applied across fields to suit the needs of crops, soil type, and farm operation.VRI is split into different types of technology to create a more focused approach to watering, save money and improve farms' operation and environment practice like variable individual sprinklers, VRI Zone, VRI Speed, and VRI-EAC [10].
The gravity-fed irrigation system [11] is a cheap, effective way to provide water for a smaller culture area.It would be particularly profitable if the area's climate could provide enough precipitation to systematically keep a reservoir filled using rainwater recovery techniques.The basic system is controlled either by hand or timer that controls the rate of watering.An independent IoT system as part of the SCADA system is an innovative approach exploited in many applications such as irrigation.This system can control valves or pumps, maintenance equipment, storage data, Int J Reconfigurable & Embedded Syst ISSN: 2089-4864  A novel autonomous remote system applied in agriculture using transmission control … (Deroussi Anass) 3 display information such as positions, sensor measurements, and present historical data in liquid-crystal display (LCD) or GUI [12].Recently, the SCADA system exploits new technologies that can ease the supervisory processes and automate solutions for energy-efficient and cost-effective irrigation systems.Among these technologies, the cellular irrigation system provides a wide range of benefits for water treatment and management [7], [13], where they interact with the physical environment through a pivot or linear irrigation equipment.We have a high variable in agriculture like soil infiltration rate, available water capacity, topography, precipitation, and current watering requirements.So, water is needed whenever necessary and only with the amount required by the soil at a specific time [7], [14].Some works related to automated irrigation control, SCADA and IoT systems are briefly described to create an effective system.Sahu and Behera in [4] focus on the automatic control of water, using a motor and selecting the direction in which water should flow in a pipe.A cost-effective prototype connects sensors/actuators to an Arduino UNO and sends sensors data to Raspberry, where data is processed.Then we can monitor the embedded system with a screen to see the current irrigation status and exploit data processed to decide whether it activates or deactivates irrigation.We can send short message service (SMS) or G-mail notifications to the user.
Khelifa et al. [15] propose a new strategy to optimise water consumption.Based on IoT and new communication technologies, developing remote control and monitoring irrigation system using wireless sensor network (WSN) to gather data and smart gateway with routing protocol RPL connects the Zigbee WSN with the internet via 4G long-term evolution (LTE).
Jyostsna Vanaja et al. [16] propose a prototype with a PIC16F877A-microcontroller, a Sim900 global system for mobile communications (GSM) module, and different sensors interfaced for temperature and soil moisture condition and the intruder detection monitoring by the Android Application that shows the temperature, humidity, moisture and the intruder detection.
Podder et al. [17] develop an intelligent aggrotech system to verify urban farming parameters based on ESP8266 NodeMCU, which is feasible if we have wireless fidelity (WIFI), which is impossible for most Agriculture applications, with different sensors interfaced but with a short coverage area.The data transmission from the system to a web server takes inefficient time.
Rao and Sridhar [18] propose a RaspberryPi based automatic irrigation system to improve the productivity of the crop at a low quantity of water based on temperature, the humidity of the soil, duration of sunshine per day and calculate the water quantity required for irrigation.However, in this research, the cost and energy are not taken into consideration.
In our project, we aim to create an IoT system to control and supervise the water consumption of every farmer.For that, our paper proposes and describes the design of an autonomous IoT SCADA irrigation system that takes several limitations of this situation into account.Include that each NewAgriCom device should be stand-alone in every aspect like energy and communication with the server and be placed in every field with cellular network access [15].We consider constraints like complexity and resource that fit our needs; for that, we chose to work with Arduino Mega, unlike [4], [16], [18].Further protection of our IoT devices during stormy weather like rain and sun, reliable communication with the GUI, and transmission of a low rate of data every minute over general packet radio service (GPRS) cellular network, for a long-distance, are taken into consideration.The NewAgriCom telemetry device V0.0 is an embedded system that exploits actuators/sensors.It is based on the Arduino Mega microcontroller programmed in C/C++ language and other shields with other integrated circuits (ICs) to gather, process data, and control the environment.

PROPOSED NewAgriCom ARCHITECTURE
Using the proposed NewAgriCom V0.0 device, water flows are monitored and controlled with minimal energy consumption and low cost.For that, actuators and sensors chosen here are characterised by low cost and energy consumption.To further reduce energy consumption, we exploit an embedded algorithm that interacts with the IoT system to control the sleep mode; furthermore, we use a solar panel to harvest energy.
NewAgriCom devices use SIM808 V3.2 to transmit data via TCP protocol over the GPRS network and send data to the Node.jsserver.As our precision irrigation application has to use the location of the NewAgriCom devices, we use SIM808 V2 to receive the global positioning system (GPS) location as well.

Materiel
As mentioned in Figure 1, using our constrained embedded system [19], NewAgriCom V0.0 proposed device is connected to a solar panel to harvest energy, a latching solenoid valve actuator to control the water follows, and also a Woltmann irrigation water pulse sensor to calculate water consumption:

a. Solar panel
The solar panel chosen is a 20 W/12V POLYCRISTALLIN, which presents the best performance/price ratio and charges the lead-acid battery.These solar panels produce more electricity than other panels during cloudless days because their blue colours allow them to absorb the sun's rays less than the black cells of a monocrystalline one, and therefore, they do not heat up.

b. Solar charging controller
This system includes a solar charging controller 10 A, 12v/24v PWM ,which is considered an automatic regulator for solar panels capable of automatically recognising 12v and 24v lead-acid batteries.

c. Woltmann irrigation water pulse meter
The water pulse meter is connected to a Reed sensor as a passive pulsar.Designed as a potential free normally open contact by a serially integrated magnet within the counter, it closed automatically at frequency proportionally to the flow rate and opened itself automatically again.The typical pulse values are 100, 1000, and 10,000 L/Imp depending on meter size and mounting position.The Reed sensor does not need to be powered and is an ideal partner for additional electronic devices whose energy supply comes from a battery.

d. Latching solenoid valve
The latching solenoid valve has the advantage of consuming power only when switching positions.On the other hand, the standard solenoid valves require continuous electrical power to keep the valve open.So, to control the valve solenoid latch, we use a very short impulsion, which is ideal for low power consumption, generates very little heat, prolongs battery life, and allows fast solar recharging.

e. IP65 waterproof box
Our prototype utilises the IP65 waterproof box as a means of highly protecting the proposed device from solid objects and increasing its waterproof protection.
Int J Reconfigurable & Embedded Syst ISSN: 2089-4864  A novel autonomous remote system applied in agriculture using transmission control … (Deroussi Anass) The GPRS NewAgriCom V0.0 prototype was designed using Arduino Mega and SIM808 modem as a GSM/ and GPS hardware to manage data acquired from the environment and other components.

Prototype
GPS-based applications in precision farming are used for farm planning, field mapping, soil sampling, tractor guidance, crop scouting, variable rate applications, and yield mapping [20].GPS allows farmers to work during low visibility field conditions such as rain, dust, fog, and darkness.In our prototype proposed in Figure 2, we aim to combine real-time data collection with accurate position information and create a reliable communication with the GUI that manipulates a large set of geospatial data.This prototype includes:

a. Arduino Mega
Our embedded code in the microcontroller exploits sensors/actuators to get environment data, SIM808 to have the GPS location, and store data in Secure digital (SD) card.Furthermore, the GPRS modem transmits this data to Node.js.this prototype requires us to work with static random access memory (SRAM) as small as 4 KB and relatively large Flash memory with enough digital and analogue ports.So we chose the Arduino Mega 2560 microcontroller [21].

b. Relays
There are several ways to control valve solenoid latches.An H-bridge appears inexpensive and straightforward, but it does not provide galvanic isolation and generates electrical noise.An alternative solution is to use four relays to build a mechanical copy of the H-bridge, but this could cause damage to the power supply or the prototype circuit [5].Nevertheless, the better solution would be to reverse polarity in two 5V DC relays.They control the valve solenoid latch to open and close with positive and negative impulsion, respectively, without risking a short circuit and spending extra money.The SIM808 V3.2 manufactured by SIMCom is a complete quad-band GPRS/GSM module that works on GSM 850 MHz, EGSM 900 MHz, DCS 1800 MHz, and PCS 1900 MHz, which integrates GPS technology for satellite navigation, GPRS coding schemes CS-1, CS-2, CS-3, and CS-4 GSM and Bluetooth engines and characterised by low power consumption.The compact design that integrates GPRS and GPS in a surface mount technology (SMT) package will significantly save time and cost for customers wishing to develop GPSenabled applications.In this module, SIMCOM enhanced AT cellular commands are used through a serial port to control the module [22].

d. SD micro card
Storing and retrieving data is one of the most critical parts of our project.Moreover, since the microcontroller electrically erasable programmable read-only memory (EEPROM) memory that kept information when the board is turned off is insufficient and has a limited life of erase/write cycles before it becomes unstable, we use an SD micro card.For that, we exploit the serial peripheral interface (SPI) protocol to communicate with an SD memory card (max size: 16 GB) and write or read the information on it.

Energy harvesting
Energy harvesting plays a vital role in increasing the lifetime of our NewAgriCom device [23]; for that, we use a 12v valve-regulated lead-acid (VARB) battery for power-efficient storage.VARBs are rechargeable batteries that utilise absorbent glass mat battery (AGM) with a much longer lifespan than conventional batteries to ensure the strength of solar panels or wind power equipment.A waterproof battery is more efficient than a traditional battery thanks to short connections; moreover, the components provide excellent voltage continuity and require low maintenance.

Power supply and energy consumption
The Solar system integrated into our device harvests energy and fed SIM808 V3.2 with a 12V battery.The SIM808 provides the power supply to a voltage regulator L7809 that power Arduino Mega Vin with 9V.Likewise, it can power the LCD, SD card and control the relay with 5V.In order to estimate energy consumption for NewAgriCom embedded system, we model each component's energy behaviour in the system, both during active and sleep mode.

Cost analysis
Controlling the agricultural environment with IoT irrigation devices typically requires costly equipment.Nevertheless, in this project, for the NewAgriCom development, we exploit low-priced hardware easily bought and implemented in Morocco.Table 1 shows the cost estimation of the hardware used in NewAgriCom V0.0.The cost range of the used hardware in NewAgriCom V0.0 is 40$ to 50$ approximatively, which is a meagre price comparison with other solutions implemented for irrigation monitoring.

Datalogging
As mentioned in this research, we work with the Woltmann irrigation water pulse meter connected to the NewAgriCom device that checks the input state and counts pulses where the number corresponds to water consumption.After NewAgriCom stores data to a stand-alone data logger.Furthermore, when the user sends a scheduling irrigation plan, the NewAgriCom device saves data under a javascript object notation (JSON) file in the SD card as a stand-alone data logger.It compares that Data with the courante date.NewAgriCom executes the command ON/OFF to open/close the valve solenoid latch if the time in the command and the courant time are equal.So, our solution works with two types of data logging: standalone and wireless.
Int J Reconfigurable & Embedded Syst ISSN: 2089-4864  A novel autonomous remote system applied in agriculture using transmission control … (Deroussi Anass) 7 − Standalone data logging: the remote terminal units read the data every minute of sensors and the data camming from the user and save them in JSON format.It can accumulate water consumption, with dates, signal quality, and scheduled commands sent by the user in an SD card integrated with our device.− Wireless data logger: The IoT device sent the accumulated data in the stand-alone datalogger between the last TCP connection   − and the actual connection    to Node.js, then Node.js send the data to the MySQL database over HTTP protocol.

Node.js
Node.js server offers a free JavaScript runtime environment used to create an express API Gateway with [24] was exploited in our project to manage communication between MySQL Database and NewAgriCom in real-time.The data is transferred from NewAgriCom to MySQL Database through Node.js by publishing sensor data in JSON file form and sending the scheduled commands to NewAgriCom device over GPRS using TCP protocol to be executed according to the scheduled commands in real-time.Meanwhile, Node.js and MySQL communicated via HTTP.

MySQL database
A common aspect of all IoT implementations is that they use a considerable amount of data collected from IoT devices [25].Consequently, we need a platform that can handle those data effectively with high availability and excellent performance.MySQL database platform is the best known and viable solution for a system that interacts with IoT.It is exceptionally secure and has a proven track record of handling the large amount of data generated by IoT devices, with high-performance flexibility and availability [26].

Nexmo REST API application
The proposed GUI should have the ability to access the NewAgriCom Device in normal and sleep mode remotely.

−
The normal operation mode has different modes like GSM/GPRS SLEEP, GSM IDLE, GSM TALK, GPRS STANDBY, and GPRS DATA.

−
In the sleep mode of SIM808V3.2, the current consumption is as low as 1.2 mA.
To save energy consumption, we can remotely enable or disable the GSM/GPRS sleep mode to reduce consumption to a minimal level.Where there is no on-air and no hardware interrupt, commutation is disabled to save energy consumption where the module still receives paging messages and SMS.For that, the proposed solution used here is to command the operation mode of the device with SMS messages to make the device in wake up/sleep mode.In this case, to manage the sleep mode using SMS messaging, we based on Nexmo REST API getaway [27].This one allows us to send and receive text messages to users around the globe through simple RESTful APIs.
Note: we choose SMS communication because it is the only solution usable if the NewaAgriComv0.0 is in sleep mode where the GPRS communication is inactive.

Apache server
With Apache HTTP server, we can execute a script developed with hypertext preprocessor (PHP), a server-side scripting language.PHP allows communication with MySQL database; It is needed in a web application stack to deliver web content and create the foundations of our IoT dashboard.

Communication 3.6.1. TCP over GPRS
To transmit data with an embedded system, we shall know if we need to transfer a significant amount of data; if yes, we can use light fidelity (LIFI) or WIFI.If not, we should know about the range of wireless signals that we need.If the coverage is short, we can exploit radio frequency identification (RFID), classic Bluetooth with low latency, or Bluetooth low energy (LE) with Low-power applications.We can use the ZigBee protocol if we need a more extended range despite reducing the data rate.Regarding long-range communication, two solutions available are long range (LoRa) protocol in rural areas and cellular networks in urban areas.
In this proposed work, we use GPRS cellular network because our proposed NewAgriCom was installed in a field located in an urban area and transmitted a low data rate.To do that, the NewAgriCom V0.0 device collects data and transmits it with TCP protocol over GPRS by using the SIM808 under single connection non-transparent mode that supports TCP client, TCP server.So, if we choose TCP Server for each NewAgriCom device, we should have a fixed internet protocol (IP) address and a private access point name (APN) from the internet service provider to elaborate TCP connection.This solution will increase the cost of the proposed NewAgriCom device.That is why in our application, we choose to work with TCP Client connection.To realise this TCP connection, we connect the NewAgriCom device to the GPRS network then we activate the wireless connection.After that, we establish a TCP connection between the NewAgriCom device and Node.js using the IP address and the port number of the Node.jsserver.If the connection is established successfully, we get a response "CONNECTED OK," then send data.If data is sent successfully, it will respond "SEND OK" [28]- [30].The connection through the TCP tunnel remains open to transmit data.If data is coming from the Node.jsserver, the NewAgriCom receives it automatically.After that, the TCP connection is closed, and wireless communication is disconnected.
In this proposed work, we open a new TCP tunnel every minute to check whether the server Node.js works correctly and if the user is connected to the platform.If so, we transmit data over GPRS to the Node.jsserver, which manages communication between the monitoring website and the NewAgriCom device.Note: we chose the TCP protocol because we need reliable communication in our application.

HTTP
We save data in JSON file with Node.js, and then we transmit it over HTTP protocol to upload it in MySQL database.And then, we use the HTTP methods to exploit this data in our proposed dashboard.

Graphical user interfaces
For IoT applications, graphical user interfaces (GUIs) focus on interconnecting end users (EUs) to physical devices called "things."Such things communicate with users to provide services like device management, data collection, processing, and visualisation.The most common drawback of the use of GUIs is complexity.That is why the "ease of use" aspect will be taken into account.Indeed, the proposed NewAgriCom GUI is developed with PHP by using the Laravel and Vue.js frameworks.After login, each user could access their owned devices identified on the map, shown in Figure 3, by their location coordinates and the ID and choose the device to monitor. Figure 3. GUI map After that, using the dashboard illustrated in Figure 4, each user can monitor and know the last communication with the NewAgriCom device chosen, GPRS signal strength, consumption for each month, and each day.As well as control the sleep mode and can change the typical pulse value according to the Woltmann irrigation water pulse sensor that we have.
In the Billing GUI illustrated in Figure 5, after choosing the concerned device, the user can access, visualise, and download All data collected in PDF, CSV, or Excel.Figure 6 illustrates the GUI That We use to schedule irrigation by setting the device id and time to start/stop irrigation at whatever time we need.However, the system experiences some limitations.Like it works just in the area with GPRS coverage and with direct visibility to the sky.The maximum frequency of data transfer is one transfer for each minute from/ to the Node.jsserver.

ISSN: 2089-4864 
A novel autonomous remote system applied in agriculture using transmission control … (Deroussi Anass)  that exploits TCP protocol, then Node.js sends to MySQL database to analyze and communicate data with the GUI used by farmers.Furthermore, the proposed IoT system allows us to create scheduling irrigation based on ease of use GUIs that send control data to the Node.jsserver.The use of embedded solar panels for powering the NewAgriCom station and algorithms to control the power mode leads to balancing the NewAgriCom energy consumption.
A comprehensive set of observations and experiments support the proposal's effectiveness as a complete IoT solution for irrigation.A system like this in the field could improve the energy consumption of the IoT system.In addition, a completely automated irrigation system would provide data in real-time about water consumption in each field, which will help farmers make the right decisions.
For our future perspectives, we think the next version of NewAgriCom will incorporate artificial intelligence (AI) to understand the plants' environment in order to optimize water and energy consumption.Moreover, we can use a NoSQL database for large volumes of data at high speed and create a WSN to monitor each crop.

Figure 1 4 Figure 1 .
Figure 1.The global architecture of the proposed NewAgriCom based on an IoT system

Figure 6 .
Figure 6.GUI for irrigation scheduling To calculate total energy consumption is obtained by summing up the individual energy amounts of each component.The following are Some proposed solutions suggested in this work that can lead to energy efficiency: − With a 9V power supply, the Arduino Mega has a power consumption of 73.19 mA, less than Arduino Uno with 98.43 mA.If we reduce the clock speed, the power consumption decreases to 61.76 mA, and if we use a low-power mode with a 9V power supply, we can achieve a current of 26.87 mA.− With the embedded software in Arduino Mega, we can enable or disable the light sleep mode of SIM808 through SMS messages sent by GUI.Furthermore, to minimise the consumption, if the farmer does not consume water in real-time, we exploit the deep sleep mode of SIM808 and the low power mode of Arduino Mega.
− If the farm starts to consume water, a switch is triggered to exit to normal mode.− It can get in and out of the light sleep mode by sending an SMS sleep respectively wakeup messages.The light sleep activates the decrease of clock speed and deactivates the TCP communication, but it allows communication over SMS with the NewAgriCom device.

Table 1 .
Approximation cost of the used hardware in NewAgriCom V0.0