http://beei.org Design and realization of low-cost solenoid valve remotely controlled, application in irrigation

Info 2022 The remote and automated irrigation system of farmlands can avoid and minimize the waste of water and energy resources. This can be done with the remote-control of the solenoid-valves. A new solenoid-valve was designed and built from a simple valve with a motor and switches. The remote and automated irrigation system can monitor and receive requests via short message service (SMS) or web interface for controlling pump or solenoid-valves connected to the system. After each operation performed by the system, users receive notifications via SMS messages that contain the real-time status of the solenoid-valves controlled or temperature and humidity value. This system was created using Raspberry-Pi as the system control center. It has been connected to several sensors, and raspicam is used to take photo or video capture in real-time after the users’ request, and the global system mobile (GSM) module is a communication interface used to receive requests for controlling the irrigation system or to send notifications to users. A website is also developed for consultation and control of all that it contains in the system remotely. The result of this research aims to build a secure remote and automated irrigation system including low-cost solenoid-valve with Raspberry-Pi based on control and notification via SMS and web-page.


INTRODUCTION
Nowadays, internet connection allows everyone to circle the planet thanks to technological advances [1], [2]. Furthermore, these advances and developments have made it possible to remotely control objects using internet of things (IoT) technology, permitting remote connection and control of objects, such as household appliances in smart homes and intelligent transport [3]. IoT is a very promising technological development to optimize life [4]. The purpose of this paper is to apply IoT to agricultural areas irrigation.
In agriculture, irrigation is an essential process that affects the agricultural production that humanity needs to feed itself [5]. There are two methods of irrigation. The first one is a traditional method that requires the farmers presence every time to ensure the irrigation of the crops. This method is tiring, requires much time, and energy-consuming. The second method uses automated and remote irrigation control, which facilitates several tasks without displacement [6]. In some irrigation systems, automation and remote controls are available, but they are less efficient when used by farmers. That is because the solenoid valves are not compatible with the system, the issue is the solenoid valves which the farmers request have a diameter of 63 mm and this type is not too marketed in Algeria, and the information containing the status of solenoid valves and other sensors values is not displayed or sent in real-time. Information that is not in real-time causes slow manipulation and reaction [7] of the system controlled. Systems use the internet and web server only for remote control access [8].
For that, we need a solution that can display the different values of sensors and the state of solenoid valves connected to the irrigation system and notify the owner in real-time when the irrigation system is controlled. This solution uses IoT technology that requires an internet connection for the user and the system and a use the global system mobile (GSM) network to receive and send short message service (SMS) [9]. The system can be controlled remotely [10] from anywhere by two methods.
In the market and the other related research that has been developed, there are several types of remote irrigation systems that use IoT [11]. However, the advantages of these systems are limited, there are systems that do not offer the addition of the number of controlled devices, sensors [12], or additional functions tailored to the users needs, remote control of the system can only be performed by one user, it also offers only one method of control using the internet via a wireless-fidelity (Wi-Fi) link, if the user cannot connect to the internet [13], it means that the control of his irrigation system will not be accessible and cannot receive any information about his farm. In addition, the solenoid valves available on the market are too expensive.
In this paper, we propose our remote irrigation system. For this purpose, firstly, we have realized a low-cost electric solenoid valve based on a standard valve that is easily found in the market. The advantage is to reduce the cost of the solenoid valve and its consumption of electrical energy. In the second step, we have developed a site web linked to a remote-control irrigation system with admin and user accounts to facilitate irrigation management of large agricultural areas using IoT. The third step is to add the secured control in the remote irrigation system by sending an SMS containing control requests from the phone numbers selected by the farmer. After a successful action, the system sends an SMS to the farmer with the success message. All control requests by SMS from the unlisted phone numbers will be rejected. In addition, a camera is added to monitor the irrigation system and its operation and the monitoring of agricultural areas. The email notification may include images or a short video captured by the camera.
This research will use a GSM module to send and receive SMS messages, and for the internet connection, ADSL or fiber Wi-Fi link will be used, and will also add the USB 3G/4G module, which offers the advantage of connecting to the mobile internet through the 3G/4G network, several sensors such as the temperature and humidity sensor DHT11 [14], [15], and the soil moisture sensor [16] EK1099 will be added. All sensors and modules will be connected to the control center based on the Raspberry-Pi board. The Raspberry Pi is a small and inexpensive board based on ARM CPU technology and supports Linux, this board has possibility to be connected to mini Wi-Fi USB adapter [17]- [19].

DESIGN PROCEDURE
There are several types of project research methods, that provide automated and remote-control solutions of objects or machines. In this paper, we will study a real problem in the lives of farmers, and we follow the chronological research method presented in Figure 1. To begin, a study was carried out. It was possible to identify the problems that arise and the needs of users in this field, the essential points that are identified include: i) The displacement of the farmers towards their agricultural fields to check the water tanks and fill them if necessary; ii) The use of manual opening and closing valves for irrigation of green fields is caused by the lack of 63 mm solenoid valves or its high price; iii) In large fields, the owner cannot monitor workers presence or absence and their activities; iv) The remote irrigation systems are inaccessible in the case of an internet cut, in this case, their control is impossible; v) In case of system restart caused by power failure, for example, the user will not be notified; and vi) The lack of temperature and humidity information.
Secondary, after identifying the essential points of the problems, we proceed to an analysis that allows us to choose the adequate materials that we can use to give them an automated and remote management solution to their problems, and we conclude that the equipment and material requirements that help us to implement a good solution are: i) Raspberry Pi 3 B+, ii) Raspberry Pi Zero W, iii) GSM module, iv) 3G/4G USB module, v) Temperature and humidity sensor, vi) Relay 5 V/220 V, vii) Soil moisture sensor EK1099, viii) Water level sensor float switch, ix) Standard valve 63 mm, x) Two-way AC motor, and xi) Four limit switches: two for 5 V signal and the other for 220 V. The following components: Standard valve 63 mm, two-way AC motor, and tow limit switch are for designing low-cost solenoid valve that can be controlled electrically. Thirdly, we started to write separate programs compatible with the chosen hardware to confirm both the correct functioning of the modules and the programs. Then we proceeded to the assembling of the different programs in a single global program. The implementation, test, and improvement are confirmed in this fourth step, we proceed to configure and setup all the equipment and material with the Raspberry Pi. After getting the final program code, we start to test the irrigation system and fix any bugs if it is present. Finally, after testing and integrating the irrigation system, we collect the results of the system and compare them with the needs of the users (farmers), the system is flexible, and we can add other options if the user requests an update to adapt it to his needs. For example, adding other sensors or option control.

Proposed design and conception
In this paper, we have processed to design an irrigation system controlled remotely, can control opening or closing solenoid valve in the real-time using website or SMS message, notify the temperature, humidity, water level in the tank, and soil moisture. expected to be able to notify the farmers in real-time when any operation is done on sending an SMS message and displaying it on the website. The developed irrigation system is divided into two parts to make a complete system ready to be used in agricultural fields. The first part is the development of a remote-control system to control solenoid valves, and the second part is the design of a low-cost solenoid valve using a standard valve with 63 mm diameter.

Solenoid valve 3D design
The purpose of this part is to show the design of the motorized valve using a standard polyvinyl chloride (PVC) valve. The objective is to make a motorized valve within reach of farmers to set up an irrigation network at a lower cost. A bi-directional motor is required to control the opening or closing of the standard valve electrically. We have chosen to place two gears for a conical position 90 degrees, as shown in Figure 2, all parameter of gears is shown in Table 1, the first gear with nominal shaft diameter (=20) is placed on the valve and the second with nominal shaft diameter (=7) for the motor to control the turning of both directions with unlimited turn, to set the limits turn of the opening and closing of the valve, two limit switch sensors are added. Figure 3 shows the final 3D design of the solenoid valve made using the 3D model software and the support where there is a box to place the control circuits.

. Remote irrigation system
To control the solenoid valves and receive the results from the sensors connected to the Raspberry card, Figure 4 shown all components connected. We have developed a hypertext preprocessor (PHP) web page that provides remote management [20], [21]. The development is done using the Raspberry Pi 3 B + card at a control center, where the Apache2 is installed. The Raspberry Pi board uses the Raspbian operating system. It is based on the UNIX system, which allows us to install and use some packages, like Apache 2, Python, PHP, HTML, and phpMyAdmin [22], to use the Raspberry Pi as server via an HTML and PHP page [23]. Using this board as a web server allows us to control or read its 40 general-purpose input/output (GPIO) ports from the programmed web pages [24], [25]. Two different methods are developed for the remote control of the irrigation system to ensure the systems operation at any time and from any location. The first method is to control the irrigation system by sending an SMS message containing a control message that specifies the nature of the control, Figures 5 and 6 illustrate all details and the algorithm used. When the user sends a message, the system starts with the verification of the phone number to see if it is authorized to control the system or not, then it moves on to check the content of the message, for the "TEMP" message, the system sends a temperature and humidity notification to the user via SMS, and for the "START" message, the system prepares to control the solenoid valves and asks the user to send his command, "Open valve 1" to open the solenoid valve number 1, "Close valve 1" to close the solenoid valve number 1, the '1' is the ID of the solenoid valve, the last status of the solenoid valve saved in the database. A status notification message will be sent to the user at the end of the opening or closing solenoid valve.
The second method is to control the irrigation system using a website, it's programmed using PHP, this web script is hosted on the Raspberry Pi 3B+ where the MySQL Database [26] is also installed. It adapts to the devices (computer, tablet, and mobile) from which we consult the website. It is a dynamic website, the display of content and menus can be adapted to the devices screen size. Our developed website contains two control panels that can choose to login as an administrator or user, where the system accepts the connection of several users at the same time. The website is adapted in a way that it is viewable and usable from a computer browser or mobile phone.

1783
-Administrator control panel side The control page, especially for administrators, contains several tab choices in the menu, the administrator panel menu is shown in Figure 5. Each choice has different functions, a variation of command and function is added to the menu to satisfy a maximum number of users. a. The first tab is the home page. On this page, all the solenoid valve opening and closing operations carried out by the employers (user) are displayed with the date and time of the action (opening or closing). b. The second tab is for managing user accounts. This page allows administrators to add new employers and activate, deactivate or delete their accounts. c. The third tab is the page that allows us to assign the solenoid valves to the employers. This operation allows us to assign a certain number of solenoid valves to each employer to control them by opening or closing them. The administrator can also deactivate the solenoid valves already assigned to the employers. d. The fourth tab allows the administrator to control all the solenoid valves because he has complete access to all the solenoid valves, unlike the employers who have only a limited number of solenoid valves assigned to them. To control the opening or closing of the solenoid valves, all we have to do is click on the buttons (ON/OFF) of each solenoid valve. Once the button is clicked, a value of 0 or 1 signifying, respectively, the closing or the opening will be sent directly to the control database. The python program on the Raspberry board aims to read the values of each button assigned to the solenoid valves in the database to apply the opening or closing tasks by controlling the GPIOs responsible for managing the solenoid valves. e. The fifth tab is the page that shows us the weather informations for the agricultural fields. This is done once the humidity and temperature sensors are connected to the RPi card. All the values measured by the sensors are transferred and recorded in the database. The web page displays all the recorded values with their date and time. When the sensors are not working, the values will no longer be stable. This data will help the administrator know when is necessary to activate his system (opening or closing solenoid valves) [27]. f. Tab number six is the page to consult the live stream captured by the camera that is connected to the Raspberry-Pi card, in order to monitor the areas selected by the farmer. g. Tab number seven is the page to view the SMS received or sent by the system, Figure 5 shows the operation of the irrigation system using SMS from GSM networks for remote control of solenoid valves. At any time, the administrator can leave the account control page by clicking on the logout button. User control panel side For users, we have developed a control panel that contains three parts, the user panel menu is shown in Figure 6. Each part allows to display information or to manage specific tasks by employees. the contents of the menu bar are described as: a. The first tab shows where the user's profile information is displayed, such as name, user, email, registration date, and account activation. b. The second tab is similar to the fourth tab of the administrators controls panel. From this part, the user can control the solenoid valves assigned to his account. When the user commands a solenoid valve (opening or closing), the command is saved and displayed on the administrator's home page. The status of the solenoid valves is displayed in real-time to all users and administrators. If a user opens a solenoid valve, its status will be displayed in real-time to all users who have access to it. c. In the third tab we can see the last operation performed by the users on the solenoid valves assigned to them. This part has been added to remind the user of the last operation he performed if he has forgotten what he did. At any time, the user can leave the account control page by clicking on logout. Figure 6. Software diagram using SMS controlling of irrigation system

Solenoid valve hardware and software
Raspberry Pi 3B+ is installed as a web server, SMS center, and Wi-Fi access point. The user can control the solenoid valve automatically or manually by changing the switch ON-ON shown in Figures 7 and 8 to choose the automatic or manual method. Figure 8 shows the details how work our irrigation system and shows the organigram of the algorithm used to control one of the solenoid valves manually with two buttons or remotely using SMS or from the admin or users panel controller on the website. Raspberry Pi Zero W can connect to the Wi-Fi access point dole out from Raspberry Pi 3B+. When the user chooses a automatique method, the card will be connected to Wi-Fi, it will have the authorization to connect to the database and read the value saved in. when the user controls the solenoid valve from the webpage or using SMS, then the system save in the database value=1 for an open solenoid valve or value=0 for a close solenoid. The Raspberry Pi Zero W read the value in the database and activate the output of the GPIO for opening or closing solenoid valve. As shown in Figure 7 for opening action, the Raspberry Pi ZeroW send the HIGH signal to RPi S1 which activates the NAND gate, then the output of the NAND gate which is connected with the optocoupler U4 (4N25) turns to 1 and activate the relay RE1 passing by the transistor Q1, when the limit switch1 send the HIGH signal to the raspberry pi zeroW the solenoid valve is completely opened, and an SMS will be sent to the user. The optocoupler U7 (4N25), transistor Q2 and the relay RE2 will be on active status for the closing action the HIGH signal in the limit switch2 means the solenoid valve is closed. The optocoupler (4N25) is used for the insulation between the control and the high-power part. When the user chose the manual method, two buttons PUSH1 and PUSH2 shown in Figure 7, help the user to open or close the solenoid valve manually, the green button PUSH1 is for opening the solenoid valve and activate the relay RE1 directly passing by optocoupler U4 (4N25) and transistor Q1. The limit switch3 cuts the 220 V when the solenoid valve is opened, and the red button PUSH2 is for closing the solenoid valve by activating the relay RE2 passing by optocoupler U7 (4N25) and transistor Q2, the limit switch4 cut the 220 V when the solenoid valve is closed.

RESULTS AND DISCUSSION
This part presents all results obtained after testing the low-cost designed solenoid valve and the remote irrigation system. The first model realized of the solenoid is presented in Figure 9, this model has a considerable size caused by the two chain sprockets which need more space in the final assembly, then after many modifications and improvement, a new solenoid valve is produced using and referring to the 3D model presented in this paper, the final solenoid valve model assembled and dismantled is shown in Figure 10. Finally, a real test is done, the solenoid valve is placed on a 1000 L tank, Figure 11 shown the real test of the solenoid valve in opened mode, and Figure 12 shown it in closed mode.
The duration between the start and the end of the opening action is 4 seconds, as shown in Figure 13, but the duration between the start and the end of the closing action is 5 seconds as shown in Figure 14. The difference in duration between the two actions is one second. This delay is due to the force and the pressure of water during the closing.
When the solenoid valve is controlled using the internet on the web page or using SMS requests, the duration of closing or opening the solenoid valve is the same, Figure 15 shown the result of closing solenoid valve and request temperature and humidity using SMS, the system receives the SMS and send the success or failure notification after all action requested. The user can also control opening or closing solenoid valve manually by selecting the manual mode and clicking on the red button for closing action or green buttons for the opening action without passing by the program on the Raspberry Pi Zero W, after the test of this method the duration for opening or closing action is the same with the automatic method shown in the Figures 13 and 14.
In addition, the water level notification is also received from the irrigation system, this option allows to keep the water tank always full by selecting the level that the water pump sets on or off. As shown in Figure 16, the live streaming video works correctly, this option is added to the system to monitor agricultural fields in real-time, it is also possible to monitor the operation of the solenoid valves. Figure 16 shows all the services that the irrigation system can provide. Table 2 show the price comparison between our low-cost solenoid valve with a similar one selected from the market. As shown in Table 2 the cost of our solenoid valve realized is very less than the other.

CONCLUSION
This article, presente the details of the conception, and the realization of a low-cost electric solenoid valve, designed from a standard valve with the aim to use it in the remote irrigation system developed and optimized that can be controlled remotely using the developed web interface or by sending SMS to the irrigation system. The web interface contains buttons that control the motorized valves. In addition, the indicators of the states of different valves (opened/closed), values of several sensors (humidity/temperature), and a history of information containing the operations carried out by the farmer are storing on the database.
This project offers more facilities and saves time and effort for farmers who have farms far from their habitation by a simple click-on button in the web interface or sending SMS from their mobile. Furthermore, it makes it easy to control the irrigation system remotely and notify the user after all operations. It also considerably reduces the irrigation system cost and the energy consumed by the irrigation system compared to the conventional irrigation system.

Benbatouche Abdelhamid
he graduated from the Tahri Mohammed University of Bechar, Algeria, in 2014 with a Licence degree in General Electronics and in 2016 with a master degree in Digital Communication Systems. His areas of expertise include embedded systems and telecommunications, smart systems based on IoT technology. He can be contacted at email: hamid.bat.91@gmail.com, benbatouche.abdelhamid@univ-bechar.dz.

Pr. Kadri Boufeldja
was born in Bechar, Algeria, in 1972. He received his Ph.D. degree in 2011, from the Abou Bekrbelkaid University in Tlemcen (Algeria). Since 1999, he joined the Electronic Institute in Bechar University (Algeria), where he is now an associate professor. His research interests include modelling and optimization of antenna array, heuristic algorithms, and renewable energies. Actualy he is working on the design and realisation of a smart systems based on IoT technology. He can be contacted at email: kadri.boufeldja@univbechar.dz.