Keywords

1 Introduction

Agriculture is India’s backbone, supporting more than half of the country’s population. India’s population is increasing constantly, and so is the demand for food. Harvest is affected adversely by unanticipated climate changes caused by man-made and natural factors. As a result, the greenhouse is favored to maintain optimal climatic conditions by precisely controlling the ambient temperature, relative humidity, and soil moisture required by the crops. A greenhouse can provide a more favorable shelter for plants and hence, agriculture in greenhouse is referred to as protected agriculture, protecting the crop against unfavorable environmental conditions. With help of constant monitoring the optimal climatic conditions (temperature, light intensity, soil moisture, and humidity) for crop growth may be maintained. Monitoring such system is a tedious job demanding frequent visit and care, making most farmers feel inconvenient. Although greenhouse helps increase yield, a reason for lower acceptance is that climate control failure leads to crop failure. The advancement in sensors and the internet of things has significantly altered the world, including, greenhouse monitoring and control. Wireless sensor networks can aid to effective monitoring of the same and in turn control the greenhouse [1].

Geographical area and local climate play important role in determining growth of harvest and any stress in climatic condition results in deviation of plant growth [2]. Photosynthesis, transpiration, absorption, respiration, blooming, etc. biological processes are function of ambient temperature [3]. On other hand, humidity in air influences transpiration [4]. Temperature and humidity are interrelated and collectively affect the transpiration, and harvest in turn. Optimally controlled soil moisture facilitates root growth, stretch the flowering time and resulting in increased yields [5].

Researchers have proposed and implemented diverse advancements in wireless technology over time to increase the yield. Academic researchers have proposed IoT-based greenhouse systems with real-time access in last decade. The study by M. Suresh et al. employs network based on GSM, reading signals from the associated sensors on the ground, and GUI is used for android devices and testing of its performance [6]. A Semi-automated system enabling the farmer to make a decision has been devised by K. Sreeram et al. [7]. Message Queue Telemetry Transfer (MQTT) protocol was chosen over Constrained Application Protocol and Extensible Messaging and Presence Protocol transmission, effectively providing the different quality of services to detect different parameters [8]. An enclosed micro-climate for the plant growth in which the gateway receives the sensor data and control information through a ZigBee wireless network providing real-time monitoring from the web application is also reported [9]. The photovoltaic panel powered system combined with a duplex cellular-web interface communication offering data inspection and irrigation programming from web page is reported by Joaquin et al. [10]. Raspberry Pi 3 Model B employed to automate greenhouse maintenance operations and monitors the growth conditions inside the greenhouse has been reported [11]. Irrigation and monitoring of agriculture using a cloud technique connecting an irrigation control mechanism through IoT have also been investigated [12]. Wireless Sensor Network (WSN) based embedded system; dealing with the implementation of ZigBee with different Topology used for real time monitoring based on GUI application for Greenhouse parameters has been developed on Java platform [13]. Use of Esp8266 and an AT89S52 as monitoring device for observing the framework of sensors and sending email warnings and messages to the mobiles, is already studied [14]. Greenhouse environment monitoring a system based on ZigBee was studied to control and provide real time data for agriculture [15]. WSN measurement data has been exchanged via IoT. A Smartphone application has been developed that allows users to control a series of actuator and sensors [16].

The proposed system prototype implemented at cucumber greenhouse, employs ESP-32 SOC as a web-server. Microcontroller connects to ten soil sensors and four integrated humidity and temperature sensors along with actuators. A web-based application manages it in real time. Predefined values of soil moisture, ambient temperature and humidity required for the cucumber greenhouse are set in web-application. Web-application monitors those parameters, which in turn are used to control the actuators. Also shown real time analysis is represented graphically. Thus, this system is effective to use and easy to monitor and control to improve yield.

2 Materials and Methods

2.1 Proposed System Components (Hardware)

ESP-32. ESP32 is a smart, generic Wi-Fi and Bluetooth MCU SOC Microcontroller module targeting various applications from Espressif Systems [17]. The ESP32-D0WDQ6 chip is at the heart of this module designed to be scalable and adaptable [17]. Two CPU cores can be managed independently, and the CPU clock frequency is adjustable in the range of 80–240 MHz [17]. ESP32 has 30 multi-functional GPIO pins, supporting diverse peripherals, including capacitive touch sensors, Hall sensors, an SD card interface, Ethernet, high-speed SPI, UART, I2S, and I2C devices. It offers 802.11 b/g/n Wi-Fi networking at speeds of up to 150 Mbps [17]. Salient features of the ESP-32 include 18 ADC channels, 10 Capacitive I/Os, 3 UART interfaces, 3 SPI interfaces, 2 I2C interfaces, 16 PWM output channels, 2 DACs and 2 I2S interfaces [17].

DHT-22. DHT22, humidity and temperature sensor are extremely accurate. They are available as sensor as well as module and measure the relative humidity with a capacitive sensor element and temperature with an NTC thermistor connected to a high-performance 8-bit micro-controller [18]. It can detect relative humidity levels ranging from 0 to 100% (accuracy ± 2) and temperatures ranging from -40 to 125 degrees Celsius (accuracy ± 0.3 °C) [18]. When linked to the CPU, the DHT22 employs a single wire serial interface to communicate data via a DATA pin on the sensor, Fig. 1 shown DHT22 connect to MCU.

Fig. 1
figure 1

MCU connection to DHT22

Soil Moisture sensor. The moisture of the soil is detected with resistive type soil moisture sensor module. The volumetric content of water inside the soil is measured and converted to soil moisture. It comprises two immersion gold coated probes to monitor soil moisture [19]. Such module with probe and signal conditioning circuit employing op-amp LM393 is shown in Fig. 2.

Fig. 2
figure 2

Soil moisture sensor with amplifier section

Relay. SLA-5VDC-SL-A 4Pin 30A Power Relay. The relay is switched with the help of a small signal from a micro-controller like an Arduino, ESP-32, and ESP8266. This relay can be used to drive 30 A devices.

2.2 Web-Application

API or Application Programming Interface [20] is used for connection between a micro-controller and PHP Server running. APIs are mainly transmitted using either of the two different methods: GET and POST. In this experiment GET method is used for inserting data, that is data of 10 soil moisture sensors and 4 pairs of temperature and humidity into a database. Data is first concatenated into one string containing domain name, location of PHP file [21] and data to be inserted. In response to this operation, a JSON response is generated containing information about relay status.

Front-end programming was carried out using HTML, CSS and JAVASCRIPT. We have used APACHE server [23] and MySQL database [24].

2.3 Block Diagram and Experimental Set up

Figure 3 shows, a functional block diagram of the proposed system with embedded hardware as well as wireless communication. Core part of the system is ESP-32 SOC, responsible for all data collection, processing and generating control signals. Sensors, namely: 10 resistive soil moisture sensors and 4 DHT22 (temperature and humidity sensor) are connected to the micro-controller board and logs data periodically. The logged data is sent to server for further data analysis.

Fig. 3
figure 3

Block diagram of the proposed system

The experimental setup is shown in Fig. 4. The MCP 3008 is an eight-channel, ten-bit ADC IC [25]. 8 soil moisture sensors are connected to MCP 3008 and rest 2 are connected directly to GPIO pins of ESP-32. 4 DHT22 (providing digital data packets) are directly connected to controller GPIOs using single wire serial interface. Externally powered relay module is employed to switch on/off the pump and the exhaust fan.

Fig. 4
figure 4

Proposed system experimental setup

Once, the connection is established, controller starts acquiring data (soil moisture, temperature and humidity) from sensors. Transmitting data over the internet using HTTP protocol mandates to typecast data into string form. These strings are then concatenated in one string comprising the domain name of the web server, followed by the path of a PHP file on the server, and at last data string separated by ‘&’. This string then posted on to the server using the HTTP GET method. Upon successful insertion of the data to the database, a response of 200 is received, else a corresponding error code is received. Also, in response server sends time, date and status of the pumps, exhaust fan and colling system in JSON format. At the next step, the controller parses this JSON data and manipulates it to represent the status of pumps, exhaust fan and colling system on the webpage as well as to manipulate the digital output. Time information is also logged for visual representation and analysis. The same process is depicted in form of the flowchart shown in Fig. 5.

Fig. 5
figure 5

Flowchart of the proposed system

Proposed system installed in the field of cucumber greenhouse is shown in Fig. 6. At onset of the process cucumber plant parameters are needed to be set for optimization of yield. A daytime temperature of 20–30 °C is optimal for the cucumber plant [26]. At temperatures above 30 °C, imbalances in plants are observed affecting the processes of photosynthesis and respiration. Due to the vast surface area of its leaves, this plant requires a lot of humidity. During the day, relative humidity should be between 60 and 70%, while at night, it should be between 70 and 90% [26].

Fig. 6
figure 6

In cucumber green-house set-up a circuit box, b DHT-22, c soil moisture sensor

3 Result

3.1 Test Setup

In order to automate the proposed system in the field (the cucumber greenhouse), a set of desired parameter boundary values (minimum and maximum) (Table 1) are fed through web-application on the URL “http://smartgarden.pw”.

Table 1 Parameter boundary values for automatic control

On the web-application, user can supervise parameters (temperature, humidity and soil moisture) as well as status of the actuators (Fan and Pumps for watering and sprinkler) in the cucumber greenhouse as real-time charts. The state of various actuators (Fan and Pump) of the greenhouse can be monitored as well as manually controlled through the Internet.

3.2 Analysis of Result

Microcontroller is logged sensor data and manipulates the status of relays to control external devices. The observed logged data is stored in Sensor.CSV file as shown in Fig. 7. The averages of 10 soil moisture sensors were recorded at an interval of 3 min for different zones to measure and control moisture, also an average of relative humidity and temperature was recorded at an interval of 3 min to control corresponding actuators.

Fig. 7
figure 7

Screenshot of sensor.csv file

Real time information is also logged for visual representation and analysis, which helps to take a decision. Figure 8 shows the percentage humidity Vs time plot, showing different humidity values from all 4 sensors. The micro-controller is acting on the average value (of the four sensors) to control actuator (fan) in accordance with predefined algorithm. Figure 8 also shows the temperature Vs time plot (of the four sensors) that in turn controls actuators (fan and pump). In the case of soil moisture, the percentage moisture (of the ten sensors) Vs time plot is shown in the same Fig. 8. The average value of them is exploited to turn on/off the watering pump. The status of such actuators can also be visualized on web-application. Manual override option allows the user to have manual control of actuators, in the case needed.

Fig. 8
figure 8

Graphically logged ambient temperature, humidity and soil moisture data in cell phone

4 Discussion

The IoT based greenhouse system permits users over the cloud network to send commands to the hub from remote location. The hub will further employ signals for the intended sensors to trigger and perform the user-requested action. Once the action is performed, web-application will update the status of the action taken to the cloud network and in this way; users can control as well as monitor the parameters manually or automatically.

Major concerns about greenhouse automation methods have been their management, installation and operational cost and efficacy. Early greenhouses had simple controls such as opening windows, turning on/off irrigation valves, etc. requiring human operator. A wired network used in large greenhouses has proven to be more expensive in terms of installation. Researchers have designed diverse wireless sensor networks to automate the greenhouse in order to facilitate the optimal climate for plant growth. The work presented depicts a scalable greenhouse that can be monitored as well as controlled from web-page. The system offers automatic as well as manual mode of control. User (admin) is provided with rights to set the parameters for different crops. Overall, the system is quite inclusive and scalable.

The system is accessed over internet, hence, unavailability of internet access, hampers the system. Also, the system is provided with 30 s delay to enable manual mode.

The system has been tested for its operation in cucumber greenhouse. The fast response exhibited by this system makes it quite efficient and results in increased yield.

5 Conclusion

As an emerging technology internet of thing (IoT) is explored which helps to provide the smart solution in the development of prototype greenhouse monitoring. This system is quite easy to deploy for monitoring multiple sensor parameters and controlling actuators in response. This tends to improve crop yields with easy access. This ensures access to control the plant growth from remote places within in no time. This system works on manual as well as in auto mode with predefined values of parameter. The proposed system is extremely economic and uses water optimally, hence conserving the precious resource. This system provides consistent operation resulting in better care for plants.

Concluding, the installation of an automation system for the greenhouse will help to manage a consistent and predictable climate, i.e. ideal growing environment. One of the biggest benefit automations can provide is the ability to reduce overall production cost, minimum human power required, and improve the yield. Implementing this system in different agricultural greenhouses with different crops can be fruitful to farmers. Also, we are trying to add some additional parameters like light intensity and atmospheric Carbon dioxide to be monitored and controlled.