IoT Enabled Sustainable Automated Greenhouse Architecture with Machine Learning Module

Department of Computer Science and Engineering, Karpagam Academy of Higher Education, Coimbatore, India Department of Computer Science and Engineering, G. Pulla Reddy Engineering College, Kurnool, Andhra Pradesh, India Department of Electronics and Instrumentation Engineering, Easwari Engineering College, Chennai, India Institute of Information Technology, Saveetha School of Engineering, Sriperumbudur, India Department of Electronics and Communication Engineering, R.M.K. College of Engineering and Technology, Thiruvallur, India Department of Biomedical Engineering, Karunya Institute of Science and Technology, Coimbatore, India School of Electronics Engineering, Vellore Institute of Technology, Chennai, India Department of Mechanical Engineering, M. Kumarasamy College of Engineering, Karur, India Department of Chemical Engineering, College of Biological and Chemical Engineering, Addis Ababa Science and Technology University, Addis Ababa, Ethiopia


Introduction
Sustainability of agriculture in a closed-field environment is improved by the contribution of fertigation and microclimate control and automation in greenhouses. This has helped in increasing the profit and yield of agriculture while reducing the energy, fertilizer, and water requirements [1]. The conventional offline techniques are replaced with cloud-based and wireless architectures in modern farming enabling environmental monitoring [2]. Along with yield prediction feature, the most efficient greenhouse production is made possible with the advanced sensing technologies. Automation engineers make use of Internet of Things (IoT) and other digital technologies for the customization of greenhouse applications. Mobile devices with secure Internet connection can monitor and control the greenhouse environment on a real-time basis along with the IoT based and wireless sensor devices [3]. Automation of greenhouses has significantly decreased the energy consumed for monitoring the crops. The operation of each sensor and device placed in the greenhouse functions in such a manner that there is no wastage of energy. Greenhouse energy is one of most challenging aspects of agriculture, and with the aid of IoT and big data analysis, it has become a possible feat to achieve. This will play a major role in saving energy at a global scale.
The external as well as internal data can be monitored by growers with knowledge-based automation software that is installed in a central computer for transmitting the data from multiple sensors. Based on these sensor data, the necessary changes can be performed on the real-time environment to improve the crop yield. In fertigation solution, the pH, electrical conductivity (EC), flow rate, and other aspects of irrigation are monitored by the fertigation control system [4]. The collected data along with external variables like climatic condition and solar radiation can be used for modeling the artificial intelligence algorithms so as to generate real time triggers and commands for switching certain processes or turning on/off specific pumps to alter the greenhouse environment. The data fed to the control algorithms and the monitoring system flexibility are the key aspects that contribute towards the effectiveness of the automation system.
Disease prevention in crops can be achieved by the greenhouse management system with continuous sensing, data sharing, and communication between devices in commercial greenhouses [5]. Up to 50% of crop yield loss can be caused by mildew fungi and other such greenhouse crop diseases [6]. The development of these fungi is aggravated due to high temperature, fog, extensive rainfall, humid, and hot tropical climatic conditions [7]. The future conditions can be predicted by the growers, and the right actions can be applied before any uneventful outbreak in the greenhouse environment using mathematical models that are integrated with the IoT-based sensor data [8].
Before the actual cultivation, the microclimate parameters are evaluated, and the growers are provided with a framework of the greenhouse design, alternatives, and other covering materials required. The sensor layer, software layer, and physical layer are wirelessly linked in this scheme for data transmission through offline or real-time processing to a central base station with the help of standard communication protocols. Within the sensing coverage, connection reliability and precision accuracy are achieved with the help of this approach. In greenhouses that produce crops in all seasons, during continuous monitoring, it is essential to achieve low power consumption for the system to be considered efficient. The wireless monitoring framework is affected by the greenhouse environment that includes the internal and external physical conditions in addition to the communication algorithms and the characteristics and specifications of sensors.
Due to the shrinking farmlands, unsustainable conventional farming practices, and increasing food demand, the urban farming systems have emerged over the recent years [9]. Some of the commonly used techniques include indoor farming and vertical farming. Urban farming also makes use of aquaponics and aquaculture. However, in order to transform the farming system, these strategies are insufficient. It is essential to incorporate the technological solutions and advancements to achieve the maximum benefit of these systems [10]. The long-term viability of the industry is impacted by smart agriculture that is infused with artificial intelligence (AI) technology. AI can be used in several domains of agriculture such as livestock management, disease detection, plant development, weather forecasting, irrigation, and soil management. The effect of the AI algorithms on the system performance is analyzed by several researchers while various sizes of AI approaches are examined.
In manufacturing industry, innovation and adaptation are of significant importance as initialized by [11]. In agricultural production, the use of new technology is an influenced by this development. Sustainable development is achieved with the use of smart production technologies in agriculture which directly impacts the global prospects of manufacturing. The machine learning (ML) and AI research articles regarding the agricultural and manufacturing industries are systematically analyzed. Extensive research and development in the field of AI along with ML approaches contribute towards achieving sustainable manufacturing.
In the organic agricultural product purchase process, the success of green customers is influenced by certain factors that are analyzed and evaluated by [12]. The manufacturing techniques and their corresponding purchasing pattern affect the health benefits which are analyzed by certain parameters of relative importance. Green consumer choices in organic agriculture are influenced by these parameters. When compared to nonorganic products, green products offer more health benefits. Compared to consumers that purchase organic products on a monthly or weekly basis are larger than those who purchase organic products on a daily basis as indicated by the regression analysis.
In order to increase the profit and overcome the production uncertainty, microclimate analysis and closed-field agricultural products are explored by [2]. In agricultural greenhouse systems, the assessment of microclimate parameters in a model-based setup with IoT application is presented in this paper. The microclimate parameters are evaluated dynamically to compare the green spaces using a revealing measure such as comfort index in this study. The processing of crop-growing environments is explained, and a better understanding is provided to the farmers using a simulation model with IoT sensor nodes.
Greenhouse crop production can be enhanced, and the control systems can be optimized using the results of this work. For privacy and security enhancement in green IoTbased agriculture, a threat model (TM) has been introduced by [13]. In smart farming environment with IoT, the privacy and safety issues are analyzed and addressed in this work. Integrity, availability, con-property, authentication, and privacy assaults are addressed by the threat model in the green IoT farming module under various classes. The research on smart farming privacy and security issues, potential strategic solutions, and advancements is highlighted in the survey [14]. 2 Journal of Nanomaterials Cloud-based architecture is used for data collection, storage, and processing in wireless greenhouse systems that monitor the environmental parameters with the technology shift from conventional offline systems. The greenhouse monitoring system performance is enhanced with the use of remote systems in commercial and prototype models. Local controller-based distributed data acquisition and management [15], field router systems [16], field server-based monitoring [17], wireless sensor networks [5,18], IoT, cloud-based and web-based data collection, supervision, and control systems [2,3] are some of the common examples of such models. [19] presents a comprehensive comparison of the agricultural research related to remote monitoring systems. Wireless communication is a crucial component of the IoT sensing and control systems that establishes connectivity between the devices and the Internet. Coverage range, sensitivity, and frequency bands are some of the parameters that are compared in the greenhouse industry to evaluate the wireless communication systems. The reliability of data transfer can be checked using the network health analyzer software.
Energy consumption is controlled using the proposed smart energy management system apparatus in [20]. The consumption pattern is analyzed in the customer's area using the smart meter that collects the data. This data is compared with the threshold value, and the device power consumption is controlled automatically. However, this work does not address the data processing and storage infrastructure. Zigbee protocol is used for monitoring the energy consumption in wireless networks by Jinsoo et al. in [21]. When the cluster head fails, the data loss at the cluster head is caused by the aggregated values of the data collected from the sensor nodes. Bridging is not established between the transport layer TCP/IP stack and Zigbee in this network making it not scalable, which is a major drawback of the system.
The consumer is provided with an aggregated energy report in a smart home service with hierarchical architecture where the device sensors are interfaced with a controller system [22]. Hypertext Transfer Protocol (HTTP) and Message Queuing Telemetry Transport (MQTT) protocol are compared and analyzed for determining the efficiency by researchers. However, for the analysis of voluminous data collected by the network, an efficient big data analytical technique has not been incorporated in this architecture. Home Energy Management System (HEMS) architecture with power line communication is introduced in [23]. Along with the device status, real-time energy consumption data is also provided and monitored by this system. The MQTTP and other such light-weight communication protocols are not supported by the HTTP protocol in this design making it difficult for scaling up the system. The energy management system presented in [24] makes use of the MQTT communication protocol. Reporting, dashboard visualization, business intelligence, and analytics are incorporated in this system. The nation level and regional utility providers are also implemented with energy management provisions in this system [25].
In [26], Tomar has designed novel photovoltaic-based greenhouse architecture. This methodology proved to be efficient in terms of energy efficiency and power generation. Similarly in [27], the authors have proposed architecture of distributed sensor system for automated greenhouse complex. Here, a mobile application was designed to intimate the user on the various activities taking place in the greenhouse. (iii) dht11 and lm35 to maintain the apt temperature for optimal crop growth and maintenance (iv) Artificial LED and LDR to maintain correct exposure of crops to the required amount of light (v) To monitor the input from the sensors, record the readings and further take necessary actions using blynk, ThingSpeak, and NodeMCU

Proposed Work
The data obtained from the different sensors are stored using ThingSpeak while blynk is used to collect the data and can also be used to control the devices like motor, fan, light, etc. remotely using the Internet. Figure 1 represents the block diagram of the proposed work.

Energy Management.
Soil management is performed using soil prediction, and high accuracy is required for this methodology. Hence, machine learning algorithms are highly recommended to be used for soil learning purposes. Similarly, management of irrigation also plays a key role in maintaining the quantity and quality of the crops. Irrigation management and development is carried out in such a way that based on visual observation, the system is able to analyze where, when, and how much water is required by the soil. To support this system, weather predictions, evaporation data, precipitation data, and soil moisture level are evaluated. A proper balance in agricultural and hydrological processes and climatic conditions is essential to ensure efficient irrigation and agricultural sustainability. Figure 2 shows that a split-core transformer is used to capture the current passing through every device by clipping it to the neutral/live wire. A NodeMCU cannot be connected with 230 V AC current directly. The acceptable range of voltage of a NodeMCU is 0.5 V. Hence, the 230 V AC current should be converted to an acceptable voltage using a burden resistor and voltage divider circuit. The voltage thus obtained is provided to the controller analog input pin. The number of appliances supported by a controller is 3 Journal of Nanomaterials determined by the number of input pins available in the system on the chip (SoC) that can be used for interfacing. The reading thus captured is used to calculate the amount of power consumed by every device and is further sent to the Wi-Fi module.
To establish a proper synchronous communication between the Wi-Fi and the controller module, the transmission format includes an indicator which indicates the commencement of transaction post fixed by value of the power calculated from the devices, with an identifier between two devices, followed by a delimiter. On the other hand, the noted bill amount and the total power consumed are present in the Wi-Fi module. The data thus gathered is then segregated depending on the applications and sent to the Firebase cloud. The data is sent in Javascript Object Notation (JSON) format which is language independent and can be used as a lightweight intermediate data format. In general, cloud computing is used to collect, analyze, and store data gathered from the sensors in agriculture data. Here, a cloudcomputing farming management system is integrated with machine learning algorithms to analyze that information gathered from the farm.
Interfacing the dashboard with the cloud platform, it is possible to analyze the power consumed by the system using the data available on the cloud. For better user application,    Journal of Nanomaterials both electricity bill and power consumed can be monitored with a mobile application. The primary objective of the mobile applications is to monitor the power consumed on a periodic basis, and when the level reaches a predefined threshold value, an alert mechanism is triggered. This type of monitoring provides a clear picture to the users regarding the power consumption pattern, thereby helping them scrutinize their usage of electricity. However, the consumption analysis will not be the only contributing factor in energy consumption. Time-based and motion-based actuation techniques are also used to evaluate the amount of electricity wasted instinctively. These techniques will enable proper use of appliances and prevent unnecessary loss of electricity by turning them off when they are not in use. A relay is used to interface the appliances with the controller input. This is transferred on to the web service where it is linked to an alerter platform. The configuration of the same is designed in such a way that when the time limit is reached, it will directly initiate turning off the device.
To monitor the environmental parameters within the greenhouse, we have used cloud-based data collection mechanism which is carried out in a wireless fashion. Several remote systems have been recently used for this purpose, and we have incorporated the IoT-based data collection module to gather information inside the greenhouse. The data thus gathered should be in a continuous block for time-series-based algorithm. But a significant chunk of data goes missing due to IP address change, MQTT, and Wi-Fi. Hence, the blocks which have the longest interval of data without any discrepancies such as discontinuity are used as the training sel while the other data is used as validation set and other test sets.
However, when a discontinuity occurs with data missing for about an hour, the missing data is filled with the help of previous data automatically. For data that is missing for 4 hours, a manual verification is done, and data is inserted from another similar interval. However, when the data is missing for more than 4 hours, the day is removed. Hence, normal and abnormal points are to be clearly identified, and data cleaning is essential.

Results
The basic circuit of the proposed work indicates the presence of several sensors which make use of relays for switching and are linked with NodeMCU. Under the right conditions, the following outputs are observed for each sensor. Figure 3 indicates the amount of moisture present in the soil. Prior value is set to define the moisture content such that when a decrease is detected below the threshold set, it will automatically trigger the water pump to operate. The values recorded using the soil moisture sensor are controlled and monitored using blynk and ThingSpeak. Hence, many sensors are installed in various places of the greenhouse or in various patches which are monitored using the data collected as shown in Figure 3.

Temperature and Humidity.
Humidity places a crucial role in helping the growth of the plants. In fact, even when the weather is not favourable, the right maintenance of humidity will be sufficient to maintain and grow all types of plans. Sensor DHT11 is used to continuously monitor the temperature and humidity level of the greenhouse. When the humidity or temperature of the greenhouse drops below the set threshold, fans inside are switched on to ensure that humid air and warmth leave the surrounding, ensuring optimal conditions for plant growth. ThingSpeak is used to store the information read from the sensor as shown in Figures 4 and 5. If the maximum temperature within the greenhouse is set as 28°C, then when the temperature exceeds, exhaust fans are switched on. Simultaneously, a notification message is also sent to the control engineer.

Conclusion
In this work, an IoT-based intelligent soil management system is designed to monitor and manage the soil, enabling it to be suitable for agriculture and crop growth. Here, the values from the sensors are read periodically with the help of the integrated IoT platform. For each node of the sensor, the durability and performance of the IoT platform will vary, with respect to the energy consumption of the nodes. In this work, the moisture content, temperature, and humidity level of the greenhouse are monitored, and appropriate steps are initiated as and when necessary. This methodology serves as a solution that enables information gathering and crop growth monitoring in the agricultural and food industry.

Data Availability
The data used to support the findings of this study are included within the article.