Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial Intelligence

*Redmond R. Shamshiri, Ibrahim A. Hameed, Kelly R. Thorp, Siva K. Balasundram, Sanaz Shafian, Mohammad Fatemieh, Muhammad Sultan, Benjamin Mahns and Saba Samiei*

## **Abstract**

Automation of greenhouse environment using simple timer-based actuators or by means of conventional control algorithms that require feedbacks from offline sensors for switching devices are not efficient solutions in large-scale modern greenhouses. Wireless instruments that are integrated with artificial intelligence (AI) algorithms and knowledge-based decision support systems have attracted growers' attention due to their implementation flexibility, contribution to energy reduction, and yield predictability. Sustainable production of fruits and vegetables under greenhouse environments with reduced energy inputs entails proper integration of the existing climate control systems with IoT automation in order to incorporate real-time data transfer from multiple sensors into AI algorithms and crop growth models using cloud-based streaming systems. This chapter provides an overview of such an automation workflow in greenhouse environments by means of distributed wireless nodes that are custom-designed based on the powerful dualcore 32-bit microcontroller with LoRa modulation at 868 MHz. Sample results from commercial and research greenhouse experiments with the IoT hardware and software have been provided to show connection stability, robustness, and reliability. The presented setup allows deployment of AI on embedded hardware units such as CPUs and GPUs, or on cloud-based streaming systems that collect precise measurements from multiple sensors in different locations inside greenhouse environments.

**Keywords:** LoRaWAN, Greenhouse, Datalogger, Internet of Things, AgroTech, Leaf wetness

## **1. Introduction**

Control and automation of microclimate and fertigation inside greenhouses have contributed to improving the sustainability of closed-field environment agriculture by reducing water, fertilizer, and energy demand, while at the same time increasing yield and profit [1]. The trend of environmental monitoring in modern farming is towards shifting from offline systems to wireless and cloud-based data

collection architecture [2]. Advances in sensing technology have made possible the best quality of greenhouse production with the capability of yield prediction. Digital technology such as the Internet-of-Things (IoT) offers parallel solutions for automation engineers, which can be customized specifically for greenhouse applications. Wireless sensors and IoT enabled devices are used for real-time monitoring and control of the greenhouse environment through a secure internet connections on any mobile devices [3]. With multiple sensors that transmit data to a central computer installed with knowledge-based automation software, growers can monitor all internal and external data and apply any required changes to the environment in real-time. For example, a fertigation control system that monitors certain aspects of the irrigation, such as flow rate, electrical conductivity (EC), and pH of the fertigation solution, as well as the external variables such as solar radiation and external climate conditions can take advantage of the collected data and incorporate them into models or artificial intelligence algorithms in a way that particular control commands, such as triggering specific pumps or switching other processes, are sent to alter the greenhouse environment. In this aspect, the flexibility of the monitoring system and the knowledge behind the control algorithms are the key factors for an effective automation system. **Figure 1** shows a general architecture of wireless communication for IoT monitoring and control of multiple greenhouses. The main justifications for the deployment of such infrastructure can be summarized as (i) to provide real-time monitoring of the changes and variations to ensure optimal growth environment and minimize the risk of equipment malfunction, (ii) to share data with cloud-based decision support systems, and (iii) to send instant responses to the wireless actuators for reducing input costs and increasing yield and quality.

Research and development for adopting wireless communication technology in monitoring and control of greenhouse environments began in the late 1990s and early 2000s. One of the earliest reports of WSN application in greenhouse environment monitoring can be found in the work of [4]. The compact size, reliability, and cost-effectiveness of WSN modules, as well as flexibility for developing custom applications beside easy installation, have made this technology gain importance and popularity for Closed-Field Environment Agriculture (CFEA). Various remote systems, both prototype and commercial, have been designed for investigating functionalities and limitations inside greenhouses.

**3**

**Figure 3.**

*5 seconds.*

**Figure 2.**

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial…*

An effective IoT-based solution should incorporate the use of wireless sensors and mobile applications for displaying, processing, and analyzing data from remote locations using cloud services which together provide new insights and recommendations for better decision-making. Evaluation of greenhouse environments prior to the actual cultivation is also of interest for many growers. IoT-based monitoring systems have been used for evaluating and adjusting microclimate parameters with LoRa sensors which are custom-designed to withstand hot and humid condition, allowing the system to continuously operate on solar-charged battery in remote areas where connections stability is of concern [2, 3]. An example of a modular LoRaWAN sensor node with external solar-charged battery and aviation connector cables with plug-and-sense capability is shown in **Figure 2**. These devices are customized specifically to operate in harsh agricultural condition and resist high humidity, solar radiation, insects, and bugs. The quality of network connectivity and stability in continuous data collection with 5 seconds intervals were tested in extreme conditions a proof of reliability for use in digital agriculture applications. A sample of air temperature dataset that was collected from a heat control chamber experiment using these devices are plotted in **Figure 3** to show the resolution and

It should be noted that in most studies that are related to wireless monitoring of greenhouses, raw data are first collected via a wireless sensor network-based system and are processed afterward. A drawback of this approach is that because the collected data is not processed in real-time, they cannot immediately determine the temporal and spatial variations in the environmental parameters, as well as

*A LoRaWAN wireless sensor node with an external solar-charged battery and different sensor shields used in real-time monitoring of greenhouse microclimate parameters. Images by courtesy of Adaptive AgroTech.*

*An example of IoT monitoring of air temperature using ADP-AgroTech 868Mhz LoRa sensor located inside a metal heat control chamber that was isolated in a concrete basement for connectivity test. The gateway receiver was located inside another building, approximately 50 m away from the transmitter. Data were collected every* 

*DOI: http://dx.doi.org/10.5772/intechopen.97714*

stability of the wireless transfer.

#### **Figure 1.**

*Schematic diagram of wireless communication between greenhouse sensor nodes and cloud storage. Image by courtesy of Adaptive AgroTech.*

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial… DOI: http://dx.doi.org/10.5772/intechopen.97714*

An effective IoT-based solution should incorporate the use of wireless sensors and mobile applications for displaying, processing, and analyzing data from remote locations using cloud services which together provide new insights and recommendations for better decision-making. Evaluation of greenhouse environments prior to the actual cultivation is also of interest for many growers. IoT-based monitoring systems have been used for evaluating and adjusting microclimate parameters with LoRa sensors which are custom-designed to withstand hot and humid condition, allowing the system to continuously operate on solar-charged battery in remote areas where connections stability is of concern [2, 3]. An example of a modular LoRaWAN sensor node with external solar-charged battery and aviation connector cables with plug-and-sense capability is shown in **Figure 2**. These devices are customized specifically to operate in harsh agricultural condition and resist high humidity, solar radiation, insects, and bugs. The quality of network connectivity and stability in continuous data collection with 5 seconds intervals were tested in extreme conditions a proof of reliability for use in digital agriculture applications. A sample of air temperature dataset that was collected from a heat control chamber experiment using these devices are plotted in **Figure 3** to show the resolution and stability of the wireless transfer.

It should be noted that in most studies that are related to wireless monitoring of greenhouses, raw data are first collected via a wireless sensor network-based system and are processed afterward. A drawback of this approach is that because the collected data is not processed in real-time, they cannot immediately determine the temporal and spatial variations in the environmental parameters, as well as

#### **Figure 2.**

*Next-Generation Greenhouses for Food Security*

input costs and increasing yield and quality.

functionalities and limitations inside greenhouses.

collection architecture [2]. Advances in sensing technology have made possible the best quality of greenhouse production with the capability of yield prediction. Digital technology such as the Internet-of-Things (IoT) offers parallel solutions for automation engineers, which can be customized specifically for greenhouse applications. Wireless sensors and IoT enabled devices are used for real-time monitoring and control of the greenhouse environment through a secure internet connections on any mobile devices [3]. With multiple sensors that transmit data to a central computer installed with knowledge-based automation software, growers can monitor all internal and external data and apply any required changes to the environment in real-time. For example, a fertigation control system that monitors certain aspects of the irrigation, such as flow rate, electrical conductivity (EC), and pH of the fertigation solution, as well as the external variables such as solar radiation and external climate conditions can take advantage of the collected data and incorporate them into models or artificial intelligence algorithms in a way that particular control commands, such as triggering specific pumps or switching other processes, are sent to alter the greenhouse environment. In this aspect, the flexibility of the monitoring system and the knowledge behind the control algorithms are the key factors for an effective automation system. **Figure 1** shows a general architecture of wireless communication for IoT monitoring and control of multiple greenhouses. The main justifications for the deployment of such infrastructure can be summarized as (i) to provide real-time monitoring of the changes and variations to ensure optimal growth environment and minimize the risk of equipment malfunction, (ii) to share data with cloud-based decision support systems, and (iii) to send instant responses to the wireless actuators for reducing

Research and development for adopting wireless communication technology in monitoring and control of greenhouse environments began in the late 1990s and early 2000s. One of the earliest reports of WSN application in greenhouse environment monitoring can be found in the work of [4]. The compact size, reliability, and cost-effectiveness of WSN modules, as well as flexibility for developing custom applications beside easy installation, have made this technology gain importance and popularity for Closed-Field Environment Agriculture (CFEA). Various remote systems, both prototype and commercial, have been designed for investigating

*Schematic diagram of wireless communication between greenhouse sensor nodes and cloud storage. Image by* 

**2**

**Figure 1.**

*courtesy of Adaptive AgroTech.*

*A LoRaWAN wireless sensor node with an external solar-charged battery and different sensor shields used in real-time monitoring of greenhouse microclimate parameters. Images by courtesy of Adaptive AgroTech.*

#### **Figure 3.**

*An example of IoT monitoring of air temperature using ADP-AgroTech 868Mhz LoRa sensor located inside a metal heat control chamber that was isolated in a concrete basement for connectivity test. The gateway receiver was located inside another building, approximately 50 m away from the transmitter. Data were collected every 5 seconds.*

their deviation from optimal conditions. In addition, the available commercial LoRaWAN and IoT sensors for use in agriculture and greenhouses environments are expensive and range between 1000 and 5000 USD at minimum order of 5 units. The presented chapter is an effort to respond to these problems, by presenting an overview of the components of an affordable multichannel wireless sensor node (WSN) with LoRa modulation at 868 MHz that can be interfaced with onboard computers such as Raspberry Pi for implementation of artificial intelligence (AI) algorithms in a way that they can perceive the greenhouse environment, make decisions, and take proper actions. These devices are custom-designed to withstand harsh greenhouse condition in order to provide real-time monitoring and control of crop growth variables such as microclimate parameters, light condition, soil temperature, soil moisture, and leaf wetness.

## **2. IoT sensing and data sharing in greenhouse production**

Enabling commercial greenhouses with continuous sensing, communication between devices, and data sharing with the greenhouse management system is essential for disease prevention [5]. Some of the greenhouse diseases such as mildew fungi can cause significant loss of yield up to 50% [6]. For example, in hot and humid tropical climate conditions, extensive rainfall, fog, and high air temperature contribute to exacerbating the development of fungi in the leaves [7]. IoT-based sensor data fusion integrated with mathematical models provides growers with the opportunity to have a prediction of the situation and apply the right actions before an outbreak. The main elements of an IoT-based data acquisition and data sharing system with multiple sensor nodes and repeaters are shown in **Figure 4**. This framework provides growers with an evaluation of microclimate parameters with respect to different greenhouse designs and covering materials prior to the actual cultivation. The physical layer, software, and sensors layer in this scheme are linked wirelessly through standard communication protocols for transmitting data to a central base station for real-time or offline processing. This approach is required to exhibit precision accuracy, connection reliability within the sensing coverage, and low power consumption in order to be considered efficient for continuous monitoring of greenhouse in all growing seasons. Other than the specifications and characteristics of the sensors and communication algorithms that influence these functional properties, the physical internal and external condition of the greenhouse environment can also affect such a wireless monitoring framework.

## **2.1 Sensor probes**

A sensor probe refers to any instrument or device that measures some physical or chemical characteristics of the environment and sends the results as an electrical

#### **Figure 4.**

*Major components of an IoT-based data acquisition and monitoring system for greenhouse environment [2].*

**5**

**Figure 5.**

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial…*

signal to be received and interpreted by the main automation computer for decision making and control purposes. For example, a pH sensor that continuously measures the pH of the irrigation water will trigger an alarm and maintain optimum pH level if it is too high or too low, eliminating the need for a grower to manually run pH tests and pH control. Some of the essential parameters to measure in a greenhouse environment include microclimate (i.e., air temperature, relative humidity, and vapor pressure deficit), soil moisture, soil temperature, and light level (or solar radiation) [6, 8–10]. Measurements from these sensors can indicate the presence of mildew disease or condensation. **Figure 5** shows some of the most widely used sensors in greenhouse production. For example, concerning the microclimate parameters, the high precision BlueDot BME280 + TSL2591 is a tiny integrated digital and cost-efficient sensor with great accuracy and range that provides a flexible solution. The BME280 is a combined digital humidity, pressure, and temperature sensor based on proven sensing principles. This sensor module is housed in an extremely

compact metal-lid LGA package with a footprint of only 2.5 × 2.5 mm<sup>2</sup>

*Typical sensor probes used for measuring environmental variables in greenhouse crop production.*

of 0.93 mm. Its small dimensions and its low power consumption allow the implementation in battery-driven sensor nodes inside greenhouses and can achieve high performance and accurate measurement. The BME280 also provides an extremely fast response time for fast context awareness applications and high overall accuracy over a wide temperature range. The pressure sensor is an absolute barometric pressure sensor with extremely high accuracy and resolution and drastically low noise. The integrated temperature sensor has been optimized for low noise and high resolution. Its output is used for temperature compensation of the pressure and humidity sensors and can also be used for estimation of the ambient temperature. Most soil moisture sensors such as 10HS measures the dielectric constant of the soil using capacitance technology in order to find its volumetric water content (VWC), for scientific research and greenhouse applications. These sensors usually use 70 MHz frequency, which minimizes salinity and textural effects, providing high-resolution measurements that allow daily or hourly tracking of soil moisture content by sending analog voltage that is proportional to water content. These sensors have low sensitivity to salt and temperature, and are low power consumption. They can be connected directly or via interfaces to IoT boards for real-time

with a height

*DOI: http://dx.doi.org/10.5772/intechopen.97714*

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial… DOI: http://dx.doi.org/10.5772/intechopen.97714*

signal to be received and interpreted by the main automation computer for decision making and control purposes. For example, a pH sensor that continuously measures the pH of the irrigation water will trigger an alarm and maintain optimum pH level if it is too high or too low, eliminating the need for a grower to manually run pH tests and pH control. Some of the essential parameters to measure in a greenhouse environment include microclimate (i.e., air temperature, relative humidity, and vapor pressure deficit), soil moisture, soil temperature, and light level (or solar radiation) [6, 8–10]. Measurements from these sensors can indicate the presence of mildew disease or condensation. **Figure 5** shows some of the most widely used sensors in greenhouse production. For example, concerning the microclimate parameters, the high precision BlueDot BME280 + TSL2591 is a tiny integrated digital and cost-efficient sensor with great accuracy and range that provides a flexible solution. The BME280 is a combined digital humidity, pressure, and temperature sensor based on proven sensing principles. This sensor module is housed in an extremely compact metal-lid LGA package with a footprint of only 2.5 × 2.5 mm<sup>2</sup> with a height of 0.93 mm. Its small dimensions and its low power consumption allow the implementation in battery-driven sensor nodes inside greenhouses and can achieve high performance and accurate measurement. The BME280 also provides an extremely fast response time for fast context awareness applications and high overall accuracy over a wide temperature range. The pressure sensor is an absolute barometric pressure sensor with extremely high accuracy and resolution and drastically low noise. The integrated temperature sensor has been optimized for low noise and high resolution. Its output is used for temperature compensation of the pressure and humidity sensors and can also be used for estimation of the ambient temperature.

Most soil moisture sensors such as 10HS measures the dielectric constant of the soil using capacitance technology in order to find its volumetric water content (VWC), for scientific research and greenhouse applications. These sensors usually use 70 MHz frequency, which minimizes salinity and textural effects, providing high-resolution measurements that allow daily or hourly tracking of soil moisture content by sending analog voltage that is proportional to water content. These sensors have low sensitivity to salt and temperature, and are low power consumption. They can be connected directly or via interfaces to IoT boards for real-time

**Figure 5.** *Typical sensor probes used for measuring environmental variables in greenhouse crop production.*

*Next-Generation Greenhouses for Food Security*

moisture, and leaf wetness.

their deviation from optimal conditions. In addition, the available commercial LoRaWAN and IoT sensors for use in agriculture and greenhouses environments are expensive and range between 1000 and 5000 USD at minimum order of 5 units. The presented chapter is an effort to respond to these problems, by presenting an overview of the components of an affordable multichannel wireless sensor node (WSN) with LoRa modulation at 868 MHz that can be interfaced with onboard computers such as Raspberry Pi for implementation of artificial intelligence (AI) algorithms in a way that they can perceive the greenhouse environment, make decisions, and take proper actions. These devices are custom-designed to withstand harsh greenhouse condition in order to provide real-time monitoring and control of crop growth variables such as microclimate parameters, light condition, soil temperature, soil

**2. IoT sensing and data sharing in greenhouse production**

Enabling commercial greenhouses with continuous sensing, communication between devices, and data sharing with the greenhouse management system is essential for disease prevention [5]. Some of the greenhouse diseases such as mildew fungi can cause significant loss of yield up to 50% [6]. For example, in hot and humid tropical climate conditions, extensive rainfall, fog, and high air temperature contribute to exacerbating the development of fungi in the leaves [7]. IoT-based sensor data fusion integrated with mathematical models provides growers with the opportunity to have a prediction of the situation and apply the right actions before an outbreak. The main elements of an IoT-based data acquisition and data sharing system with multiple sensor nodes and repeaters are shown in **Figure 4**. This framework provides growers with an evaluation of microclimate parameters with respect to different greenhouse designs and covering materials prior to the actual cultivation. The physical layer, software, and sensors layer in this scheme are linked wirelessly through standard communication protocols for transmitting data to a central base station for real-time or offline processing. This approach is required to exhibit precision accuracy, connection reliability within the sensing coverage, and low power consumption in order to be considered efficient for continuous monitoring of greenhouse in all growing seasons. Other than the specifications and characteristics of the sensors and communication algorithms that influence these functional properties, the physical internal and external condition of the greenhouse environment can also affect such a wireless monitoring framework.

A sensor probe refers to any instrument or device that measures some physical or chemical characteristics of the environment and sends the results as an electrical

*Major components of an IoT-based data acquisition and monitoring system for greenhouse environment [2].*

**4**

**Figure 4.**

**2.1 Sensor probes**

monitoring. Light level sensor, also known as Light Dependent Resistor (LDR) is an active sensor that is made of high accuracy, fast response, high resistance semiconductor which is sensitive to light. It decreases resistance with respect to receiving luminosity (light) on the component's sensitive surface. The resistance of a photo-resistor decreases with increasing incident light intensity (it exhibits photoconductivity). In the dark, a photo-resistor can have a resistance as high as several megaohms (MΩ), while in the light, a photo-resistor can have a resistance as low as a few hundred ohms. It should be noted that the raw output data from this sensor need to be calibrated for specific interpretation. The SQ-110 sensor, specifically calibrated for the detection of solar radiation, provides at its output a voltage proportional to the intensity of the light in the visible range of the spectrum, a key parameter in photosynthesis processes. The waterproof DS18b20 is a robust and corrosion-free sensor that can be used for measuring soil temperature. This sensor comes with different cable lengths of 1.8 and 3 m and provides 9-bit Celsius temperature measurements. The DS18B20 communicates over a 1-Wire bus that by definition requires only one data line (and ground) for communication with the connectivity board. Another temperature sensor, Pt − 1000, works based on the resistance that varies between approximately 920 Ω and 1200 Ω in the range considered useful in greenhouse applications (−20 ~ 50°C approximately), which results in too low variations of voltage at significant changes of temperature for the resolution of the analog-to-digital converter. Most soil moisture sensors are in fact analog sensors (non-rust capacitive hygrometer) that determine volumetric water content (VWC) by measuring the dielectric constant of the media using capacitance/ frequency domain technology. An example is the analog sensor from Sun3Drucker that can be inserted directly into the soil to send moisture feedback data in realtime using capacitive sensing. A cable length of 1.5 m has been tested and found to be noise-free for these sensors. The soil moisture sensor probe is corrosion-free (no electrolysis on the electrodes) since it is using capacitive measuring method, and therefore is free of electrolysis on the electrodes. Another soil moisture sensor, the ECHO EC-5, determines volumetric water content (VWC) by measuring the dielectric constant of the media using capacitance/frequency domain technology. The EC-5 probe 70 MHz frequency minimizes salinity and textural effects, making this sensor accurate in almost any soil or soilless media. Factory calibrations are included for mineral soils, potting soils, Rockwool, and perlite.

Other than the mentioned sensors, some specific applications in greenhouse production and research may require a custom-design sensor probe. For example, in a greenhouse with misting or fogging systems, it is necessary to determine the solution droplet deposition on the plants. Determining leaf wetness as a reference measurement to avoid condensation inside greenhouse environments in certain hours is also of interest. In large-scale commercial greenhouse production measuring leaf surface wetness to determine the performance of spraying is required for chemical depletion. For this purpose, the ADP-AgroTech leaf wetness sensor model ADP-LWS2020 shown in **Figure 6** has been designed with different shapes to mimic the actual leaf shape, and to convert the moisture on the leaf surface into an analog signal using capacitance change. This sensor has been optimized to eliminate noise and generate high-resolution output under extreme greenhouse conditions. The performance of this sensor has been tested under high temperature and humidity in different tropical lowlands of Malaysia, and has been found to be stable and resistant under direct solar radiation. It can be seen from **Figure 6** that the surface of this sensor is composed of several rows of dielectric constant capacitor that has equal spacing and are connected to an electronic interface board for producing an analog signal. The ADP-LWS2020 can mimic the wetness state of a real leaf and detects the presence of surface moisture and calculates the duration of wetness.

**7**

**Figure 7.**

*AgroTech.*

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial…*

The voltage at its output is inversely proportional to the humidity condensed on the sensor, and can be read at the analog input of Adaptive AgroTech connectivity boards. It can be used for greenhouse studies and control systems and for scheduling irrigation. It also allows researchers to protect plants by giving early warnings

*ADP-AgroTech leaf wetness sensor (model ADP-LWS2020) with different leaf shapes based on capacitive method for determining leaf surface moisture and greenhouse condensation. Images by courtesy of Adaptive* 

Different multi-channel connectivity boards with WiFi and LoRa antenna that benefits from a modular design to be easily interfaced with sensor probes are shown in **Figure 7**. These boards are custom-designed to make possible adding new sensing capabilities to the existing wireless networks with minimum effort. In the same way, defective sensor probes may be easily replaced in order to ensure the lowest maintenance cost of the sensor network. The connectivity boards that are shown in **Figure 7** include all the electronics and sockets necessary to connect the most typical sensors in wireless monitoring of greenhouse environment, including BME280 (air temperature, humidity, and atmospheric pressure), DS18B20 (soil temperature), LDR Photoresistor (light sensor), SX239 (soil moisture), and NEO-7 GNSS modules. The custom-designed version of these boards include the necessary components for more specific research applications, such as Pt-1000, ADP-AgroTech leaf wetness (shown in **Figure 6**), weather station (pluviometer, anemometer, and vane), Luminosity sensor (TSL2561), and distance sensor (TFmini from Benewake). For more robust and fast processing, the connectivity boards in **Figure 7** benefit from the powerful ESP32 and Atmega328P microcontrollers that are integrated with customized codes for high efficiency and ultra-low power consumption (deep-sleep mode). The wireless communication between

*Sample prototype of WiFi and LoRa connectivity boards with onboard storage for real-time monitoring and IoT control of greenhouse based on ESP32 and Atmega328P microcontroller. Images by courtesy of Adaptive* 

*DOI: http://dx.doi.org/10.5772/intechopen.97714*

about fungus and insect attacks.

**Figure 6.**

*AgroTech*

**2.2 IoT connectivity boards and modular accessories**

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial… DOI: http://dx.doi.org/10.5772/intechopen.97714*

#### **Figure 6.**

*Next-Generation Greenhouses for Food Security*

monitoring. Light level sensor, also known as Light Dependent Resistor (LDR) is an active sensor that is made of high accuracy, fast response, high resistance semiconductor which is sensitive to light. It decreases resistance with respect to receiving luminosity (light) on the component's sensitive surface. The resistance of a photo-resistor decreases with increasing incident light intensity (it exhibits photoconductivity). In the dark, a photo-resistor can have a resistance as high as several megaohms (MΩ), while in the light, a photo-resistor can have a resistance as low as a few hundred ohms. It should be noted that the raw output data from this sensor need to be calibrated for specific interpretation. The SQ-110 sensor, specifically calibrated for the detection of solar radiation, provides at its output a voltage proportional to the intensity of the light in the visible range of the spectrum, a key parameter in photosynthesis processes. The waterproof DS18b20 is a robust and corrosion-free sensor that can be used for measuring soil temperature. This sensor comes with different cable lengths of 1.8 and 3 m and provides 9-bit Celsius temperature measurements. The DS18B20 communicates over a 1-Wire bus that by definition requires only one data line (and ground) for communication with the connectivity board. Another temperature sensor, Pt − 1000, works based on the resistance that varies between approximately 920 Ω and 1200 Ω in the range considered useful in greenhouse applications (−20 ~ 50°C approximately), which results in too low variations of voltage at significant changes of temperature for the resolution of the analog-to-digital converter. Most soil moisture sensors are in fact analog sensors (non-rust capacitive hygrometer) that determine volumetric water content (VWC) by measuring the dielectric constant of the media using capacitance/ frequency domain technology. An example is the analog sensor from Sun3Drucker that can be inserted directly into the soil to send moisture feedback data in realtime using capacitive sensing. A cable length of 1.5 m has been tested and found to be noise-free for these sensors. The soil moisture sensor probe is corrosion-free (no electrolysis on the electrodes) since it is using capacitive measuring method, and therefore is free of electrolysis on the electrodes. Another soil moisture sensor, the ECHO EC-5, determines volumetric water content (VWC) by measuring the dielectric constant of the media using capacitance/frequency domain technology. The EC-5 probe 70 MHz frequency minimizes salinity and textural effects, making this sensor accurate in almost any soil or soilless media. Factory calibrations are

included for mineral soils, potting soils, Rockwool, and perlite.

Other than the mentioned sensors, some specific applications in greenhouse production and research may require a custom-design sensor probe. For example, in a greenhouse with misting or fogging systems, it is necessary to determine the solution droplet deposition on the plants. Determining leaf wetness as a reference measurement to avoid condensation inside greenhouse environments in certain hours is also of interest. In large-scale commercial greenhouse production measuring leaf surface wetness to determine the performance of spraying is required for chemical depletion. For this purpose, the ADP-AgroTech leaf wetness sensor model ADP-LWS2020 shown in **Figure 6** has been designed with different shapes to mimic the actual leaf shape, and to convert the moisture on the leaf surface into an analog signal using capacitance change. This sensor has been optimized to eliminate noise and generate high-resolution output under extreme greenhouse conditions. The performance of this sensor has been tested under high temperature and humidity in different tropical lowlands of Malaysia, and has been found to be stable and resistant under direct solar radiation. It can be seen from **Figure 6** that the surface of this sensor is composed of several rows of dielectric constant capacitor that has equal spacing and are connected to an electronic interface board for producing an analog signal. The ADP-LWS2020 can mimic the wetness state of a real leaf and detects the presence of surface moisture and calculates the duration of wetness.

**6**

*ADP-AgroTech leaf wetness sensor (model ADP-LWS2020) with different leaf shapes based on capacitive method for determining leaf surface moisture and greenhouse condensation. Images by courtesy of Adaptive AgroTech*

The voltage at its output is inversely proportional to the humidity condensed on the sensor, and can be read at the analog input of Adaptive AgroTech connectivity boards. It can be used for greenhouse studies and control systems and for scheduling irrigation. It also allows researchers to protect plants by giving early warnings about fungus and insect attacks.

## **2.2 IoT connectivity boards and modular accessories**

Different multi-channel connectivity boards with WiFi and LoRa antenna that benefits from a modular design to be easily interfaced with sensor probes are shown in **Figure 7**. These boards are custom-designed to make possible adding new sensing capabilities to the existing wireless networks with minimum effort. In the same way, defective sensor probes may be easily replaced in order to ensure the lowest maintenance cost of the sensor network. The connectivity boards that are shown in **Figure 7** include all the electronics and sockets necessary to connect the most typical sensors in wireless monitoring of greenhouse environment, including BME280 (air temperature, humidity, and atmospheric pressure), DS18B20 (soil temperature), LDR Photoresistor (light sensor), SX239 (soil moisture), and NEO-7 GNSS modules. The custom-designed version of these boards include the necessary components for more specific research applications, such as Pt-1000, ADP-AgroTech leaf wetness (shown in **Figure 6**), weather station (pluviometer, anemometer, and vane), Luminosity sensor (TSL2561), and distance sensor (TFmini from Benewake). For more robust and fast processing, the connectivity boards in **Figure 7** benefit from the powerful ESP32 and Atmega328P microcontrollers that are integrated with customized codes for high efficiency and ultra-low power consumption (deep-sleep mode). The wireless communication between

#### **Figure 7.**

*Sample prototype of WiFi and LoRa connectivity boards with onboard storage for real-time monitoring and IoT control of greenhouse based on ESP32 and Atmega328P microcontroller. Images by courtesy of Adaptive AgroTech.*

these transmitter boards and receiver (gateway) is realized through Lora technology (433 MHz (Asia), 868 MHz (Europe) and 915 MHz (Australia and North America)) which covers 2 ~ 10 km distance in rural areas and is extendable to 100 km with repeaters. By default these boards have been programmed to read and record measurements every 10 seconds which can be adjusted according to the growers' needs. Data are stored on an onboard mini SD card or are transferred to an open-source secure cloud database via WiFi connection. Data can be viewed online at http://iot. adaptiveagrotech.com/ or by installing Adaptive AgroTech smartphone app.

The wireless sensor and controller boards as well as other electronic components and modules are housed in sealed waterproof ABS enclosures that are rated as IP-66 in order to withstand harsh environmental conditions such as sunlight, dust, moisture, high humidity, insects, and sudden changes in temperature. **Figure 8** shows a hybrid data acquisition system with modular components including the main connectivity board, sensor probes, connector cables, external solar-charged battery, and a solar panel. These components are interchangeable and can be connected to the mainboard using standard aviation plug GX16 male and female metal sockets. For greenhouse application, it is very important that all enclosures are high-quality ABS flame retardant material, corrosion resistance, anti-UV and anti-aging, antistatic, good sealing performance, long life, and suitable for all types of environments. The performance of these components and the metal sockets has been tested for over 12 months in different open-field and closed-field agriculture production. The external battery shown in **Figure 8** is 5.0 V, 2400mAh that can be continuously charged with a 5 V, 500mAh solar panel, and can last over two years without any maintenance at 60 readings per hour when the mainboard is operating in deep-sleep mode. The voltage of the battery can be adjusted and increased to 7.7 V or reduced to 3.8 V for other applications. It is recommended that those sensor probes that are not intended to be used during the data collection should not be connected to the boards. Since several sensors share the same power line, a sensor that is not going to be used and still connected to the board will entail an additional consumption, resulting in a shorter life of the battery. **Figure 8** also shows that the microclimate sensor has been placed in a protective shell to withstand direct sunlight and moisture, and to stabilize the air temperature and relative humidity for more accurate measurement and preventing errors. Other types of shells for microclimate sensors can be used for greenhouse depending on the application. These shells are waterproof and will keep water from seeping into the body of the sensor and damaging it, while at the same time airflow can pass through.

#### **Figure 8.**

*A hybrid data acquisition system with modular solar charged external battery, plug-and-sense probes, 32GB onboard, and multiple communication interfaces for data transfer including serial port, WiFi, and LoRa 868Mhz. Image by courtesy of Adaptive AgroTech.*

**9**

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial…*

The trend in the monitoring of environmental parameters inside modern greenhouses is towards shifting from offline systems to wireless and cloud-based data collection architecture. Various remote systems, either by means of prototype or commercial, have been used for improving the performance of greenhouse monitoring. Some of the most recent examples include web-based, cloud-based, and IoT data collection, monitoring and control system [2, 3], wireless sensor networks [5, 8], field server-based monitoring [11], field router systems [12], and distributed data acquisition with a local controller and management [9]. A comprehensive comparison between the existing remote monitoring system in agricultural research is available in the work of [13]. It should be mentioned that the core part of any IoT sensing and control system is the wireless communication between the devices and the internet. A summary of the wireless communication that can be used in the greenhouse industry is presented in **Table 1** to provide a quick comparison between their frequency bands, sensitivity, and coverage range. Network health

**2.3 Wireless communication and IoT-based monitoring and control**

analyzer software can also be used to check data transfer reliability.

IoT-based monitoring solutions [3] reduce data collection errors in greenhouse environments, while at the same time increase the flexibility of the remote control of devices. Real-time data generated from this process enables growers to have a continuous evaluation of the crop growth environment through dynamic assessment. The traditional techniques frequently suffer from great labor intensity, low spatiotemporal resolution, a lack of mechanization and organization and also needing much time in the growing of plants and observing the environmental aspects of the greenhouse. To address these problems, an IoT controller board and a modular wireless Datalogger system shown in **Figure 9** were custom-designed to provide communication between sensor nodes, end-users, and greenhouse actuators. The controller has an onboard Raspberry Pi computer and two microcontrollers and is capable of receiving command signals using WiFi connection to run an 8-channel relay board, and two motor drivers. The control signals can be either generated by the greenhouse crop models algorithms that are coded into the onboard computer, or by the cloud-based streaming systems. At the same time, environmental sensors can collect measurements, store data on a SD card, and transmit data directly to a webserver, or via wireless communication to a gateway using LoRa 868Mhz frequency. This platform allows real-time monitoring of the data on Adaptive AgroTech private secure cloud system which is accessible at iot.adaptiveagrotech.com or by installing the mobile application. A detailed description of this platform is available in [3]. Some of the specific application of the modular and flexible IoT automation system shown in **Figure 9** can be summarized as: multi-purpose application for real-time monitoring in closed-field and open-field agriculture, measuring optimality degree and comfort ratio of greenhouse environments, as well as yield prediction of tomato using Simulink blocks and embedded crop growth models, prevention of plant diseases based on predictive models, multiple voltage lines for DC actuators, 8-channel relay controller, two stepper and DC motor drivers, open-source programming, LoRaWAN connectivity with built-in light sensor, GPS, and microclimate sensor, and waterproof IP66 enclosure with external battery module and charging circuits. The architecture of the data transmission from sensor nodes to cloud-storage and from web-server to the controller is shown in **Figure 10**. A total of four layers, including the farm layer (with sensor nodes), the backend layer, the wrapper later, and the frontend later are integrated in a way that end users can access data from their phone or desktop applications for real-time monitoring of the sensor measurements. In this scheme, each request sender is treated as the client, and the response provider as the server. The farm later has the role of (i) provider, in which wireless sensor nodes in

*DOI: http://dx.doi.org/10.5772/intechopen.97714*

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial… DOI: http://dx.doi.org/10.5772/intechopen.97714*

#### **2.3 Wireless communication and IoT-based monitoring and control**

The trend in the monitoring of environmental parameters inside modern greenhouses is towards shifting from offline systems to wireless and cloud-based data collection architecture. Various remote systems, either by means of prototype or commercial, have been used for improving the performance of greenhouse monitoring. Some of the most recent examples include web-based, cloud-based, and IoT data collection, monitoring and control system [2, 3], wireless sensor networks [5, 8], field server-based monitoring [11], field router systems [12], and distributed data acquisition with a local controller and management [9]. A comprehensive comparison between the existing remote monitoring system in agricultural research is available in the work of [13]. It should be mentioned that the core part of any IoT sensing and control system is the wireless communication between the devices and the internet. A summary of the wireless communication that can be used in the greenhouse industry is presented in **Table 1** to provide a quick comparison between their frequency bands, sensitivity, and coverage range. Network health analyzer software can also be used to check data transfer reliability.

IoT-based monitoring solutions [3] reduce data collection errors in greenhouse environments, while at the same time increase the flexibility of the remote control of devices. Real-time data generated from this process enables growers to have a continuous evaluation of the crop growth environment through dynamic assessment. The traditional techniques frequently suffer from great labor intensity, low spatiotemporal resolution, a lack of mechanization and organization and also needing much time in the growing of plants and observing the environmental aspects of the greenhouse. To address these problems, an IoT controller board and a modular wireless Datalogger system shown in **Figure 9** were custom-designed to provide communication between sensor nodes, end-users, and greenhouse actuators. The controller has an onboard Raspberry Pi computer and two microcontrollers and is capable of receiving command signals using WiFi connection to run an 8-channel relay board, and two motor drivers. The control signals can be either generated by the greenhouse crop models algorithms that are coded into the onboard computer, or by the cloud-based streaming systems. At the same time, environmental sensors can collect measurements, store data on a SD card, and transmit data directly to a webserver, or via wireless communication to a gateway using LoRa 868Mhz frequency. This platform allows real-time monitoring of the data on Adaptive AgroTech private secure cloud system which is accessible at iot.adaptiveagrotech.com or by installing the mobile application. A detailed description of this platform is available in [3]. Some of the specific application of the modular and flexible IoT automation system shown in **Figure 9** can be summarized as: multi-purpose application for real-time monitoring in closed-field and open-field agriculture, measuring optimality degree and comfort ratio of greenhouse environments, as well as yield prediction of tomato using Simulink blocks and embedded crop growth models, prevention of plant diseases based on predictive models, multiple voltage lines for DC actuators, 8-channel relay controller, two stepper and DC motor drivers, open-source programming, LoRaWAN connectivity with built-in light sensor, GPS, and microclimate sensor, and waterproof IP66 enclosure with external battery module and charging circuits.

The architecture of the data transmission from sensor nodes to cloud-storage and from web-server to the controller is shown in **Figure 10**. A total of four layers, including the farm layer (with sensor nodes), the backend layer, the wrapper later, and the frontend later are integrated in a way that end users can access data from their phone or desktop applications for real-time monitoring of the sensor measurements. In this scheme, each request sender is treated as the client, and the response provider as the server. The farm later has the role of (i) provider, in which wireless sensor nodes in

*Next-Generation Greenhouses for Food Security*

while at the same time airflow can pass through.

*868Mhz. Image by courtesy of Adaptive AgroTech.*

*A hybrid data acquisition system with modular solar charged external battery, plug-and-sense probes, 32GB onboard, and multiple communication interfaces for data transfer including serial port, WiFi, and LoRa* 

these transmitter boards and receiver (gateway) is realized through Lora technology (433 MHz (Asia), 868 MHz (Europe) and 915 MHz (Australia and North America)) which covers 2 ~ 10 km distance in rural areas and is extendable to 100 km with repeaters. By default these boards have been programmed to read and record measurements every 10 seconds which can be adjusted according to the growers' needs. Data are stored on an onboard mini SD card or are transferred to an open-source secure cloud database via WiFi connection. Data can be viewed online at http://iot. adaptiveagrotech.com/ or by installing Adaptive AgroTech smartphone app.

The wireless sensor and controller boards as well as other electronic components and modules are housed in sealed waterproof ABS enclosures that are rated as IP-66 in order to withstand harsh environmental conditions such as sunlight, dust, moisture, high humidity, insects, and sudden changes in temperature. **Figure 8** shows a hybrid data acquisition system with modular components including the main connectivity board, sensor probes, connector cables, external solar-charged battery, and a solar panel. These components are interchangeable and can be connected to the mainboard using standard aviation plug GX16 male and female metal sockets. For greenhouse application, it is very important that all enclosures are high-quality ABS flame retardant material, corrosion resistance, anti-UV and anti-aging, antistatic, good sealing performance, long life, and suitable for all types of environments. The performance of these components and the metal sockets has been tested for over 12 months in different open-field and closed-field agriculture production. The external battery shown in **Figure 8** is 5.0 V, 2400mAh that can be continuously charged with a 5 V, 500mAh solar panel, and can last over two years without any maintenance at 60 readings per hour when the mainboard is operating in deep-sleep mode. The voltage of the battery can be adjusted and increased to 7.7 V or reduced to 3.8 V for other applications. It is recommended that those sensor probes that are not intended to be used during the data collection should not be connected to the boards. Since several sensors share the same power line, a sensor that is not going to be used and still connected to the board will entail an additional consumption, resulting in a shorter life of the battery. **Figure 8** also shows that the microclimate sensor has been placed in a protective shell to withstand direct sunlight and moisture, and to stabilize the air temperature and relative humidity for more accurate measurement and preventing errors. Other types of shells for microclimate sensors can be used for greenhouse depending on the application. These shells are waterproof and will keep water from seeping into the body of the sensor and damaging it,

**8**

**Figure 8.**


**11**

**Figure 10.**

**Figure 9.**

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial…*

**Transmission power**

LoRaWAN 923 MHz 18.5 dBm −136 dBm > 15 km —

**Sensitivity Range\* Certification**

18.5 dBm −136 dBm > 15 km —

18.5 dBm −136 dBm > 15 km —

**bands**

928 MHz

867 MHz

*A prototype IoT automation system used in real-time monitoring and control of greenhouse environments, (a) a controller board with two WiFi modules, onboard computer, 8-channel relays, and 2 stepper motor drivers, (b) a wireless LoRa sensor and Datalogger with modular components, (c) a custom-built sensor platform.*

*A general architecture of a WSN based monitoring of greenhouse environment.*

*DOI: http://dx.doi.org/10.5772/intechopen.97714*

LoRaWAN 915-

LoRaWAN 865-

*Line of sight and Fresnel zone clearance with 5dBi dipole antenna.*

*Standard wireless communications used in agricultural applications.*

**Radio Protocol Frequency** 

LoRaWAN AU

LoRaWAN IN

LoRaWAN ASIA-PAC/ LATAM

*\**

**Table 1.**

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial… DOI: http://dx.doi.org/10.5772/intechopen.97714*


#### **Table 1.**

*Next-Generation Greenhouses for Food Security*

**Radio Protocol Frequency** 

XBee-PRO 802.15.4 EU

XBee-PRO 802.15.4

XBee 900HP US

XBee 900HP BR

XBee 900HP AU

WiFi WiFi

4G EU/BR 4G/3G/2G

4G US 4G/3G/2G

4G AU 4G (HTTP,

(HTTP(S), FTP, TCP, UDP)

(HTTP, FTP, TCP, UDP) GPS

(HTTP, FTP, TCP, UDP) GPS

FTP, TCP, UDP)

LoRaWAN 902-

928 MHz

**bands**

800, 850, 900, 1800, 2100, 600 MHz

700, 850, 1700, 1900 MHz

700, 1800, 2600 MHz

Sigfox EU Sigfox 868 MHz 16 dBm −126 dBm km

Sigfox US Sigfox 900 MHz 24 dBm −127 dBm km

**Transmission power**

XBee 868LP RF 868 MHz 14 dBm −106 dBm 8.4 km CE

4G: class 3 (0.2 W, 23 dBm)

4G: class 3 (0.2 W, 23 dBm)

4G: class 3 (0.2 W, 23 dBm)

Sigfox 900 MHz 24 dBm −127 dBm km

LoRaWAN 868 MHz 14 dBm −136 dBm > 15 km CE

802.15.4 2.4 GHz 10 dBm -100 dBm 750 m CE

802.15.4 2.4 GHz 18 dBm -100 dBm 1600 m FCC, IC,

RF 900 MHz 24 dBm −110 dBm 15.5 km FCC, IC

RF 900 MHz 24 dBm −110 dBm 15.5 km ANATEL

RF 900 MHz 24 dBm −110 dBm 15.5 km RCM

2.4 GHz 17 dBm −94 dBm 500 m CE, FCC, IC,

4G: −102 dBm

4G: −103 dBm

4G: −102 dBm







18.5 dBm −136 dBm > 15 km FCC, IC

**Sensitivity Range\* Certification**

ANATEL, RCM

ANATEL, RCM

CE, ANATEL

FCC, IC, PTCRB, AT&T

RCM

CE

FCC, IC

—

**10**

Sigfox AU / APAC / LATAM

LoRaWAN EU

LoRaWAN US

*Standard wireless communications used in agricultural applications.*

#### **Figure 9.**

*A prototype IoT automation system used in real-time monitoring and control of greenhouse environments, (a) a controller board with two WiFi modules, onboard computer, 8-channel relays, and 2 stepper motor drivers, (b) a wireless LoRa sensor and Datalogger with modular components, (c) a custom-built sensor platform.*

#### **Figure 10.**

*A general architecture of a WSN based monitoring of greenhouse environment.*

the farm collect data and transmit to a gateway device that has access to the internet using WiFi protocol, or convert the data packet to JSON format before sending the data to the backend layer using HTTPS protocol, (ii) client, in which each wireless node sends requests to the backend and receive responses in JSON format via HTTP protocol. The backend layer consists of a middle layer between the backend server and the farm layer. A middle device or server in the backend layer that uses WiFi and REST API providers first receive data from the farm layer and then transfer the packets to the backend layer. The programming language used in the backend server is C# and the database is an SQL server. Received data are pre-processed, analyzed, and then categorized using queries, crop models, and AI algorithms, and are then saved in the database using controllers that have been implemented in the C# frameworks. The queries can run on the database to receive responses in the defined format. The communication between the backend server and SQL server is established using HTTP protocol and JSON format. The wrapper layer includes the cloud storage in which processed data from the backend are sent to IoT serve and are saved. This gives the user the advantage of having a secure backup of the collected data. The provider receives data from the backend layer and for further real-time assessment of the field condition. The input of this layer is the transferred data which are collected every 5 or 10 minutes by the field layer (sensor nodes in the farm). The frontend layer, also called the presentation layer, provides data visualization by means of real-time plots, control buttons, and indicators on, mobile apps, webpages, or other platforms. The frontend layer can have access to the collected data via the backend layer using sendand-request protocols, and receive responses from the wrapper layer. The presented wireless IoT framework was tested in various greenhouse environments and showed that while the sensor measurement was 100%, the network mean packet reliability was between 95 and 100% due to the packet losses. This failure can be related to the high-density plants canopy which can significantly reduce the signal strength of the sensor nodes. Graphical results of experimenting with the wireless sensor and IoT controllers are provided in **Figures 11** and **12**.

### **2.4 Case study: verifying performance of a crop model with a WiFi sensor node**

In order to improve greenhouse yield and profits, collected data from multiple wireless sensors that are deployed in different parts of the greenhouse should be used with knowledge-based software, and crop growth models. These models are often sensitive to boundary inputs and may cause inaccurate simulation results. The objective of this case study was to use a WiFi sensor node for collecting air temperature and light data in order to evaluate parameter robustness of the reduced state-variable TOMGRO model [14] for yield estimation of tomato in a random greenhouse. The hypothesis was to test whether the model parameters are robust enough to translate an adverse greenhouse environment (with air temperature so high to prevent any crop growth development) to realistic biomass and yield. For this purpose, TOMGRO was first implemented in Matlab Simulink in order to create a flexible platform for easier interfacing with the inputs and outputs. The final Simulink block was validated with the Lakecity datasets of [14]. To produce boundary data, an experiment was carried out in an empty glass-panels covered greenhouse under tropical lowlands climate conditions by turning off all ventilation and cooling systems for creating an adverse microclimate scenario with zero yield expectation. The glasshouse was located at the campus of Malaysian Agricultural Research and Development Institute (Latitude: 2°59′24.7", Longitude: 101°41'56.1"). Hourly measurements of air temperature and solar radiation were continuously collected for 254 days using a WiFi sensor node similar to the one shown in **Figure 13**. Plots of raw air temperature and solar radiation data from the glasshouse experiment are also shown in **Figure 13** followed by a detailed outlook of

**13**

**Figure 12.**

**Figure 11.**

*inside a greenhouse storage room.*

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial…*

air temperature plots that shows daily maximum, averaged, and minimum values. It can be seen that air temperature readings inside the glasshouse have reached to 68°C in some specific hours, which not only prevents tomato growth, but can also have serious negative impacts on the solar-charged battery of the WiFi sensor node. In addition, daily averaged air temperature values between hours of 12:00 and 18:00 are in the range of 30 to 50°C. The average, minimum and maximum values during the entire experiment were equal to 34.5, 22.5, and 68.3°C, corresponding to a simulated growth response of zero between hours of 12:00 and 18:00. Results of simulation with

*Sample of air temperature data collected every 60 seconds using Adaptive AgroTech LoRaWAN sensor located* 

*Lab scale implementation of IoT monitoring and control of light level using LoRa 868 Mhz transceivers.*

*DOI: http://dx.doi.org/10.5772/intechopen.97714*

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial… DOI: http://dx.doi.org/10.5772/intechopen.97714*

**Figure 11.**

*Next-Generation Greenhouses for Food Security*

controllers are provided in **Figures 11** and **12**.

the farm collect data and transmit to a gateway device that has access to the internet using WiFi protocol, or convert the data packet to JSON format before sending the data to the backend layer using HTTPS protocol, (ii) client, in which each wireless node sends requests to the backend and receive responses in JSON format via HTTP protocol. The backend layer consists of a middle layer between the backend server and the farm layer. A middle device or server in the backend layer that uses WiFi and REST API providers first receive data from the farm layer and then transfer the packets to the backend layer. The programming language used in the backend server is C# and the database is an SQL server. Received data are pre-processed, analyzed, and then categorized using queries, crop models, and AI algorithms, and are then saved in the database using controllers that have been implemented in the C# frameworks. The queries can run on the database to receive responses in the defined format. The communication between the backend server and SQL server is established using HTTP protocol and JSON format. The wrapper layer includes the cloud storage in which processed data from the backend are sent to IoT serve and are saved. This gives the user the advantage of having a secure backup of the collected data. The provider receives data from the backend layer and for further real-time assessment of the field condition. The input of this layer is the transferred data which are collected every 5 or 10 minutes by the field layer (sensor nodes in the farm). The frontend layer, also called the presentation layer, provides data visualization by means of real-time plots, control buttons, and indicators on, mobile apps, webpages, or other platforms. The frontend layer can have access to the collected data via the backend layer using sendand-request protocols, and receive responses from the wrapper layer. The presented wireless IoT framework was tested in various greenhouse environments and showed that while the sensor measurement was 100%, the network mean packet reliability was between 95 and 100% due to the packet losses. This failure can be related to the high-density plants canopy which can significantly reduce the signal strength of the sensor nodes. Graphical results of experimenting with the wireless sensor and IoT

**2.4 Case study: verifying performance of a crop model with a WiFi sensor node**

In order to improve greenhouse yield and profits, collected data from multiple wireless sensors that are deployed in different parts of the greenhouse should be used with knowledge-based software, and crop growth models. These models are often sensitive to boundary inputs and may cause inaccurate simulation results. The objective of this case study was to use a WiFi sensor node for collecting air temperature and light data in order to evaluate parameter robustness of the reduced state-variable TOMGRO model [14] for yield estimation of tomato in a random greenhouse. The hypothesis was to test whether the model parameters are robust enough to translate an adverse greenhouse environment (with air temperature so high to prevent any crop growth development) to realistic biomass and yield. For this purpose, TOMGRO was first implemented in Matlab Simulink in order to create a flexible platform for easier interfacing with the inputs and outputs. The final Simulink block was validated with the Lakecity datasets of [14]. To produce boundary data, an experiment was carried out in an empty glass-panels covered greenhouse under tropical lowlands climate conditions by turning off all ventilation and cooling systems for creating an adverse microclimate scenario with zero yield expectation. The glasshouse was located at the campus of Malaysian Agricultural Research and Development Institute (Latitude: 2°59′24.7", Longitude: 101°41'56.1"). Hourly measurements of air temperature and solar radiation were continuously collected for 254 days using a WiFi sensor node similar to the one shown in **Figure 13**. Plots of raw air temperature and solar radiation data from the glasshouse experiment are also shown in **Figure 13** followed by a detailed outlook of

**12**

*Sample of air temperature data collected every 60 seconds using Adaptive AgroTech LoRaWAN sensor located inside a greenhouse storage room.*

**Figure 12.**

*Lab scale implementation of IoT monitoring and control of light level using LoRa 868 Mhz transceivers.*

air temperature plots that shows daily maximum, averaged, and minimum values. It can be seen that air temperature readings inside the glasshouse have reached to 68°C in some specific hours, which not only prevents tomato growth, but can also have serious negative impacts on the solar-charged battery of the WiFi sensor node. In addition, daily averaged air temperature values between hours of 12:00 and 18:00 are in the range of 30 to 50°C. The average, minimum and maximum values during the entire experiment were equal to 34.5, 22.5, and 68.3°C, corresponding to a simulated growth response of zero between hours of 12:00 and 18:00. Results of simulation with

#### **Figure 13.**

*Performance of IoT monitoring with WiFi sensor node in an empty glasshouse without climate control for testing the performance of the connectivity board and battery modules under adversely hot and humid environment.*

TOMGRO model showed that the estimated total above-ground dry weight (WT), total fruit dry weight (WF), and mature fruit dry weight (WM) were equal to 0.576, 0.085 and 0.072 kg/m2 respectively. This study tested the claimed conclusion of [14] that states "it is possible to use the same reduced model with parameters estimated at one location to simulate leaf area and above-ground weight of tomato growing in greenhouse conditions in other locations" using boundary data that were continuously collected by a WiFi sensor node: Based on the consistency of the low estimated fruit yield with the simulated growth responses, the hypothesis that the simplified TOMGRO model with its initial parameters is not capable of estimating tomato yield for a random greenhouse in a different geographical location was rejected. It can be concluded that long-term historical data collected by IoT sensor nodes can be used to improve the performance of crop models, as well as offering new insights to add artificial intelligence algorithms to the automation system.

#### **3. Artificial intelligence in greenhouse automation**

Automation and control of greenhouse environments have to deal with various uncertainties and disturbances that cannot be entirely modeled by mathematical equations [1, 7, 15–17]. Adding artificial intelligence to greenhouse automation

**15**

**Figure 14.**

*the structural design and outside condition.*

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial…*

means that the AI algorithm must coexist with all other pieces of the automation system fluidly, including multiple sensors, physical systems that control devices and actuators. The main justification for designing AI-based automation systems in greenhouse environments such as those that operate with fuzzy logic or neural network algorithms is to shift toward a robust, predictive, and adaptive control command strategies that reduce production costs and improve yield. Artificial intelligence is a computer system that is programmed to present intelligent behavior by perceiving the environment, making decisions, and taking action. AI can contribute to sustainable greenhouse production in different ways such as reducing the electrical energy consumption of the climate control systems, or reducing water and chemical demands for fertigation system. For example, AI algorithms can be implemented for updating microclimate set-points (also known as reference values) depending on a specific crop, growth stages, light conditions, and external variables. These set-points are conventionally created manually by expert growers, or by means of knowledge-based decision support systems such as adaptive management [18] or dynamic assessment [19]. Set-points [6] are the core inputs of the microclimate control system and therefore must be calculated precisely, otherwise production failure and crop loss can occur in a few hours. Results of an experiment with three different tropical greenhouses in the lowlands of Malaysia that are shown in **Figure 14** reveal that without proper climate control algorithms, air temperature can reach 37°C or

60°C depending on the structural design and external condition [20, 21].

To overcome these challenges, a conventional greenhouse climate controller that triggers ventilation, misting, or spraying in order to reduce air temperature was developed and tested (**Figure 15**). During cold seasons, the controller was interfaced with time-based or sensor-based actuators for triggering of the heating system. These approached however are not efficient for high-tech large-scale greenhouses. An integrated climate control system should not only benefit from the wireless and IoT automation technology, but also from the innovative cooling and heating methods that operates based on AI algorithms. In this scheme, collected data from multiple wireless sensors that are deployed in different parts of the greenhouse are used to train machine learning algorithms that have been designed based on knowledge-based systems and mathematical crop growth models. The output commands and decision messages from this process are then used to control

*Wireless monitoring of microclimate inside three tropical greenhouses with different covering materials (A: net-screen, B: polyethylene film, C: Polycarbonate panels) without proper climate control algorithms showing that air temperature are significantly far from optimal set-points and can exceed 37 °C or 60 °C depending on* 

*DOI: http://dx.doi.org/10.5772/intechopen.97714*

#### *Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial… DOI: http://dx.doi.org/10.5772/intechopen.97714*

means that the AI algorithm must coexist with all other pieces of the automation system fluidly, including multiple sensors, physical systems that control devices and actuators. The main justification for designing AI-based automation systems in greenhouse environments such as those that operate with fuzzy logic or neural network algorithms is to shift toward a robust, predictive, and adaptive control command strategies that reduce production costs and improve yield. Artificial intelligence is a computer system that is programmed to present intelligent behavior by perceiving the environment, making decisions, and taking action. AI can contribute to sustainable greenhouse production in different ways such as reducing the electrical energy consumption of the climate control systems, or reducing water and chemical demands for fertigation system. For example, AI algorithms can be implemented for updating microclimate set-points (also known as reference values) depending on a specific crop, growth stages, light conditions, and external variables. These set-points are conventionally created manually by expert growers, or by means of knowledge-based decision support systems such as adaptive management [18] or dynamic assessment [19]. Set-points [6] are the core inputs of the microclimate control system and therefore must be calculated precisely, otherwise production failure and crop loss can occur in a few hours. Results of an experiment with three different tropical greenhouses in the lowlands of Malaysia that are shown in **Figure 14** reveal that without proper climate control algorithms, air temperature can reach 37°C or 60°C depending on the structural design and external condition [20, 21].

To overcome these challenges, a conventional greenhouse climate controller that triggers ventilation, misting, or spraying in order to reduce air temperature was developed and tested (**Figure 15**). During cold seasons, the controller was interfaced with time-based or sensor-based actuators for triggering of the heating system. These approached however are not efficient for high-tech large-scale greenhouses. An integrated climate control system should not only benefit from the wireless and IoT automation technology, but also from the innovative cooling and heating methods that operates based on AI algorithms. In this scheme, collected data from multiple wireless sensors that are deployed in different parts of the greenhouse are used to train machine learning algorithms that have been designed based on knowledge-based systems and mathematical crop growth models. The output commands and decision messages from this process are then used to control

#### **Figure 14.**

*Wireless monitoring of microclimate inside three tropical greenhouses with different covering materials (A: net-screen, B: polyethylene film, C: Polycarbonate panels) without proper climate control algorithms showing that air temperature are significantly far from optimal set-points and can exceed 37 °C or 60 °C depending on the structural design and outside condition.*

*Next-Generation Greenhouses for Food Security*

TOMGRO model showed that the estimated total above-ground dry weight (WT), total fruit dry weight (WF), and mature fruit dry weight (WM) were equal to 0.576,

*Performance of IoT monitoring with WiFi sensor node in an empty glasshouse without climate control for testing the performance of the connectivity board and battery modules under adversely hot and humid* 

that states "it is possible to use the same reduced model with parameters estimated at one location to simulate leaf area and above-ground weight of tomato growing in greenhouse conditions in other locations" using boundary data that were continuously collected by a WiFi sensor node: Based on the consistency of the low estimated fruit yield with the simulated growth responses, the hypothesis that the simplified TOMGRO model with its initial parameters is not capable of estimating tomato yield for a random greenhouse in a different geographical location was rejected. It can be concluded that long-term historical data collected by IoT sensor nodes can be used to improve the performance of crop models, as well as offering new insights to add

Automation and control of greenhouse environments have to deal with various uncertainties and disturbances that cannot be entirely modeled by mathematical equations [1, 7, 15–17]. Adding artificial intelligence to greenhouse automation

artificial intelligence algorithms to the automation system.

**3. Artificial intelligence in greenhouse automation**

respectively. This study tested the claimed conclusion of [14]

**14**

0.085 and 0.072 kg/m2

**Figure 13.**

*environment.*

**Figure 15.**

*Lab-scale implementation of IoT monitoring and control of air temperature, (left): 4 PID plus 2 manualcontrolled fans, and (right): 4 PID plus 2 AI-controlled fans.*

specific elements within the crop growth microenvironment while at the same time they are optimized to reduce energy, chemicals, and water demands. An example of this approach was implemented on a lab-scale greenhouse shown in **Figure 15** by performing PID speed control on 4 ventilation fans, and manual speed control on the other two fans (referred to as AI fans) for obtaining training dataset. The presented platform allowed experimenting with various methods, including fuzzylogic self-tuning PID controller and machine learning to adjust the speed of the two AI fans. The air temperature responses were then monitored in real-time using WiFi sensor nodes and are shown by the two plots in **Figure 15**. A simple fuzzy logic control algorithm was also implemented on a research tropical greenhouse shown in **Figure 16** to demonstrate the difference between air temperature response in a timer-based control and intelligent control. A summary of the fuzzy logic rules is presented in **Tables 2** and **3**.

Another example of AI application in greenhouses is the prediction of microclimate parameters as demonstrated in **Figure 17**. This prediction can be used for advanced microclimate control systems such as adaptive or predictive control, energy demand calculation, or for applications such as disease prevention, decision support systems, and cost–benefit analysis. It should be noted that building a successful AI algorithm for this purpose requires navigating the entire AI workflow and focusing on more than just one training data set and model. In this example, several datasets of the past 10 days from different tropical greenhouses were used to predict the 11th day data. Extensive simulations with different numbers of days were used to find out

#### **Figure 16.**

*A comparison between timer-based and fuzzy-logic based control of air temperature in an experimental greenhouse under lowland climate conditions of Malaysia.*

**17**

**Table 3.**

**Table 2.**

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial…*

**et + 1 (Ts- Tin (t + 1))** Δ**e Output**

Negative, Δe = Zero

Negative, Δe = Positive

Negative, Δe = Negative

Δe = Zero

Δe = Positive

Δe = Negative

Positive, Δe = Zero

Positive, Δe = Positive

Positive, Δe = Negative

**Negative Zero Positive Positive Big**

Warm Normal Warm

condition

Cooling

Cooling

STOP Cooling

Normal

Warm Normal Warm Big Warm Big

**Cool Normal**

Stop Cool

Cool Big

Ideal

Warm Normal

Cool Normal

Warm Big

Warm Very Big

Warm Normal

Warm Normal

Warm Normal

Warm Normal

Warm Big

**et (Ts- Tin (t))**

**1 25 30 30** −**5** −**5 0** e =

**2** 25 30 29 −5 −4 +1 e =

**3** 25 30 31 −5 −6 −1 e =

**4** 25 25 25 0 0 0 e = Zero,

**5** 25 25 24 0 +1 +1 e = Zero,

**6** 25 25 26 0 −1 −1 e = Zero,

**7** 25 20 20 +5 +5 0 e =

**8** 25 20 19 +5 +6 +1 e =

**9** 25 20 21 +5 +4 −1 e =

**Negative Big** Cool Big Cool Big Cool STOP

**Negative** Cool Big Cool Cool STOP

STOP Cooling

Warm Normal

**Zero** Cool Cool Current

*(t + 1) = Ts- Tin (t + 1),* Δ*e = change of error = e (t + 1) - e (t).*

**Big**

Cooling

Cooling

**errorΔerror Negative** 

**Positive** STOP

**Positive Big** STOP

*The fuzzy logic rule table.*

*Example of a simple fuzzy logic control algorithm implemented on a research tropical greenhouse,: Ts = Tsetpoint, Tin (t) = Tinside at Time (t), Tin (t + 1) = Tinside at Time (t + 1), et = error at Time (t) = Ts- Tin (t), et + 1 = error at Time* 

*DOI: http://dx.doi.org/10.5772/intechopen.97714*

**AirTinside T(t + 1)**

**T(t)**

**State Tsetpoint AirTinside**


*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial… DOI: http://dx.doi.org/10.5772/intechopen.97714*

#### **Table 2.**

*Next-Generation Greenhouses for Food Security*

*controlled fans, and (right): 4 PID plus 2 AI-controlled fans.*

presented in **Tables 2** and **3**.

**Figure 15.**

specific elements within the crop growth microenvironment while at the same time they are optimized to reduce energy, chemicals, and water demands. An example of this approach was implemented on a lab-scale greenhouse shown in **Figure 15** by performing PID speed control on 4 ventilation fans, and manual speed control on the other two fans (referred to as AI fans) for obtaining training dataset. The presented platform allowed experimenting with various methods, including fuzzylogic self-tuning PID controller and machine learning to adjust the speed of the two AI fans. The air temperature responses were then monitored in real-time using WiFi sensor nodes and are shown by the two plots in **Figure 15**. A simple fuzzy logic control algorithm was also implemented on a research tropical greenhouse shown in **Figure 16** to demonstrate the difference between air temperature response in a timer-based control and intelligent control. A summary of the fuzzy logic rules is

*Lab-scale implementation of IoT monitoring and control of air temperature, (left): 4 PID plus 2 manual-*

Another example of AI application in greenhouses is the prediction of microclimate parameters as demonstrated in **Figure 17**. This prediction can be used for advanced microclimate control systems such as adaptive or predictive control, energy demand calculation, or for applications such as disease prevention, decision support systems, and cost–benefit analysis. It should be noted that building a successful AI algorithm for this purpose requires navigating the entire AI workflow and focusing on more than just one training data set and model. In this example, several datasets of the past 10 days from different tropical greenhouses were used to predict the 11th day data. Extensive simulations with different numbers of days were used to find out

*A comparison between timer-based and fuzzy-logic based control of air temperature in an experimental* 

*greenhouse under lowland climate conditions of Malaysia.*

**16**

**Figure 16.**

*Example of a simple fuzzy logic control algorithm implemented on a research tropical greenhouse,: Ts = Tsetpoint, Tin (t) = Tinside at Time (t), Tin (t + 1) = Tinside at Time (t + 1), et = error at Time (t) = Ts- Tin (t), et + 1 = error at Time (t + 1) = Ts- Tin (t + 1),* Δ*e = change of error = e (t + 1) - e (t).*


**Table 3.** *The fuzzy logic rule table.*

**Figure 17.**

*Preliminary results of predicting the next 24 hours of air temperature, relative humidity, and vapor pressure deficit in a naturally ventilated tropical greenhouse using feed-forward neural network and a 10-days dataset.*

#### **Figure 18.**

*IoT realization of the adaptive management framework using Simulink blocks, LoRa 868Mhz sensor node, and raspberry Pi embedded board for evaluation and adjusting greenhouse microclimate.*

that a dataset that includes at least the past 10 days' measurement is required for the AI algorithm to effectively predict the microclimate of the next day. In this example, data preparation was more than having a lot of data or even pre-processing all of the data to be consistent. This process involved adding human insight to the selection of the training data, as well as considering augmenting data sets with synthetic data and more samples, and providing clean labeled data. In this regard, choosing the right AI algorithm, such as machine learning, deep learning, or a combination, and identifying the optimal set of parameters will lead to the most robust and accurate prediction model. As mentioned before, simulation techniques are extensively used to verify the performance of AI algorithms in every situation and scenario, such as different climate conditions, greenhouse structural design, covering materials, the crop that is being cultivated, and the growth stage. An example of simulation is the adaptive management framework [18] that allows growers to verify edge cases and test and

**19**

**4. Conclusion**

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial…*

run hundreds of scenarios that would otherwise be too time-and-cost intensive. In the example of microclimate prediction shown in **Figure 17**, the outputs of the AI which are microclimate data of the next 24 hours are used with predictive and adaptive control algorithms [18], therefore simulation enables validating the control

The final AI-based automation algorithms can be deployed as computer codes or Simulink blocks on cloud-based streaming systems, or on a local onboard computer similar to the one shown in **Figure 18**, which demonstrates IoT sensor fusion in combination with a comfort ratio model [2, 19, 20, 22] for real-time dynamic assessment of microclimate parameters in commercial scale greenhouse production of tomato. This method is based on the integration of wireless communication, distributed data analyzing and a web-based data monitoring dashboard that is used for data collection, processing, and monitoring. The wireless sensor node has shown a high spatiotemporal resolution with excellent stability in data transfer at 10 readings per minute within 1 km distance from the LoRaWAN gateway. The presented boards in **Figure 18** has been used as a proof-of-concept and showed the opportunity to use these new tools for model-based investigation of the spatial and temporal variations in the air temperature, relative humidity and, VPD inside greenhouse crop production [3]. The implication is to provide growers with digital tools that can assist in knowledge-based decision making for minimizing energy cost and yield loss due to low fruit quality. Moreover, the IoT automation system and cloud data processing contribute as a real-time online assessment tool to investigate effects of structure design, covering materials, cooling techniques, and growing seasons on the optimality and comfortability of microclimate parameters and their correlation with yields.

This chapter provided an overview of the application of IoT sensors and controllers that can be integrated with crop models and artificial intelligence algorithms for sustainable greenhouse production. Several affordable yet robust wireless sensor nodes developed by Adaptive AgroTech that benefit from WiFi and LoRa communication were presented with sample results from lab-scale and commercialscale greenhouses. The introduced wireless transceivers were shown to be flexible and modular, which makes possible easy installation anywhere in the greenhouse environments to overcome cable wiring difficulties for the sensors and the LAN connection. Additionally, the flexibility in data sharing can be upgraded on the cloud system with user experience. The generated commands and decisions that are received by the IoT automation board from the cloud-based streaming system are used to control specific elements within the crop growth microenvironment while at the same time they can be optimized by the onboard computer to reduce energy, chemicals, and water demands. It can be concluded that developing a robust and affordable IoT automation system for greenhouse condition should take into account the correct selection and combination of the battery and charging units, the electronic housing box, connectors and plugs, data wire and cables, wireless antenna, and the modularity and compatibility of the package components. Results of experiments inside different greenhouses with high-density plants showed that the major disadvantage of wireless sensor nodes in real-time monitoring is the repeated loss of connection even in mesh applications. The water in the high amount of biomass of the plants damps the radio signals and avoids communication distances over long ranges. This can be solved by using different techniques (that sometimes involve a huge amount of effort), including antennas with cable for higher positions, higher mesh density, multiple gateway nodes, and higher output

*DOI: http://dx.doi.org/10.5772/intechopen.97714*

process before deploying the codes on the actual hardware.

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial… DOI: http://dx.doi.org/10.5772/intechopen.97714*

run hundreds of scenarios that would otherwise be too time-and-cost intensive. In the example of microclimate prediction shown in **Figure 17**, the outputs of the AI which are microclimate data of the next 24 hours are used with predictive and adaptive control algorithms [18], therefore simulation enables validating the control process before deploying the codes on the actual hardware.

The final AI-based automation algorithms can be deployed as computer codes or Simulink blocks on cloud-based streaming systems, or on a local onboard computer similar to the one shown in **Figure 18**, which demonstrates IoT sensor fusion in combination with a comfort ratio model [2, 19, 20, 22] for real-time dynamic assessment of microclimate parameters in commercial scale greenhouse production of tomato. This method is based on the integration of wireless communication, distributed data analyzing and a web-based data monitoring dashboard that is used for data collection, processing, and monitoring. The wireless sensor node has shown a high spatiotemporal resolution with excellent stability in data transfer at 10 readings per minute within 1 km distance from the LoRaWAN gateway. The presented boards in **Figure 18** has been used as a proof-of-concept and showed the opportunity to use these new tools for model-based investigation of the spatial and temporal variations in the air temperature, relative humidity and, VPD inside greenhouse crop production [3]. The implication is to provide growers with digital tools that can assist in knowledge-based decision making for minimizing energy cost and yield loss due to low fruit quality. Moreover, the IoT automation system and cloud data processing contribute as a real-time online assessment tool to investigate effects of structure design, covering materials, cooling techniques, and growing seasons on the optimality and comfortability of microclimate parameters and their correlation with yields.

### **4. Conclusion**

*Next-Generation Greenhouses for Food Security*

*Preliminary results of predicting the next 24 hours of air temperature, relative humidity, and vapor pressure deficit in a naturally ventilated tropical greenhouse using feed-forward neural network and a 10-days dataset.*

*IoT realization of the adaptive management framework using Simulink blocks, LoRa 868Mhz sensor node, and* 

that a dataset that includes at least the past 10 days' measurement is required for the AI algorithm to effectively predict the microclimate of the next day. In this example, data preparation was more than having a lot of data or even pre-processing all of the data to be consistent. This process involved adding human insight to the selection of the training data, as well as considering augmenting data sets with synthetic data and more samples, and providing clean labeled data. In this regard, choosing the right AI algorithm, such as machine learning, deep learning, or a combination, and identifying the optimal set of parameters will lead to the most robust and accurate prediction model. As mentioned before, simulation techniques are extensively used to verify the performance of AI algorithms in every situation and scenario, such as different climate conditions, greenhouse structural design, covering materials, the crop that is being cultivated, and the growth stage. An example of simulation is the adaptive management framework [18] that allows growers to verify edge cases and test and

*raspberry Pi embedded board for evaluation and adjusting greenhouse microclimate.*

**Figure 17.**

**18**

**Figure 18.**

This chapter provided an overview of the application of IoT sensors and controllers that can be integrated with crop models and artificial intelligence algorithms for sustainable greenhouse production. Several affordable yet robust wireless sensor nodes developed by Adaptive AgroTech that benefit from WiFi and LoRa communication were presented with sample results from lab-scale and commercialscale greenhouses. The introduced wireless transceivers were shown to be flexible and modular, which makes possible easy installation anywhere in the greenhouse environments to overcome cable wiring difficulties for the sensors and the LAN connection. Additionally, the flexibility in data sharing can be upgraded on the cloud system with user experience. The generated commands and decisions that are received by the IoT automation board from the cloud-based streaming system are used to control specific elements within the crop growth microenvironment while at the same time they can be optimized by the onboard computer to reduce energy, chemicals, and water demands. It can be concluded that developing a robust and affordable IoT automation system for greenhouse condition should take into account the correct selection and combination of the battery and charging units, the electronic housing box, connectors and plugs, data wire and cables, wireless antenna, and the modularity and compatibility of the package components. Results of experiments inside different greenhouses with high-density plants showed that the major disadvantage of wireless sensor nodes in real-time monitoring is the repeated loss of connection even in mesh applications. The water in the high amount of biomass of the plants damps the radio signals and avoids communication distances over long ranges. This can be solved by using different techniques (that sometimes involve a huge amount of effort), including antennas with cable for higher positions, higher mesh density, multiple gateway nodes, and higher output

power. In general, it is a good practice to store all measurement data using devices that benefits from local memory. Therefore, the asynchronous readout is enabled for the user, and the data is not missed which an efficient practice for IoT is monitoring in large-scale commercial berry production. It is expected that this process embraces the uncertainties, especially in the remote areas, and consequently contributes to a higher yield with lesser inputs.

## **Acknowledgements**

The authors acknowledge the funding support of Adaptive AgroTech Consultancy International for accelerating the research and development phase in prototyping the instruments and conducting the experiments. The technical and editorial assistant received from Adaptive AgroTech members, Peyman Majidi, Keyvan Majidi, Janet Ahmadi, Saeedeh Pourhanife, Batuhan Sakal, and Omid Raftari, as well as the suggestions and guidelines received from Dr. Volker Dworak, Dr. Jana Käthner, and Professor. Cornelia Weltzien of the Leibniz Institute for Agricultural Engineering and Bioeconomy are duly acknowledged.

**21**

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial…*

, Ibrahim A. Hameed<sup>2</sup>

\*

1 Leibniz Institute for Agricultural Engineering and Bioeconomy, Potsdam-Bornim,

2 Department of ICT and Natural Sciences, Faculty of Information Technology and

4 Department of Agriculture Technology, Faculty of Agriculture, Universiti Putra

5 School of Plant and Environmental Sciences, Virginia Polytechnic Institute and

7 Department of Agricultural Engineering, Bahauddin Zakariya University, Multan,

© 2021 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/ by/3.0), which permits unrestricted use, distribution, and reproduction in any medium,

3 United States Department of Agriculture, Agricultural Research Service,

, Sanaz Shafian<sup>5</sup>

and Saba Samiei8

Electrical Engineering, NTNUÅlesund, Norway

6 Adaptive AgroTech Consultancy Int, Seaside, CA, USA

8 Comfort.AI, Blockhouse Bay, Auckland, New Zealand

\*Address all correspondence to: saba@macso.ai

provided the original work is properly cited.

Malaysia, Serdang, Selangor, Malaysia

State University, Blacksburg, USA

, Kelly R. Thorp3

, Mohammad Fatemieh6

,

, Muhammad Sultan7

,

*DOI: http://dx.doi.org/10.5772/intechopen.97714*

**Author details**

Redmond R. Shamshiri1

Siva K. Balasundram4

Benjamin Mahns1

Maricopa, AZ, USA

Germany

Pakistan

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial… DOI: http://dx.doi.org/10.5772/intechopen.97714*

## **Author details**

*Next-Generation Greenhouses for Food Security*

contributes to a higher yield with lesser inputs.

**Acknowledgements**

power. In general, it is a good practice to store all measurement data using devices that benefits from local memory. Therefore, the asynchronous readout is enabled for the user, and the data is not missed which an efficient practice for IoT is monitoring in large-scale commercial berry production. It is expected that this process embraces the uncertainties, especially in the remote areas, and consequently

The authors acknowledge the funding support of Adaptive AgroTech Consultancy International for accelerating the research and development phase in prototyping the instruments and conducting the experiments. The technical and editorial assistant received from Adaptive AgroTech members, Peyman Majidi, Keyvan Majidi, Janet Ahmadi, Saeedeh Pourhanife, Batuhan Sakal, and Omid Raftari, as well as the suggestions and guidelines received from Dr. Volker Dworak, Dr. Jana Käthner, and Professor. Cornelia Weltzien of the Leibniz Institute for

Agricultural Engineering and Bioeconomy are duly acknowledged.

**20**

Redmond R. Shamshiri1 , Ibrahim A. Hameed<sup>2</sup> , Kelly R. Thorp3 , Siva K. Balasundram4 , Sanaz Shafian<sup>5</sup> , Mohammad Fatemieh6 , Muhammad Sultan7 , Benjamin Mahns1 and Saba Samiei8 \*

1 Leibniz Institute for Agricultural Engineering and Bioeconomy, Potsdam-Bornim, Germany

2 Department of ICT and Natural Sciences, Faculty of Information Technology and Electrical Engineering, NTNUÅlesund, Norway

3 United States Department of Agriculture, Agricultural Research Service, Maricopa, AZ, USA

4 Department of Agriculture Technology, Faculty of Agriculture, Universiti Putra Malaysia, Serdang, Selangor, Malaysia

5 School of Plant and Environmental Sciences, Virginia Polytechnic Institute and State University, Blacksburg, USA

6 Adaptive AgroTech Consultancy Int, Seaside, CA, USA

7 Department of Agricultural Engineering, Bahauddin Zakariya University, Multan, Pakistan

8 Comfort.AI, Blockhouse Bay, Auckland, New Zealand

\*Address all correspondence to: saba@macso.ai

© 2021 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/ by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

## **References**

[1] R. R. Shamshiri *et al.*, "Advances in greenhouse automation and controlled environment agriculture: A transition to plant factories and urban agriculture," *Int. J. Agric. Biol. Eng.*, vol. 11, no. 1, 2018.

[2] R. R. Shamshiri *et al.*, "Model-based evaluation of greenhouse microclimate using IoT-Sensor data fusion for energy efficient crop production," *J. Clean. Prod.*, p. 121303, 2020.

[3] S. M. Rezvani *et al.*, "IoT-Based Sensor Data Fusion for Determining Optimality Degrees of Microclimate Parameters in Commercial Greenhouse Production of Tomato," *Sensors*, vol. 20, no. 22, p. 6474, 2020.

[4] C. Serôdio, J. Boaventura Cunha, R. Morais, C. Couto, and J. Monteiro, "A networked platform for agricultural management systems," *Comput. Electron. Agric.*, vol. 31, no. 1, pp. 75-90, 2001.

[5] K. P. Ferentinos, N. Katsoulas, A. Tzounis, T. Bartzanas, and C. Kittas, "Wireless sensor networks for greenhouse climate and plant condition assessment," *Biosyst. Eng.*, vol. 153, pp. 70-81, 2017.

[6] R. R. Shamshiri, J. W. Jones, K. R. Thorp, D. Ahmad, H. C. Man, and S. Taheri, "Review of optimum temperature, humidity, and vapour pressure deficit for microclimate evaluation and control in greenhouse cultivation of tomato: a review," *Int. Agrophysics*, vol. 32, no. 2, pp. 287-302, 2018.

[7] R. Shamshiri, H. Che Man, A. J. Zakaria, P. V. Beveren, W. I. Wan Ismail, and D. Ahmad, *Membership function model for defining optimality of vapor pressure deficit in closed-field cultivation of tomato*, vol. 1152. 2017.

[8] X. Bai, Z. Wang, L. Sheng, and Z. Wang, "Reliable data fusion of hierarchical wireless sensor networks with asynchronous measurement for greenhouse monitoring," *IEEE Trans. Control Syst. Technol.*, no. 99, pp. 1-11, 2018.

[9] D. Ma, N. Carpenter, H. Maki, T. U. Rehman, M. R. Tuinstra, and J. Jin, "Greenhouse environment modeling and simulation for microclimate control," *Comput. Electron. Agric.*, vol. 162, no. November 2018, pp. 134-142, 2019.

[10] M. C. Singh, J. P. Singh, and K. G. Singh, "Development of a microclimate model for prediction of temperatures inside a naturally ventilated greenhouse under cucumber crop in soilless media," *Comput. Electron. Agric.*, vol. 154, no. August, pp. 227-238, 2018.

[11] W. Xin, W. Yu, Z. Yuanyuan, N. Xindong, and W. Shumao, "Intelligent Gateway for Heterogeneous Networks Environment in Remote Monitoring of Greenhouse Facility Information Collection," *IFAC-PapersOnLine*, vol. 51, no. 17, pp. 217-222, 2018.

[12] M. Mizoguchi, T. Ito, A. Chusnul, S. Mitsuishi, and M. Akazawa, "Quasi real-time field network system for monitoring remote agricultural fields," in *SICE Annual Conference 2011*, 2011, pp. 1586-1589.

[13] *A. Prima et al.*, "Development of a remote environmental monitoring and control framework for tropical horticulture and verification of its validity under unstable network connection in rural area," *Comput. Electron. Agric.*, vol. 124, pp. 325-339, 2016.

[14] J. W. Jones, A. Kenig, and C. E. Vallejos, "Reduced state–variable tomato growth model," vol. 42, no. 1994, pp. 255-265, 1999.

[15] A. Pérez-González, O. Begovich-Mendoza, and J. Ruiz-León, "Modeling of a greenhouse prototype using PSO and

**23**

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial…*

parameters in protected cultivation of

condition," *Meas. J. Int. Meas. Confed.*,

tomato under tropical climate

vol. 106, 2017.

*DOI: http://dx.doi.org/10.5772/intechopen.97714*

differential evolution algorithms based on a real-time LabViewTM application," *Appl. Soft Comput.*, vol. 62, pp. 86-100, 2018.

[17] E. Romantchik, E. Ríos, E. Sánchez, I. López, and J. R. Sánchez, "Determination of energy to be supplied by photovoltaic systems for fan-pad systems in cooling process of greenhouses," *Appl. Therm. Eng.*, vol. 114, pp. 1161-1168, 2017.

[18] D. A. and H. C. M. Redmond R. Shamshiri, Muhammad Razif Mahadi, Kelly R. Thorp, Wan Ishak Wan Ismail, "Adaptive management framework for evaluating and adjusting microclimate parameters in tropical greenhouse crop production systems," *Plant Eng.*, 2017.

[19] R. Shamshiri, P. van Beveren, H. Che Man, and A. J. Zakaria, "Dynamic assessment of air temperature for tomato (*Lycopersicon esculentum* mill) cultivation in a naturally ventilated net-screen greenhouse under tropical lowlands climate," *J. Agric. Sci. Technol.*,

[20] R. Shamshiri *et al.*, "Comparative evaluation of naturally ventilated screenhouse and evaporative cooled greenhouse based on optimal vapor pressure deficit," in *2016 American Society of Agricultural and Biological Engineers Annual International Meeting,* 

[21] D. Shamshiri, R., Ismail, W. I. W., & bin Ahmad, "Experimental evaluation of air temperature, relative humidity and vapor pressure deficit in tropical lowland plant production environments," *Adv.* 

vol. 19, no. 1, 2017.

*ASABE 2016*, 2016.

*Environ. Biol.*, 2014.

[22] R. Shamshiri, "Measuring optimality degrees of microclimate

[16] J. Chen, Y. Ma, and Z. Pang, "A mathematical model of global solar radiation to select the optimal shape and orientation of the greenhouses in southern China," *Sol. Energy*, vol. 205,

pp. 380-389, 2020.

*Greenhouse Automation Using Wireless Sensors and IoT Instruments Integrated with Artificial… DOI: http://dx.doi.org/10.5772/intechopen.97714*

differential evolution algorithms based on a real-time LabViewTM application," *Appl. Soft Comput.*, vol. 62, pp. 86-100, 2018.

[16] J. Chen, Y. Ma, and Z. Pang, "A mathematical model of global solar radiation to select the optimal shape and orientation of the greenhouses in southern China," *Sol. Energy*, vol. 205, pp. 380-389, 2020.

[17] E. Romantchik, E. Ríos, E. Sánchez, I. López, and J. R. Sánchez, "Determination of energy to be supplied by photovoltaic systems for fan-pad systems in cooling process of greenhouses," *Appl. Therm. Eng.*, vol. 114, pp. 1161-1168, 2017.

[18] D. A. and H. C. M. Redmond R. Shamshiri, Muhammad Razif Mahadi, Kelly R. Thorp, Wan Ishak Wan Ismail, "Adaptive management framework for evaluating and adjusting microclimate parameters in tropical greenhouse crop production systems," *Plant Eng.*, 2017.

[19] R. Shamshiri, P. van Beveren, H. Che Man, and A. J. Zakaria, "Dynamic assessment of air temperature for tomato (*Lycopersicon esculentum* mill) cultivation in a naturally ventilated net-screen greenhouse under tropical lowlands climate," *J. Agric. Sci. Technol.*, vol. 19, no. 1, 2017.

[20] R. Shamshiri *et al.*, "Comparative evaluation of naturally ventilated screenhouse and evaporative cooled greenhouse based on optimal vapor pressure deficit," in *2016 American Society of Agricultural and Biological Engineers Annual International Meeting, ASABE 2016*, 2016.

[21] D. Shamshiri, R., Ismail, W. I. W., & bin Ahmad, "Experimental evaluation of air temperature, relative humidity and vapor pressure deficit in tropical lowland plant production environments," *Adv. Environ. Biol.*, 2014.

[22] R. Shamshiri, "Measuring optimality degrees of microclimate parameters in protected cultivation of tomato under tropical climate condition," *Meas. J. Int. Meas. Confed.*, vol. 106, 2017.

**22**

*Next-Generation Greenhouses for Food Security*

[1] R. R. Shamshiri *et al.*, "Advances in greenhouse automation and controlled environment agriculture: A transition to plant factories and urban agriculture," *Int. J. Agric. Biol. Eng.*, vol. 11, no. 1, 2018. with asynchronous measurement for greenhouse monitoring," *IEEE Trans. Control Syst. Technol.*, no. 99, pp. 1-11,

[9] D. Ma, N. Carpenter, H. Maki, T. U. Rehman, M. R. Tuinstra, and J. Jin, "Greenhouse environment modeling and simulation for microclimate control," *Comput. Electron. Agric.*, vol. 162, no. November 2018, pp. 134-142, 2019.

[10] M. C. Singh, J. P. Singh, and K. G. Singh, "Development of a microclimate model for prediction of temperatures inside a naturally ventilated greenhouse under cucumber crop in soilless media," *Comput. Electron. Agric.*, vol. 154, no.

[11] W. Xin, W. Yu, Z. Yuanyuan, N. Xindong, and W. Shumao, "Intelligent Gateway for Heterogeneous Networks Environment in Remote Monitoring of Greenhouse Facility Information

Collection," *IFAC-PapersOnLine*, vol. 51,

[12] M. Mizoguchi, T. Ito, A. Chusnul, S. Mitsuishi, and M. Akazawa, "Quasi real-time field network system for monitoring remote agricultural fields," in *SICE Annual Conference 2011*, 2011,

[13] *A. Prima et al.*, "Development of a remote environmental monitoring and control framework for tropical horticulture and verification of its validity under unstable network connection in rural area," *Comput. Electron. Agric.*,

vol. 124, pp. 325-339, 2016.

1994, pp. 255-265, 1999.

[14] J. W. Jones, A. Kenig, and C. E. Vallejos, "Reduced state–variable tomato growth model," vol. 42, no.

[15] A. Pérez-González, O. Begovich-Mendoza, and J. Ruiz-León, "Modeling of a greenhouse prototype using PSO and

August, pp. 227-238, 2018.

no. 17, pp. 217-222, 2018.

pp. 1586-1589.

2018.

[2] R. R. Shamshiri *et al.*, "Model-based evaluation of greenhouse microclimate using IoT-Sensor data fusion for energy efficient crop production," *J. Clean.* 

[3] S. M. Rezvani *et al.*, "IoT-Based Sensor Data Fusion for Determining Optimality Degrees of Microclimate Parameters in Commercial Greenhouse Production of Tomato," *Sensors*, vol. 20,

[4] C. Serôdio, J. Boaventura Cunha, R. Morais, C. Couto, and J. Monteiro, "A networked platform for agricultural management systems," *Comput. Electron. Agric.*, vol. 31, no. 1, pp. 75-90, 2001.

[5] K. P. Ferentinos, N. Katsoulas, A. Tzounis, T. Bartzanas, and C. Kittas, "Wireless sensor networks for greenhouse climate and plant condition assessment," *Biosyst. Eng.*, vol. 153,

[6] R. R. Shamshiri, J. W. Jones, K. R. Thorp, D. Ahmad, H. C. Man, and S. Taheri, "Review of optimum temperature, humidity, and vapour pressure deficit for microclimate evaluation and control in greenhouse cultivation of tomato: a review," *Int. Agrophysics*, vol.

32, no. 2, pp. 287-302, 2018.

*of tomato*, vol. 1152. 2017.

[7] R. Shamshiri, H. Che Man, A. J. Zakaria, P. V. Beveren, W. I. Wan Ismail, and D. Ahmad, *Membership function model for defining optimality of vapor pressure deficit in closed-field cultivation* 

[8] X. Bai, Z. Wang, L. Sheng, and Z. Wang, "Reliable data fusion of hierarchical wireless sensor networks

*Prod.*, p. 121303, 2020.

no. 22, p. 6474, 2020.

pp. 70-81, 2017.

**References**

**Chapter 2**

**Abstract**

**1. Introduction**

**25**

Temperature and Humidity

Greenhouses: Overview of

Desiccant and Evaporative

*Redmond R. Shamshiri and Ibrahim A. Hameed*

an alternate option for next generation greenhouse air-conditioning.

inside greenhouse is also impacted by incident solar radiations/sunlight.

humidity control, next generation greenhouse

**Keywords:** desiccant dehumidification, evaporative cooling, temperature and

Plants are highly sensitive to a specified temperature and humidity range inside a greenhouse. Higher than normal humidity level inside a greenhouse can be fatal for plant growth which leaves the plants open to fungus/pests' attacks, and causes dripping due to condensation. Humidity inside a greenhouse is contributed through photosynthesis and evapotranspiration. Photosynthesis is a natural phenomenon inside plants (which occurs due to chlorophyll) during daytime which results in carbohydrates in plants using carbon dioxide and photons. As a result of this process, plants' leaves generate water vapors into the surroundings contributing to the humidity of the air signified by Eq. (1) and **Figure 1**. Additionally, air temperature

Cooling Systems

Control for the Next Generation

*Muhammad Sultan, Hadeed Ashraf,Takahiko Miyazaki,*

Temperature and humidity control are crucial in next generation greenhouses. Plants require optimum temperature/humidity and vapor pressure deficit conditions inside the greenhouse for optimum yield. In this regard, an air-conditioning system could provide the required conditions in harsh climatic regions. In this study, the authors have summarized their published work on different desiccant and evaporative cooling options for greenhouse air-conditioning. The direct, indirect, and Maisotsenko cycle evaporative cooling systems, and multi-stage evaporative cooling systems have been summarized in this study. Different desiccant materials i.e., silica-gels, activated carbons (powder and fiber), polymer sorbents, and metal organic frameworks have also been summarized in this study along with different desiccant air-conditioning options. However, different high-performance zeolites and molecular sieves are extensively studied in literature. The authors conclude that solar operated desiccant based evaporative cooling systems could be

## **Chapter 2**
