{'fraction_non_alphanumeric': 0.02774117483875442, 'fraction_numerical': 0.00984811706775782, 'mean_word_length': 4.777243589743589, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Application of Self-Managing System in Greenhouse with Wireless Sensor Network

It is well known that the Wireless Sensor Network (WSN) is a part of different fields of modern life (self-managing life). The automation of operating the WSN without any need for human efforts develops the technique used in this network in terms of power consumption, costs, and so on. In this paper, the WSN application that adopts the self-managing property is presented as well as applying this property in a greenhouse as a case study. It uses remote controlling technology for data exchanging in a multi-layer WSN. Different hardware and software equipment have been employed in the application based on self-managing techniques. Such hardware includes (NodeMCU ESP8266) as a microcontroller, Raspberry pi3 as a base station that captures the sensor reading from the node. Additionally, it was utilized two types of sensors (DS18B20, soil moisture) to sense the environmental parameters such as temperature and soil moisture and two actuators (LED1, LED2). The results show the proper performance of the presented WSN in terms of the self-managing side by checking the received data in real-time mode. These results are achieved for the threshold values of 25oC temperature and 500 soil moisture as an upper level for operating the actuators.


I. INTRODUCTION
Wireless sensor network (WSN) has witnessed a thriving growth of many innovative applications, including smart homes, military, and medical applications, etc. [1]. WSN is a low-cost wireless network composed of thousands of intelligent sensor nodes. These sensor nodes are used for sensing physical or environmental factors of the supervised areas. These areas may be either open or close. Therefore, it is difficult for human capabilities to control and monitor the functioning of sensor nodes well. As a result, the self-management system is required to automatically monitor and manage the work of the sensor nodes.
In these systems, each sensor node is self-responsible for sending the data that it senses to the base station, which in turn takes the necessary decision to process the received data and control the network correctly. These sensor nodes contain batteries that will be exhausted over time to become unable to communicate. Therefore, external batteries must be provided with the internal battery of the node to ensure an increase in the life of the system [2]. In this paper, a self-management system is used to monitor and manage environmental factors, such as temperature and soil moisture for the greenhouse shown in Fig.1 to get top quality and efficiency of crops [3]. This is done through continuous monitoring of the above-mentioned environmental factors [4], and taking the appropriate decision to maintain a balanced environment inside the greenhouse. This paper is organized as follows: section II introduces the related work in which we address the researcher's work, section III presents our proposed system of the greenhouse with a wireless sensor DOI: https://doi.org/10.33103/uot.ijccce.21.1.5 network to monitoring and managing the environmental parameters like temperature and moisture, section IV gives the obtained results, section V includes a conclusion.

II. RELATED WORKS
In this section, a brief review is presented for appointing the focuses areas in the greenhouse environment or even in any environment. This is to cover the subject and find out the developments in the WSN.
In [5], the authors proposed system of the greenhouse using IoT and cloud computing. There were numerous strategies accessible for the exactness horticulture to screen and control, environment for the development of numerous crops. Greenhouse was the most excellent arrangement to control and oversee all these problems. The authors presented a system that used IoT input devices (sensors), IoT cloud, IoT output devices (actuators), and Zig bee protocol. The action was done under a particular condition to build a suitable environment for the greenhouse. In [1], the authors proposed a system for monitoring patients in hospitals. They used Arduino as a microcontroller to analyze and process of the data and sent it back to the base station, in addition to Raspberry Pi as a server. The results are store as reports and other patient data in the database and display them on the website. In [6], the authors used Global Mobile Communication System (GSM) modem to send Short Message Service (SMS). These SMS displayed the climatic factors and Ethernet status present of the IoT-based greenhouse surveillance and control system. The center heart of the system was Arduino as a main controller. The PH sensor is a gauge of soil PH. Arduino Ethernet shield is used to help the board to connect to the internet. When the sensor value was greater than a standard value, the GSM sent an SMS to the user. The user turned on the motor by transferring another SMS. All climatic factors were sent to the server via Ethernet and saved in the database. The user could check and manage factors via a smartphone android program.
At the other side, in [7], the authors proposed a design to monitor and control the temperature and humidity of the soil for the greenhouse. They used the Arduino platform as a microcontroller, and Atmospheric Sensors. The microcontroller sent the sensor reading which was captured from a corresponding sensor to f Web server using IoT. In [8], the authors in potato farming proposed a system based on WSN that track of the individual crops and needs. Farmers could also theoretically recognize different fertilizers, irrigation, and other criteria. They designed an irrigation control model using computational equations and smart humidity sensors to approximate agricultural parameters. Laptop computers or PDAs are the devices used for Surveillance. In [9], the authors proposed WSN system that consists of Raspberry pi as the main processor and the different types of sensors. Besides, they provided a regular source of power to the network. Moreover, they used Raspberry pi as the base station that sends data using Internet of Things (IoT) to Web Server database.
For more precise information, in [10], the authors suggested designing a low-cost, low-energy consumption system to measure and monitor temperature, humidity, and light intensity of the DOI: https://doi.org/10.33103/uot.ijccce.21.1.5 greenhouse. Therefore, they used different types of sensors (DHT11, soil moisture, LDR). A cooling fan, artificial light, and motor pump are connected to Raspberry-pi3. Besides, they used Raspberry-pi3 as a processor of the sensors' data with IoT. As a result, these data captured by Raspberry pi3 to be sent to the application that allows to interface with the greenhouse controller. In [11], the authors created a model that was comprising a sensor arrange (SN) based node. They also used Raspberry Pi-based inserted framework (ES) to screen the climatic parameters with temperature, soil moisture, carbon dioxide, and lightly concentrated inside a greenhouse environment. Raspberry Pi based ES was coordinated with internet-of-things (IoT), named as Thing Speak. They utilized sensor nodes to record climate parameter information being sent to the gateway. The gateway nodes transmitted this information to the farming proficient through a web browser over the web. Based on the information they obtained, Raspberry pi3 made a decision to operate the corresponding LED to maintain a suitable environment for the greenhouse. In [12], the authors proposed system that was built using WSN to smart forest monitoring. The proposed system adopted Zig bee as a wireless communication system for the local area network. Arduino UNO ATMEGA-328 was used to be connected with three sensors to identify theft, fire alarm, and drop off tree detection, which collects the data captured from these sensors. They designed the output system to prevent theft, fall tree with alarm, and support for location determination service (GPS). In [13], the authors designed the IoT gate as a system point for a WSN. The WSN worked to collect, analyze, and process data remotely. This system was based on LAN, GPRS, EDGE, and 3G. Besides. Authors used Arduino as the embedded system and ESP8266 as the IoT gateway. They stored, monitored, processed, and controlled data in real-time to improve the ability and smart greenhouse monitoring.   Fig.2. shows the block diagram of the presented prototype monitoring system for greenhouse that deals mainly with two types of environmental parameters which are temperature and moisture as parts of WSN. These parameters are captured through corresponding sensors to managing a greenhouse environment. Open-source hardware platforms are utilized in this system which are a microcontroller (NodeMCU ESP8266), a microcomputer (Raspberry pi3), two sensors (DS18B20 and soil moisture), and two actuators (LED1, LED2). To send data between NodeMCU and Raspberry pi3, a Wi-Fi connection and transport protocol are applied. The Message Queue Telemetry Transport protocol (MQTT) is utilized, which is built within the best TCP/IP protocol and a publish/subscribe protocol. The NodeMCU is used to receive the sensed data through the mentioned sensors to be sent back to the Raspberry pi3 through a local area network utilizing the built-in protocol, MQTT. When a successful connection is obtained, the NodeMCU publishes the received data every 5 seconds to the MQTT broker. Besides, the broker sends back these data to the Raspberry pi3 that is acting as a base station.

III. THE PROPOSED SYSTEM
The base station receives and processes these data. The managing procedure is done here by checking the received data in real-time mode. Under a certain condition for the temperature and soil moisture, the base station responds the NodeMCU using a subroutine built in python programming language. Based on the received message from the base station, the NodeMCU can turn on/off the corresponding LED. Fig. 3 shows the hardware components of the implemented prototype. Fig. 4 explains the whole and flowchart of the presented monitoring system of greenhouse that can be summarized as: 1. Initializing the hardware connections. 2. Initialization of hardware components over MQTT protocol. 3. Reading the sensors' values to be sent to the base station (Raspberry pi) using the NodeMCU as a local controller. 4. Checking the temperature and soil moisture readings, if they are below the lower thresholds the turn on signal is sent to the corresponding LED that represents an actuator. Otherwise, the system checks the request of continue or not to repeat the operation or finish the algorithm.

IV. RESULTS AND DISCUSSION.
As mentioned above, the sensor node (NodeMCU ESP8266) is connected with the base station (Raspberry pi3) within the local area network, by getting the static IP address of the MQTT server on Raspberry pi3 to send data that have been collected from temperature and moisture sensors. Fig.5 represents the serial monitor that shows all the values of sensors, that is sent from the sensor node so that the messages that received it from Raspberry pi3 about running the actuator (LED1and LED2). This figure explains the performance of NodeMCU that does two jobs: collecting the sensor readings and controlling the operation of LEDs. It is important to note that the controlling signals of turning on/off the LEDs is generated by the base station (Raspberry pi) after receiving the readings of related sensors.   6 shows the Raspberry pi3 window which is remotely accessed by the VNC viewer platform, that installed on the PC. Through this platform, a python code is responsible on displaying the temperature and moisture sensor readings via the MQTT broker. When the temperature rises over the set value of 25°C, the actuator LED1 is turned on. While, when the moisture's value is more than 500, the LED2 is also turned on by the sensor node to maintain a specific value of the sensors inside the greenhouse. Fig.7 shows the operation of LEDs, where the blue for temperature actuator and red for mositure actuator. Fig.8 shows a chart of the temperature values and the operating case of the LED1 for 24 hours time period. The LED1 operation is based on crossing the temperature threshold that has been assumed to be 25ᵒC. When the temperature is increased by 25ᵒC, the LED1 is turned on as an indicator for operating temperature accuracy. While Fig.9 shows another chart of the moisture values and the operating of the LED2 for 24 hours time period. The LED2 operation is designed to be work when the assumed soil moisture acrosses the threshold value, which is 500. It is clearly shown in the presented results above that the proposed system works in real-time with full operation of self-management. The sensor readings were sent to the Raspberry Pi as a base station for the underlining WSN. While the base-station controlls the operation of actuators in a prober and fast DOI: https://doi.org/10.33103/uot.ijccce.21. 1.5 way. The transition between the on/off operation of the actuators proves the ability of the proposed system in managing the faced operation cases that were based on surrounding situations.

V. CONCLUSION
In this paper, it was presented a greenhouse monitoring system based on WSN. This system deals with the two types of sensors which are temperature and soil moisture, which capture the temperature and moisture of the greenhouse respectively. The captured data have been sent to the base station in a real-time mode which is represented by a Raspberry pi. The managing procedure is done by the base station according to the received data and MQTT protocol. The action is done under a particular condition to build a suitable environment for the greenhouse. From the operation of the proposed system over the studied cases, high sensitivity was shown to the changes in temperature and soil moisture in real-time, in which the right actions were taken. On the other side, The data and information exchanged between the nodes and base-station of the considered WSN were self-management as a highlighted action to MQTT protocol that manages the data flow avoiding any congestion and traffic in this network. The results obtained from this work proved the mentioned high sensitivity of the proposed system to the changes in sensor reading and produced the correct actions to the actuators.