Intelligent greenhouse monitoring and control scheme: An arrangement of Sensors, Raspberry Pi based Embedded System and IoT platform

Objectives/Methods: The conventional farming approaches have been found unable to deliver an appropriate quantity of fertilizer. Similarly, no explicit measure can be established to regulate the climate parameters. In this study, we have developed a prototype comprising a sensor network (SN) based node, Raspberry Pi based embedded system (ES) that is active to monitor the climatic parameters with air temperature, air humidity, soil moisture, air carbon dioxide, and light intensity within a greenhouse environment. Raspberry Pi based ES is integrated with internet-of-things (IoT) analytics, termed as ThingSpeak, and sensor nodes are physically placed in a greenhouse environment to record climate parameter data being forwarded to the gateway. The gateway nodes direct this data to the agriculture professional(s) through aweb browser over the internet. Findings: Based on the received data, the ES triggers the intelligent decision-making by implementing appropriate arrangements to regulate climate parameters. For example, the greenhouse climate is controlled through switching ``ON'' certain devices i.e., lights, water sprinklers/exhaust fan, and fan. We deliberate that the proposed scheme can be implementable at a bigger scale without any difficulty and it will be much advantageous for an increase in sustainability, productivity, and profitability of a farming system. Novelty: Up to the authors' best knowledge, it is the first wireless deployment of ThingSpeak analytics for a smart greenhouse environment by using the Raspberry Pi. The main advantages of this intelligent crop monitoring system include uninterrupted mobile monitoring of the greenhouse, improved crop yield and productivity, negligible human interface/dependency. https://www.indjst.org/ 2811 Arshad et al. / Indian Journal of Science and Technology 2020;13(27):2811–2822


Introduction
Impulsive climate variations play a crucial role in crop letdown (1). Consequently, the damage fallouts result in farmers' incompetency to pay back the loans that turn life-threatening to farmers as it leads them to commit suicide (1) . To control this swelling issue, the advancement in agriculture atmosphere has been recommended as a leading need (2). These days 'greenhouse' notion is an extensively recognized system to encounter food inflation for both seasonal and unseasonal vegetables, fruits and other crops. However, it is limited to greenhouse farming only, and also lacks automatic governance of environmental parameters (3)(4)(5)(6)(7)(8) . In addition to an old-style farming setup, the deployment of an internet-of-things (IoT) system could help to control all climate parameters automatically without any human intervention and the agriculture professional could monitor these parameters remotely with the help of an internet web browser (9) . Setup of the IoT system includes sensor network (SN), an embedded system (ES) that could control devices, fetch data from the computer and send it to an online IoT platform such as ThingSpeak (10) . An SN based arrangement was deployed in (2) to detain allied requirements for a potato crop. The deployed arrangement was predictable to assist the farmer in irrigation at an appropriate time and in the selection of a suitable fertilizer. A precise model sideways along with an intelligent humidity measurement sensor was developed as an irrigation management prototype to estimate climate constrictions in (11) . Moreover, in (11) authors have offered a wireless sensor network-based mechanization scheme in a red-berry farmhouse by deploying temperature sensors, and deployed a general packet radio services (GPRS) gateway for transmission of data. A similar model has been deployed in the sugarcane field that is also based on an energy-efficient SN (12) and has been deployed as a theme of IoT (13)(14)(15)(16)(17) . Further, device automation has been proposed in (18) , for which, actuators, camera, and ZigBee network were installed to govern an automatic irrigation system utilizing real-time field parameters. Similarly, (19) has focused on the auto-irrigation system using IoT based smart system and a moisture SN. Furthermore, energy-efficient sensor nodes (i.e., air temperature, air humidity, soil moisture, air carbon dioxide, and light intensity) with smaller memory have been used in (20) . These days, the main emphasis of the research is to assess the limitations of SNs for innumerable environments (i.e., health, education, defense systems, agriculture, and monitoring) and communication protocols (21,22) .

Contribution and Proposed System Model
Many archetypes of agriculture monitoring systems have been projected recently (23)(24)(25)(26)(27)(28) but most of them are failed in the assessment of parameters in real-time greenhouse scenarios (23,29,30) . To this, the present study deliberates a greenhouse scenario where environmental parametric data has been gathered using a sensor node. The data is further sent to a Raspberry Pi based control unit (CU) for intelligent decision-making to regulate these parameters accordingly. The key contribution of the current study is to propose, design and evaluate an automatic crop monitoring system at lab scale archetype which monitors and makes decisions intelligently to regulate climate constraints as per the condition. The proposed implementation practices a wirelessly operated intelligent farming organization to upsurge the yield of crops by automatically controlling climate parameters. A variety of sensors have been deployed to gather imperative data of climate constraints i.e., air temperature, air humidity, soil moisture, air carbon dioxide, and light intensity. The instantaneous status of these constraints is vital to produce a precise inventiveness during farming. The projected framework is SN and IoT based deployment to adjust values of climate parameters. The deployed SN is power efficient, optimized in volume, multi-functional and low cost (31)(32)(33) . The sensors are connected to a single node and placed randomly on desired locations for data collection that is further accelerated to the gateway. The gateway sends this data to agriculture professionals through the internet. Based on the received information, the ES triggers intelligent decision-making by implementing appropriate arrangements to regulate climate parameters. For example, the greenhouse climate is controlled by switching ON various devices e.g., lights, water sprinklers/exhaust fan, fan, etc. Figure 1 displays an overview of the proposed hierarchy of the developed system.

Materials and Methods
The climate and fertilizer play a dynamic role in crop growth and yield; but, the former one can be a source of environmental pollution that could cause in the form of imbalance in climate parameters and consequently, it can damage crop nutrients. The disproportionate amount of fertilizers could instigate eutrophic in underground water streams and marinade the field with inorganic elements. Therefore, it is indispensable to use the appropriate amount of fertilizer by providing an intelligent/automatic regulation of climate parameters such as air temperature, air humidity, soil moisture, air carbon dioxide, and light intensity.
To accomplish this, we are aimed at the proposition of a smart greenhouse scheme observatory arrangement with the deployment of SNs and IoT based system. An elementary organizational proposal of the projected structure is shown in Figure 2. In this study, we have integrated a Raspberry Pi based ES with IoT analytics (termed ThingSpeak). Up to authors' best knowledge, it is the first wireless deployment of ThingSpeak analytics for a smart greenhouse environment using a Raspberry Pi board-based ES. The ES is proficient to compare climate parameters with pre-set threshold values and capable of decision-making to turn ON /OFF devices intelligently to regulate unstable climate parametric values. Furthermore, the received information from different sensors is transmitted to the internet web browser to monitor the status of devices on a graphical user interface (GUI) provided by ThingSpeak analytics. The main advantages of this intelligent crop monitoring system include: 1) uninterrupted mobile monitoring of the greenhouse, 2) improved crop yield and productivity, 3) negligible human interface/dependency that lessens the labor cost, 4) secured (login and password-based two-factor) authentication to avoid the access of the unauthorized person. The projected design entrenches a combination of diverse electronic components to accomplish different tasks i.e., environmental parameter sensing, data processing, controlling the operation of attached peripherals, and monitoring the values over the web browser. The proposed system is wireless, secure, flexible and capable of intelligent decision-making. The electronic components used in the circuit design along with their specifications are defined in Table 1.

Raspberry Pi 3
It is third-generation of Raspberry Pi that has replaced the second-generation model of Raspberry Pi 2 released in February 2016. Main features of this model are i) 64-bit 1.2GHz central processing unit with a Broadcom (BCM-2837) model and support of 1GB RAM, ii) onboard Bluetooth low energy (BLE) and wireless LAN connectivity, iii) 40 general purpose input-output pins (GPIO) with 4 USB (2.0) ports and HDMI port for external display. Additionally, it supports audio/video ports, CSI camera port, DSI touch screen port, and micro SD card (42) . The core property of this model is that it can provide wireless connectivity to an access point and provides an opportunity to develop a plug and play wireless system.

Analog to Digital Converter
We have used an analog to digital converter (ADC) model ADS1115 which is a 16-bit ADC and 4 channels capable of converting 860 samples/sec at I2C. It is used because the output of the CO2 sensor is analog that needs to be converted into digital before sending it to the ThingSpeak server.

Liquid Crystal Display (LCD) and HDMI cable
To display the readings of climate parameters sensed through sensors is displayed on LCD (36) . In further, HDMI cable is used to connect the Raspberry Pi board with an LCD or LED display for setting up Pi 3 and python programming. Its model is JHD-162A with colorless pixels and thin display. For every liquid-crystal particle, each pixel is fenced by 2 luminous electrodes along with 2 polarizing filters. The attached LCD with the proposed system has a standard American Standard Codes of Information Interchange (ASCII) characters from DB0 -DB7.

Relay module and Cooling Fan
In electrical systems, the relay module is used to switch devices ON and OFF (38) . It includes two different circuits: one being used as an 'input' and the other is used as an 'output' . Relay works as a switch by opening and closing the contacts. It is crucial to keep the atmospheric temperature of greenhouse stable to get better yield and better growth rate. To achieve this, a cooling fan (39) is rummage-sale to control the environmental temperature. Likewise, exhaust fan (39) is also attached to sustain the humidity level of the greenhouse environment. A 12V, 120mm fan is connected with the system to regulate the temperature.

Sensors
We have used five sensors to sense the data of climate parameters and send it to Raspberry Pi 3 based embedded system. These include temperature, air humidity, soil moisture, carbon dioxide, and light intensity sensors to collect data for intelligent decision making. For temperature sensing, DS 1820 temperature sensor (-2, + 2 Co precision for temperature 0-50 Co) is used whereas DHT11 (5 percent precision for humidity readings for 20-80%) is used to sense humidity. The key features include: these sensors need 3-5 V to operate, with max. of 2.5mA current. Moreover, the FC-28 moisture sensor is used that has 4 pins including VCC, A0 pin for analog output, D0 pin for digital output and ground pin. The moisture sensing module comprises a potentiometer to set a threshold value that will be further compared by the comparator (LM393). Further, for the light sensor, LDR (40) is used because it is efficient in detecting the visible light. It comprises a resistance that varies when the light falls on this resistance. To measure soil moisture, a soil moisture sensor (43) is rummage-sale to check the humidity level of the soil. It also operates on 3.3-5V.

Implementation of the Proposed Scheme
The proposed model proficiently screens climatic parameters and intelligently regulates the climate parametric values (using sensors, attached output devices, Raspberry Pi) to capitalize crop yield and enhance the production. The real-time instantaneous status of climate parameters in the greenhouse environment can be seen on LCD as well as on ThingSpeak.

VNC Viewer
It is a freeware that can be adapted to use the desktop of Raspberry Pi 3 remotely. It provides a user-friendly GUI for the user. It only requires account signup of the user and IP address of Raspberry Pi 3 whenever a user is logged in and automatically sets up the connection. Once the connection is built, the desktop of Raspberry Pi 3 can be used from any remote location. https://www.indjst.org/

Proposed Construction of Embedded System using Raspberry Pi
The proposed integration of hardware components is shown in Figure 3. Raspberry Pi works as a heart of the proposed intelligent system as it works as a central processing unit (CPU) in monitoring the real-time values of climate parameters in a greenhouse environment. Correspondingly, based on these values it performs comparisons of preset threshold values with received values and makes decisions to control these climate parameters if it finds any kind of imbalance. In total, five sensors are used including air temperature, air humidity, soil moisture, air carbon dioxide, and light intensity. If there is any variation monitored in climate parametric values by any of the deployed sensors, this variation is communicated to the Raspberry Pi 3 which subsequently compares the received value with the preset threshold values. Consequently, if Raspberry Pi 3 finds any imbalance then it will trigger one of the relays to turn the related device ON so that the respective climatic parameter can be stabilized. On every occasion when the proposed system realizes that the received parameter value is less or more than the set threshold value, it will contemplate that it is essential for field resources and directs a signal to trigger the relay module to turn ON the corresponding electric components to satisfy the requirement of resources in the greenhouse environment. The connected appliance(s) will function uninterruptedly until sensors get balanced values. For example, if a value captured by the soil moisture sensor is less than a specific limit ( the least amount of water contented in soil), it will communicate the value to the Raspberry Pi 3 that will intelligently direct a signal the corresponding relay module to switch the water pump ON until the needed water volume for the soil is not completed. Likewise, all other sensors will operate by sending values to the control unit that will decide either there is a need or not to ON/OFF the electrical appliances until the sensor gets stable values. Additionally, the up-to-date status of the greenhouse environment which means all sensors and components are presently functional is also displayed on an LCD.  Figure 4] stretches an outline of inclusive functionality done in the form of a flow chart. Rendering to which, the Raspberry pi 3 B+ is used in this deployment that has built-in Wi-Fi and Bluetooth facility, however, to attain maximum reliability and range we are using Wi-Fi for the connectivity of embedded system with an access point and further access point will send data to ThingSpeak through the gateway. Once the connectivity of the proposed system is completed through Wi-Fi, it checks for the connectivity of agriculture professionals. If he/she is not connected to the system through the internet, it specifies 'no user connected' and connectivity counter will fail as shown in Figure 4. If client connectivity is found, it moves towards the ThingSpeak main page and brings up-to-date sensor data as per the latest received values of real-time climate parameters. As the upgradation of ThingSpeak is completed according to received sensor's values, it will reconfirm the connectivity of client and keep on repeating this loop of data up-gradation and at any upgradation, the imbalance is found the system will automatically run the corresponding device to switch on the device for the sake of stability at regular time intervals.

Embedded System and Internet Connectivity
ThingSpeak (44) is an IoT based analytics plate form that helps in the establishment of internet connectivity of ES and agricultural professional and delivers real-time system information. It is an open-source web plate form that is used for testing of real-time IoT based implementation of research determinations. It is proficient of collect and analyzing live data in the cloud.
Primarily, ThingSpeak offers a facility for creating an account for the user to create an account followed by the formation of a new channel. Once the channel is formed, a new window popup letting to add the channel name and its description Figure 5. The fields shown on ThingSpeak GUI page shown in Figure 5 have to be designated concerning climate parametric measurements established according to the proposed application i.e. the proposed system that monitors air temperature, air humidity, soil moisture, air carbon dioxide, and light intensity in which, fields are marked as 1, 2, 3, 4 and 5, respectively. The channel is saved after completing the necessary information in the ThingSpeak form. Point to ponder is that each of the created channels will have an exclusive 'Write API key' used while writing the software code. Moreover, ThingSpeak demonstrates the real-time sensor values in the form of a graph. Of note, the sensor's data will have vanished in case of no internet connectivity. However, it can be tackled by maintaining a separate database or a separate server instead of using a building IoT plate form. Another solution is that an isolated memory element may be used directly associated with the sensor nodes, but this arrangement will be sovereign and independent of internet connectivity. Wireless connectivity of this proposed system is another distinguishing attribute as it is the best available solution as the wall outlets might not be constantly appropriate in a greenhouse environment.

Results and Discussion
The structure of the prescribed system is explicated in [ Figure 6] in the form of a flow diagram. As the circuit is functional, all attached sensors initiate the sensing of climate parameters and communicate the recorded values to ES. Once these values are received from sensors, ES equates the gotten values with the stabilized preset values. If any of the values are less or greater than the limit value (a preset threshold value), the ES will direct a control signal towards the relay module to switch ON the matching appliance so that the imbalance value can be normalized. In the proposed structure, if the value of Light Dependent Resistor (LDR) is lower than the preset threshold value, it will be taken as nighttime, and ES will direct a control signal to the relay module to switch ON the associated lights till the sensor value augmented the preset threshold value (a value in the day time). Similarly, if the temperature and humidity sensor values are less than the threshold, the exhaust fan and fan will turn ON to fulfill the requirement of air. Trails just as the functioning of all connected sensors, the ES will measure and compare the Soil moisture through soil sensor. If the value is less than the preset threshold, ES will take it as the low moisture and fewer contents and water is needed to increase the level of soil moisture. Consequently, ES will switch ON the watering pump until the set threshold is realized. The data obtained from all sensors are simultaneously referred to as the LCD module and that can be visualized on it. Every time fresh data comes, it substitutes the existing values that presently displayed on LCD. Raspberry pi-based ES was initially designed on 'https://www.circuito.io/ ' as shown in Figure 7 that is an online platform rummage-sale for Raspberry Pi and Arduino based the electrical/electronic circuit design. The Raspberry Pi libraries are not built-in in this platform, nevertheless, these are open source libraries. After the inclusion of these libraries, we can use the above-mentioned platform to implement the proposed system as shown in Figure 8. The system has been developed and tested in the lab prototype. Figure 8 illustrates the demonstration of the anticipated IoT based greenhouse stem to monitor and control the climate parameters. Figure 8 displays the assembling of the prescribed components of the proposed system along with results displayed on LED. The right portion of the figure shows the five sensors, then the relay module is displayed in the central part and on the right side, the live values captured by the sensors are shown on LCD. The measured values of climate parameters i.e. temperature is measured as 22.8 C 0 where its normal/set value is 35 C 0 . The measured value is normal, hence the message shown on the LCD is displayed as "temperature is normal Fan OFF" and the corresponding LED is OFF. However, in lower screen short, the value of the temperature sensor is 36.5 C 0 that is an imbalanced value and to bring the temperature down we need to turn on the fan. Hence, the relay will turn on the fan and the message can be seen as "Temperature Increase Fan On". Similarly, the other four parameters including CO 2 , humidity (preset threshold ≥ 55), light intensity, and soil moisture (preset threshold = 50) are displayed in Figure 8,with their live values, normal threshold values and the corresponding device attached to regulate the particular climate parameter value. This results in Figure 8 only shows the switching of relays only as we have proposed a lab prototype but it can operate all attached sensors and respective mentioned devices to control the environment accordingly to fulfill the needs. Figure 9 shows five different plots for all five fields (for five sensors). As shown in Figure 5, fields are set from Field 1 to Field 5 while creating a channel on ThingSpeak. The temperature fluctuations can be monitored on the plot of Field 1, Field 2 for humidity, Field 3 for soil Moisture, Field 4 for light intensity and Field 5 to display CO2 monitoring. All given fields in Figure 9, shows automated control over time. The preliminary values are taken by sensors and are stabilized by the proposed system to its normal (set) value. Table 2 displays the evaluation attributes of existing systems and the proposed systems in (11,20,45,46) .

Conclusion and Future Recommendations
This study proposed the integration of third-generation Raspberry Pi based intelligent embedded system, climate sensors and IoT analytics (ThingSpeak). The proposed plug and play prototype can be physically installed in a greenhouse environment to record climate parametric data being forwarded to the gateway. The gateway nodes are in control to frontward this data to agriculture professional(s) through a web browser over the internet. Based on the received information, the ES activates the smart decision making by the implementation of a suitable arrangement to control the climate parameter values. For example, the greenhouse climate is controlled through switching "ON" certain devices i.e. fan, lights/heater, water sprinklers/exhaust fan, and alarm, etc. The installed sensor network is very simple, power-efficient, multi-functional, low cost and optimal in size. It is deliberated that the anticipated system can be easily implementable at a bigger scale. It will be beneficial for visible growth in productivity, profitability, and sustainability of greenhouse farming setup. It is a primary wireless deployment of an intelligent greenhouse system using ThingSpeak analytics and Raspberry Pi board-based ES. Conclusively, we can claim that the proposed system comprises the following benefits: • It is capable of providing uninterrupted mobile monitoring of the greenhouse farm. • There will be negligible human interface/dependency that significantly lessens the labor cost, • The Login and password-based (two-factor authentication) scheme can be implemented • using a Raspberry Pi board to avoid unauthorized that ensures the system security.
• All the above points will show some prominent rise in crop yield and productivity.
As a future research problem, image processing can be used with the proposed system to spot and monitor the defect in the leaves to take precautionary measures. Moreover, a small single-board computer e.g., Raspberry Pi, can be used with wireless sensors network instead of wired sensors to increase the performance of the system and deployment of the modern wireless environment.

Acknowledgment
Authors are thankful to the Editor and respected anonymous reviewers for their perceptive comments and useful recommendations that will surely improve the eminence of this work.