A Cost ‐ Effective Embedded Platform for Greenhouse Environment Control and Remote Monitoring

: This paper presents the development of a cost ‐ effective automatic system for greenhouse environment control. The architectural and functional features were analyzed in the context of the realization of a controlled ‐ environment agricultural system through all its stages: installation, deployment of the software, integration, maintenance, crop control strategy setup and daily operation of the grower. The proposed embedded platform provides remote monitoring and control of the greenhouse environment and is implemented as a distributed sensing and control network integrating wired and wireless nodes. All nodes were built with low ‐ cost, low ‐ power microcontrollers. The key issues that were addressed include the energy ‐ efficient control, the robustness of the distributed control network to faults and a low ‐ cost hardware implementation. The translation of the supervisory growth ‐ planning information to the operational (control network) level is achieved through a specific architecture residing on a crop planning module (CPM) and an interfacing block (IB). A suite of software applications with flows and interfaces developed from a grower ‐ centric perspective was designed and implemented on a multi ‐ tier architecture. The operation of the platform was validated through implementation of sensing and control nodes, application of software for configuration and visualization, and deployment in typical greenhouses. such that main parameters and actions are communicated between specific subsystems Scalability The range of greenhouse setups spans from a single unit to one hundred units. The scaling of the monitoring and control system must support easy and unitary access procedures for the case of multiple greenhouses fields AC ‐ alternating current, DC ‐ direct current

. Challenges for automatic control systems (ACSs) used in agricultural applications.

Feature Description
Affordable hardware Investments in greenhouse type and infrastructure should be balanced with the cost of the automation Low-power hardware Remote locations, not connected to the grid, but operating using renewables (photovoltaic, etc.) Appropriate sealing for devices and connectors The greenhouse environment is a harsh one for electronic devices; lack of proper sealing leads to rapid oxidation Each plant/variety has an optimal thermal, watering and lighting regime that must be easily set up when switching the cultivation from one plant to another Energy-efficient control algorithms Heating/cooling can be reflected in a significant part of the operation cost associated to a crop Preventive maintenance and self-diagnosing capabilities Diagnosis of heating distribution system, AC or DC powered actuators, gearing units, valves Fault-tolerant behavior The control system should maintain acceptable performance for a short time horizon when sensor failures occur, safeguarding the greenhouse operation until repair is done Visualization and analysis software Logs of the environmental variables should be visualized in different graphical forms for intra-/inter-crop analysis, spatial comparison (intra-/inter-greenhouse) Accessing the functionality through a wide span of platforms/devices The basic functionalities for monitoring/alarming should be available through smart phone, tablet, notebook and desktop computer Interfacing and translation mechanism for interoperability Dedicated and complex equipment (like fertigation systems and plant growth for phenotyping systems) would ideally be interfaced with the climate control system, such that main parameters and actions are communicated between specific subsystems Scalability The range of greenhouse setups spans from a single unit to one hundred units. The scaling of the monitoring and control system must support easy and unitary access procedures for the case of multiple greenhouses fields AC-alternating current, DC-direct current

Analysis of the Measurands
In recent decades, greenhouses management systems have undergone a process of deep development, and many types of sensors have been used to record various environmental information [17]. Determining what the basic measurands that have to be considered are is essential for the design of a monitoring and control system for the greenhouse environment. In other words, what are the physical quantities able to characterize the environment and provide valuable information for the automatic control system, whose values will be quantized by the system? Three environmental variables (indoor temperature, humidity and CO2 concentration) are essential for characterizing the status of the greenhouse environment, representing major factors that influence the level and uniformity of crop growth [17][18][19]. As demonstrated with several validated models, the values of other variables such as the temperatures of cover, canopy and floor can be reconstructed from this basic set [20].
Beside these, the solar radiation is an environmental factor for characterizing the microclimate in greenhouse models used for managing and predicting the growth process in plants [21].
It is well known that all plants need solar radiation, CO2, water and nutrients to produce biomass through photosynthesis process [22]. Moreover, solar radiation is an important factor contributing to the calculation of water requirements and the assessment of environmental conditions in precision farming applied in protected cultivation areas [23][24][25].
The main environmental factors affecting greenhouse plants include air and root-zone temperatures and humidity, light conditions, as well as CO2 concentration [26]. Proper management of these parameters leads to maximum productivity yields with minimum energy inputs that have a direct impact on plant growth and development and play a key role in preventing stressors [27].
While the inside air parameters are essential factors, not less important are those related to soil. The models for soil temperature prediction as a function of depth rely on estimated soil thermal diffusivities, strongly influenced by the volumetric soil water content [28]. This demonstrates that measuring soil humidity (volumetric soil water content) and soil temperature at least at a single depth level can prove significant insight into soil temperature dynamic.
Evapotranspiration (ET) is the primary process affecting leaf temperature, crop water requirements and the greenhouse microclimate, characterizing the water loss from the soil or substrates and plant surfaces [29]. Stress conditions, especially drought and overheating, are often linked, especially when reducing the intensity of transpiration causes the leaf temperature to rise, with important associated damage to cellular structures, proteins and enzymes [30]. When pad and fan cooling are used, ET processes are strongly influenced, indicating that beside air temperature, air relative humidity, CO2 concentration, solar radiation and soil moisture, one should also consider the wind speed and direction measurements within the canopy boundary layer.
Since the local, internal environmental variables are greatly influenced by the outdoor environmental variables [31], which are seen by the control system as main disturbances, measuring these external variables can offer much insight for modeling, control or prediction procedures. According to [32], the relevant variables are outdoor temperature, outdoor CO2 concentration, outdoor relative humidity, wind speed and diffuse and direct solar radiation.
While all the above-mentioned environmental variables of the greenhouse impact the crop evolution, the most accurate feedback is provided by the plants. For the evaluation of plant growth, measures like stem diameters, sap flow rates [33], expansion of fruit and leaf temperatures have been proposed [34]. Another validated approach is the monitoring of daily weight accumulation processes [35]. The evaluation of the status of health based on chlorophyll fluorescence is also targeted by new sensors [36,37] that also act as detectors of plant stress factors and are able to provide valuable feedback like early warning of possible plant disease outbreaks before production rates are dramatically affected.

Spatial Variation
It is well acknowledged that the spatial distribution of the environmental variables within the greenhouse volume is not homogeneous. The vertical temperature distribution is important and acknowledged by growers. Even in well-designed agricultural buildings, large gradients of environmental parameters exist, and the spatial profiles for the natural ventilation and the use of evaporative cooling are significantly different [38]. In designing the CEA control equipment, the existence of spatial distributions is a factor to account for [32].
These considerations lead to some question of considerable practical interest:  If one needs to deploy an array of sensors in order to observe details of the distribution and its dynamics, how large should this array be?  What are the relevant positions in relation to greenhouse geometry and growing setups?  How should a spatial averaging strategy able to provide the temperature, humidity or CO2 content values in the closed-loop control system be implemented?
To answer to the first question the grower must understand how important the characterization of the plant microclimate for a specific crop is.
The local measurement at the plant level in the vicinity of the leaves or fruits might be desirable, but its implementation is not trivial: cabled sensor configurations might be hard to install and maintain, favoring the adoption of wireless, battery/solar-powered sensors.

Common Categories of Actuators
The larger part of the actuators encountered in the greenhouse are the on/off type, but there are cases when a continuous control signal (voltage or current) must be used for proportional valves, variable frequency drivers, voltage-controlled pulse-width modulation (PWM) drivers, rotary positioners, etc. The most common actuators are enumerated as follows:


Actuators associated with the ventilation (roof-windows, side-windows and fans).  Actuators associated with the heating (valves and pumps).  Actuators associated with the curtains (shading screens and energy screens).  Actuators associated with lighting equipment (dimmers for high voltage sodium lamps and lightemitting diode (LED) lamps).  Actuators associated with irrigation (valves and pumps).  Complex fertigation stations.

Energy-Efficient Control
Since the environmental features of the cultivation areas impact the costs associated with heating/cooling, they strongly affect the sustainability of the production [39]. Beside these costs, one should carefully consider the costs of using supplemental lighting in winter. The control strategies aiming at improving the efficiency of energy usage should address several topics:


Adaptability of the prescribed microclimate regimes to the specifics of the crop (optimized temperature range).  Optimal use of resources, like harmonizing optimal temperature with the light availability [39].  Use of appropriate control algorithms and actuator modulating methods such that overshoots are avoided.  Use of short-term weather forecasting information for implementing heat-storing/heat-releasing techniques that would save heating/cooling energy.

Cost of the Operation
Achieving a level of sustainable productivity in greenhouses requires the integration of information and management strategies, as well as a good understanding of the influence exerted by microclimatic parameters. Thus, the correct understanding of variations in environmental conditions in the greenhouse associated with plant requirements at different stages of growth and development deserves special attention [27].
When farmers build a greenhouse and install all the hardware needed for an appropriate operation of the greenhouse, the costs are associated with an initial investment. Beside these, when one looks at the monthly cost associated with the operation of the greenhouse, the heating/cooling costs and the labor costs seem to be the most important. According to Cola et al. [39], in Dutch environmental conditions with advanced and technologically equipped greenhouses, the labor represents almost 50% of production costs, while for the low-technology greenhouses, the labor costs significantly increase; therefore, it is important to reduce other costs such as heating requirements. At the same time, one must observe that the costs associated with lighting are significant, especially in the winter time and in the most northerly areas, and act as a main driver toward adoption of low-power LED luminaries.
The operation of the remote monitoring/control features also imply subscription costs for data transfer over the Internet, but the relative impact of these is small.

Control Methods
A greenhouse can be modeled as a complex multi-input and multi-output (MIMO) system that is highly nonlinear and strongly coupled, influenced by the outside weather [31]. The basic set of variables that characterize the internal climate are the air temperature and the air humidity.
Identifying them as process outputs, [31] considers the schematic representation of the greenhouse shown in Figure 1. The design of the control system for greenhouses has been extensively addressed in literature extensively in the last years with the attribute "optimal" used more or less motivated. There are several facts which can be emphasized when looking at the evolution of the proposed solutions:


The design of an optimal controller should obviously start with the definition of the performance indicator(s), where tracking of prescribed temperature, humidity and light profiles, crop production maximization, heating/cooling, energy saving and water saving are usual goals.  There are complex models for greenhouse climate (lumped parameter or distributed parameter approaches) that have been validated through simulation and comparison with recorded time series.  A large variety of control methods have been investigated, encompassing simple on/off, proportional integral (PI), proportional integral derivative (PID), adaptive, feed-forward, fuzzy, neuro-fuzzy [40][41][42][43][44][45][46] and optimal control solutions [32,47].
The implementation of advanced control strategies became viable only in recent years when the computation power of affordable processors became sufficient for having the possibility to run the associated complex algorithms on embedded devices. Still, the results demonstrated on dedicated simulation environments, backed by complex numerical method libraries, are hardly reproduced on existing commercially available control systems realized in the industry standard approach, based on PLCs.
The complexity of the algorithms associated with the advanced control strategies is the main bottleneck limiting faster adoption and incorporation in a greenhouse ACS:


The vast majority of processes which occur in greenhouse operation are distributed parameter ones. The algorithms which can be applied for the control of these types of processes require the numerical solving of partial differential equations [48,49], an aspect which introduces consistent programming difficulties for implementation on low-cost embedded processors. However, linearizing and decoupling techniques can help in circumventing such issues, as in the case of the control algorithm based on feedback/feedforward linearization and outer loop controllers demonstrated in [50].  The internal model control (IMC) strategy is based on using the reference model [41] of the processes from the greenhouse structure, processes which are, in general, strong nonlinear ones. Depending by the nonlinearity type, the software implementation of strong nonlinear models on process computers requires the approximation of special functions, which leads to increased computation time on low-cost 8-bit microcontrollers without integrated floating point support.


The algorithms associated with the adaptive [40,43], optimal [51][52][53][54] and robust [55] control strategies require matrix processing techniques that imply increased computational complexity and the use of special libraries and powerful processors.  The algorithms associated with the fractional-order control [56] require the implementation of filters with complex structure which in turn require better hardware resources.


The online training and identification algorithms of intelligent controllers (neural controllers [31,44,45,57], neuro-fuzzy controllers [58] and fuzzy controllers [59]) present a high level of complexity, implying difficulties when such an implementation is adopted in agricultural practice.
There is a lag and a reluctance in immediate adoption of the "theoretical" solutions for use in practical control equipment for greenhouses, motivated mainly by the following barriers:


Simplicity is often associated with reliability, and users prefer the reuse of practice-validated approaches, based on equipment with which they are already accustomed.  The design, development, testing and certification cycles for measurement and control devices dictate a return-on-investment approach such that the producers do not hurry to incorporate latest algorithms.  The complexity of some control algorithms requires powerful machines (computers) that are not affordable for many farmers and that are even more expensive if designed for operation in harsh environments.
Another interesting research direction is to target the possible use of PID-type controllers with on/off actuators in order to minimize the system energy losses.

Control Architectures
The key towards understanding a modern ACS with the aim of implementing CEA for greenhouses is the hierarchical approach of the ACS. As indicated in [32], there are two basic levels: an operational level that performs the actual control and a strategic level that serves as a supervisor, whose task is to translate the grower information on the tactical level into information that can be used on the operational level.
As explained in [32], there are two approaches. In the classic one ( Figure 2), the grower interacts with the greenhouse climate computer via settings, such as those for upper and lower thresholds of day and night temperatures, upper thresholds on relative humidity, window opening enhancement at high radiation; there can easily be several hundred settings. In the advanced one (Figure 3), optimal greenhouse climate management is automated through a crop growth controller.
In relation to Figure 2, this can be rephrased as follows:  A collection of sensor and controller devices can implement the operational level, i.e., the necessary closed-loop control actions to bring the environmental variables at the prescribed reference values.


The strategic level can be further divided into a crop planning module (CPM) and an interfacing block (IB), as shown in Figure 3, so the interaction of the grower is done through the CPM in the classic approach and the growth controller passes the "supervisory" information to the operational level through a standardized format accepted by IB in the advanced approach. Since the large majority of the growing facilities use the classic approach, one can observe that the ease of use of the CPM will mostly impact the user experience, acting as the main instrument through which the grower can "steer" the crop growth. On the other hand, a seamless transfer of the high-level prescription towards the operational level depends on the "translation" mechanism offered by the IB, important in both classical and advanced setups ( Figure 4). The approach toward the proposed implementation of the CPM and IB can be described as follows:


A software application enables the specification of daily profiles (24 h) for each controlled environmental variable by allowing the grower to declare a sequence of time intervals and associate a reference value to each interval.  For each environmental variable, the information introduced by the grower is encoded into a process containing a sequence of phases. The prescribed environment for a crop will be encoded as a set of processes.  The set of processes has two temporal attributes, namely the starting date and the duration (in days), such that the whole growing period for each crop can be divided into several stages with each having its associated set of processes.  Two mechanisms are implemented for IB, with the first being the publication of a set of processes in a hierarchical description format (set > process > phase) which are encoded into low-memoryfootprint binary representations and the second being the distribution of the compacted representation toward the targeted control module via the system gateway.

Topologies and Network Architectures for Distributed Control Networks
Three basic aspects are of primary importance when designing a communication architecture for a distributed control system application: a. The network topology, which specifies the way in which the smart nodes (sensors, actuators and data concentrators) are connected to each other. b. The failure-handling capabilities, in the sense of preventing the loss of power or the interruption of the transmission medium for several nodes from being able to interrupt/block the communication in the control network and/or significantly degrade the control performance. c. The constraints imposed on cabling and interfacing costs are translated into communication constraints (limited bandwidth, time delays and packet dropouts) that are known to limit the performance of a distributed control system.
Beside these aspects, adherence to standard protocol and transmission standards would assure interoperability and support for debugging. The basic network topologies encountered in industry are ring (where each node is connected to the two neighboring nodes), star (where each node is connected to a central node), bus (where all nodes are connected to a shared backbone medium) and tree (a hierarchical multilevel setup, with root node, interior nodes, and leaf nodes).
For the addressed ACS, the proposed organization of the network is the multidrop bus topology ( Figure 5). The access to the multidrop serial bus is regulated by a token-passing procedure (typically associated with the message passing toward a neighbor node in the ring topology). Such a mechanism can regulate the activity periods of the controller nodes and master-slave pooling procedure that govern the message exchange between a controller and its associated sensor and actuator nodes. Whenever a controller node receives the permission to access the bus, it may initiate the execution of a message cycle where the master sends/requests frames to/from the associated sensors and actuators. The aspects mentioned in point b of the list above are addressed by the introduction of an inactivity timeout, in the sense of enabling a controller node to initiate a communication cycle when a defective neighbor node does not transfer the bus-granting message. When a gateway is present, before sending the bus granting message to the next controller, the current controller interrogates the gateway about its need to use the bus; the bus-granting message is sent to the next controller only when the gateway signals the fact it does not need the bus.
For an ACS targeting greenhouse environment control, the constraints mentioned in point c of the list above should be considered from a double perspective. On one hand, the typically slow processes allow for sampling intervals ranging from seconds to minutes, allowing low transmission rates (and implicitly large bus cabling segment capacities/lengths). On the other hand, the impact of the number of controller nodes on the real sampling rate attainable by a controller in the virtual token network would favor the usage of short messages (payloads with reduced byte number).

Energy-Efficient Control
In order to examine the means of achieving better energy efficiency in simple setups with on/off actuators, "hybrid" controllers (a cascade of bi-positional (on/off) and PID controllers) might be considered. In fact, it is interesting to see if this kind of period-modulated actuation might provide a

Controller1
Controller2 Controller3 Multidrop bus Virtual token network Gateway PWM-like performance for the case of controlling the temperature in a greenhouse. The used control structure is presented in Figure 6. All the signals from the control structure are functions that depend on the independent variable time (t). The greenhouse heating process (GHP) has a second-order structure. The heating element (HE) is a third-order proportional element, and the temperature sensor (TS) is a first-order proportional element. The ideal structure of the PID controller is given by where KC is the controller proportionality constant, TI is the controller integral time constant and TD is the controller derivative time constant. In practical implementations, the ideal form of the controller has to be augmented with a first-order filter, having the time constant denoted with Tf. Figure 6. Control structure for the air temperature control inside the greenhouse (GHP, greenhouse heating process; HE, heating element; P, pump; V, ventilator; TS, temperature sensor; HC, hybrid controller; C (PID), PID-type controller; TPR, bi-positional (on/off) controller; Tsp, temperature setpoint signal; Tm, feedback signal (measured temperature); eT, temperature error signal; m, modulation index; RP, rectangle pulse (control signal); TP, thermal power; Tout, output temperature (controlled signal, air temperature inside the greenhouse); dT, equivalent disturbance signal that directly modifies the Tout value (e.g., the external temperature or solar radiation)).
In relation to the m(t) value (0 ≤ m(t) ≤ 1), the output signal from the bi-positional (on/off) controller (TPR) can have two possible logical values: the "0" value, which implies the stop of the HE, and the "1" value, which implies the operation of the HE at maximum power. Considering the period of the rectangle pulse (RP) signal, equal to TRP, T1 = m(t)·TRP represents the duration from each period in which the RP signal takes the value "1" and T2 = (1 -m(t))·TRP represents the duration from each period in which the RP signal takes the value "0".

Comparative Study of Reported Implementations for Greenhouse Control Systems
An extensive comparison, based on 28 features, is presented in Table 2 (Physis-based solutions vs. commercially available solutions), and Table 3 (Physis-based solutions vs. systems presented in literature). Some features are a clear indication of the industrial maturity level of the proposed solution: appropriate sealing, bus length appropriate for production greenhouses, remote configuration for sensors/controllers, inputs for external sensors (from other producers), preventive maintenance and self-diagnosing capabilities and scalability for a large number of greenhouses. The Physis-based solution shares all these with some of the commercial systems. Other features rather prove the suitability of approaches based on recent technological/methodological advances: lowpower hardware, sensors based on pre-calibrated digital output transducers (with guaranteed error margins), Ethernet gateway with an embedded web server, OTA updates of firmware, integrated upper-level control or upper-level-control ready and fault-tolerant behavior. This second category is well covered by the solution proposed in this paper, with features being shared with only a few other systems. Among the distinctive features of the proposed solution are the following: sensors with local display of measurand values, remote configuration of the controllers, user-friendly editing of complex alarm conditions, easy "swapping" from one crop to another (reuse of predefined regimes), preventive maintenance and self-diagnosing capabilities and structured approach for scalability in the case of installations with a large number of greenhouse compartments.

Hardware Architecture
The proposed ACS is organized in accord with a distributed control architecture exemplified in Figure 7.  Three types of sensing units were developed for characterizing the air inside the greenhouse: (a) air temperature and relative humidity (RH) sensor; (b) air temperature, CO2 content and humidity sensor; and (c) air temperature, CO2 content, absolute pressure and humidity sensor. The third type also integrates a light intensity sensor (Figure 9). Digital output transducers, factory precalibrated, are used for temperature and humidity measurements. CO2 content is measured with a nondispersive infrared (NDIR) technology sensor. Their specifications are grouped in Table 4.   The transducers are interfaced with an 8-bit low-cost microcontroller that provides offset calibration. The measured values are wirelessly transmitted through a 2.4 GHz transceiver toward the wireless hub. Maximum capacitance measurement error in the temperature range of 0 to 50 °C is 4%. The operation is powered by a rechargeable coin battery.
The calibration was done using the gravimetric technique ( Figure 11) for both electrode configurations (Figure 12).  The controller nodes provide direct logic (relay) outputs in two versions: five outputs and eight outputs. Their architecture and realization are depicted in Figure 13. The actuator nodes are intended for interfacing with voltage-controlled actuators and are realized in accord with the schematic of Figure 14. Their input value is received as a bus message with the significance of a percentage (0-100%) that is linearly translated in 0-5 V or 0-10 V ranges. The gateway node is the node with the most complex functionality, as indicated in Figure 15. Its physical realization is presented in Figure 16 together with its embedded web server functionality. Following the paradigms of industrial system health management, a low-cost system was devised in order to detect functionality anomalies (fault detection) and to support preventive maintenance and self-diagnosing capabilities for the electromechanical actuation systems typically found in a greenhouse. The large majority of these actuators are driven by direct current (DC) or alternate current (AC) electric machines. The identification of the electrical and mechanical faults of electrical-motor-driven actuators should start from the fact that most common failure modes are bearing failure, stator winding failures, rotor failures, faults in rolling element bearings and faults in the gearing mechanism. The proposed setup (Figure 17) addresses this through the motor current signature analysis (MCSA), vibration signature analysis (VSA) and operational temperature monitoring. These algorithms are based on local collection of waveforms by low-cost sensors realized with 8-bit microcontrollers, micro-electromechanical system (MEMS) accelerometers, integrated digital output temperature transducers and transmission of the samples in a wireless manner toward a more powerful 32-bit processor node (module with hardware identical with that of the hub) for running the data analysis algorithms.

Software Architecture
A series of applications for real-time monitoring of environmental parameters were developed in Qt [16]:


Configurator, a graphical editor which allows creation and editing of configurations that represent the spatial placement and the properties of each node of the multidrop networks;  Monitor, a console application which allows, based on the network description file, monitoring of the network nodes by usage of TCP/IP sockets for connecting to each gateway defined in the configuration, periodically requesting the current values of the network nodes, and storage of the values;  Inspector, an application offering, in addition to an interface for visualization, comparison and printing of the record history, both an abstract image of the system and a view of the physical location of the network nodes in the greenhouse space, assuring easy localization and referencing of the monitored nodes;  Manager, an application that facilitates easy configuration and maintenance of the network nodes;  Remote Transfer Interface and Visualisation Interface, applications that facilitate downloading of the archived data from a gateway module and graphical visualization of the downloaded data.
Network configurations are stored in XML format and contain representations of all the network nodes and their properties. Nodes from multiple multidrop networks can be represented in a configuration, each node being associated with the corresponding gateway module that interfaces the subnet (the example configuration of Table 5 explains the description related to a soil moisture sensor and to a gateway module). The files generated and exchanged by applications are described in Figure 18. For defining the desired profiles of the controlled variables, experiments with a first version of an application, called Process Editor, are mentioned in [13]. The application was extended, allowing a set of processes (up to 8) to be defined and saved.
Two types of processes may be defined: bipositional (on/off control) and continuous (P/PI control). A phase is characterized by properties such as name (string for unique identification of a phase into the process), phase type (maintain/control/idle) and phase duration. Since each specific plant culture may require different regimes for watering, lighting, heating/cooling, humidifying/dehumidifying and CO2 addition, profiles that dictate the evolution in time of the reference values are defined for each control variable. These are specified for a 24 h cycle (see Figure 19). The information that has to be transferred into the controller for obtaining the prescribed profiles is represented as a set of processes.
Depending on the type, the phase may have specific properties. An idle phase does not present particular properties (during this phase the controller module on which the process will run does not change the actuator command).
A control phase requires specifying the value for actuator command (on/off or 0-100% depending on the type of process).
A maintain phase contains information about the input channel (controlled variable) and the desired value to be tracked for that channel.
In the case of an on/off process, two additional input channels may be defined, along with the way in which the output should be computed: cmd = f (Ch1, Ch2, Ch3, logic).
For example, if the temperature reference value is considered associated in a phase to the regulating action of opening/closing of a window, the command of the actuator can be further conditioned by external factors such as wind speed and rain intensity.
The platform that allows that feedback to the control loops is provided through a spatial averaging strategy by the association of multiple sensor output channels to the same input channel of a controller through the specification of the sensor addresses list and of the corresponding weights.
For a P/PI process, one input channel can be specified, with the remaining space in the memory allocated to a phase being used for storing parameters of the controller.

Implementation of the Interface Block Mechanisms
Another application, called Process Loader was implemented; this application allows (based on a file specifying the network configuration and a process set) associating each process to a control variable and to an actuator, saving/importing of this type of configuration and uploading/downloading of configurations to/from a selected network controller.
The processes have a duration of 24 h and consist in a sequence of phases (up to 12). Each process is saved in XML format and contains information related to the process and to each phase of the process. For defining a set of processes, an XML file is used that specifies the process file names belonging to a specific set.
These types of profiles may be defined at the level of the Process Editor application as staircase approximations like the one shown in Figure 20 with blue color, and a piecewise linear (PWL) approximation may be implemented at the level of the controller, resulting in a profile like the one indicated in Figure 20 with red color.

Alarms and Alarm History
The platform implements a system that facilitates representation and evaluation of user-defined alarm conditions, represented using first-order formulas ( Table 6) or second-order functions. Table 6. Format of a first-order alarm condition [16].

Condition ID Channel
Operator Threshold condition_index element_name <, >, =, ≥, ≤ Value The second-order alarms are Boolean functions of primary conditions (up to four) expressed in canonical disjunctive form condition_order2 = f (C1, C2, C3, C4). Each secondary alarm condition requires specification of a mask (coding on two bytes the positions corresponding to valid rows in the truth table associated with the canonical form) and the list of primary conditions considered.

Fault-Tolerant Network Architecture
For increasing the network adaptability and ensuring fault-tolerant behavior, the platform was extended by introducing a smart emulator module ( Figure 21) that allows [66]:


Simultaneous running of several neural networks for estimating the values of the faulty sensors;  Extraction of relevant time series from the logged files (available at the gateway level) and transmission of these to a PC in order to be used by training algorithms. For estimating the faulty sensor values for a time horizon of few days, the long short-term memory (LSTM) networks were chosen. These networks are a class of recurrent neural networks that able to make predictions in time series forecasting based on the learned context and have the ability to represent both recent events and longer-term events.
For rapid prototyping of a neural network implementation, the STMicroelectronics's solutions for artificial neural networks were considered. ST offers the possibility of mapping and running pretrained artificial neural networks on STM32 ARM® Cortex® M7 microcontrollers, through an extension pack of the STM32CubeMX tool. Multiple networks can run on a microcontroller.
The neural network models are trained in the open-source neural-network library Keras (TensorFlow backend) and exported to files. The model is then imported in STM32Cube.AI software tool and used to generate optimized code for the targeted microcontroller. The generated neural network library can then be deployed on the microcontroller.

Experiments and Results
The Process Editor interface is presented in Figure 22.  Remote monitoring is available in a simple form through the embedded web server of the gateway, but advanced archiving and visualization functionalities are provided through the Remote Transfer interface (Figure 24). The visualization application might be used not only for examining the sensor records (Figures 25 and 27), and was validated in different plant monitoring projects (like water stress and overheating, Figure 26). This may be used also for verifying the controller response ( Figure 28), by inspecting the graphs associated with output channels.

Experiments for Estimating Environmental Variables in Smart Sensor Networks with Faulty Nodes
The datasets collected by the Physis platform for a smart sensor network usually contain 1-min sampled records of environmental parameters. For the experiment, two sensors were used: an air temperature and relative humidity sensor placed indoors (Ti, Hi) and an air temperature sensor placed outdoors (Text). Figure 29 presents the experimental dataset containing records for 11 successive days.

Simulation of the Proposed Energy-Efficient Control
The control structure presented in Section 2.9 was comparatively simulated for three different scenarios. The simulation results are presented in Figure 32. The main objective of the previous simulations was to consider the temperature increase from the value of 15 °C to the value of 25 °C.
The response highlighted with green color corresponds to the GHP open-loop response (obtained if the TS is not connected in the system and setting the appropriate constant value for the m(t) signal (modulation index) which generates the imposed temperature increase). Obviously, the mentioned m(t) constant value is previously computed only for the considered case. In the context of changing the setpoint signal value, the open-loop control becomes inefficient (the steady-state error cannot be avoided in this case).
The response highlighted with red color corresponds to the case in which hybrid controller (HC) contains only the TPR and its hysteresis is appropriately set. From the previous figure, it can be seen that the obtained response is considerable faster than the open-loop one and that the temperature inside the greenhouse is controlled with acceptable tolerance near the imposed value (even in the case where the value of the setpoint signal is modified). The main disadvantages obtained in this case are that the response presents a consistent overshoot and the response oscillations near the imposed temperature ripple are significant (not unacceptable, but significant).
The response highlighted with blue color corresponds to the case of using the proposed HC (containing both C and TPR elements). The obtained response is faster than the open-loop one and the imposed temperature is tracked with high accuracy by the HC. Obviously, the response oscillations near the imposed temperature are much lower than in the case of using the simple on/off controller. Additionally, the overshoot is negligible in this case, an aspect which represents an important technological advantage. Considering a steady-state band of ±2%, in relation to the imposed temperature, the obtained settling time is comparable with the settling time obtained in the case of using the simple two-position controller. However, the settling time, in the case of the approached application, represents an important control performance but not a vital one (the vital performances are the obtained precision of the control system response in relation to the imposed reference temperature value, the overshoot and the energy saving).
As a consequence of avoiding the overshoot in the case of using the proposed HC, in comparison with the case of using the simple two-position relay, the energy consumption of the HE is lower in the case of using the proposed HC. This aspect is proven by the simulations presented in Figure 33. From the previous figure, the energy saving is obvious in the case of using the proposed HC (the blue energy curve is lower over the entire simulation than the red energy curve). In the first 100 min of the control system operation, the saved energy is equal to 5.3 kWh.
Considering all of the results above, the proposed control solution based on the HC is a viable one.

Experiments with the Actuator Faults Detection Setup
Examples of waveforms recorded by the wireless acceleration sensors are shown in Figure 34. Fault detection can be implemented based on spectral analysis of the collected digital sequences, as demonstrated in Figure 35.

Discussion
This paper presents the experience of developing a low-cost architecture able to support environmental monitoring and control of remote greenhouses. The main environmental parameters are sensed with microcontroller-based smart sensors organized in wired and wireless networks.
In the proposed topology, only one node can send a message at a given moment, while the others are listening. A token-passing access method was implemented: a controller node interrogates its associated sensor nodes and then passes the bus master role to the next controller. The network latency is not noticeable for setups with up to 32 nodes: the interval between two samples requested by a controller from the sensor is less than 5 s.
The fault tolerance of the distributed control network with a token-passing protocol was analyzed by simulating the activity of the control network nodes on the bus in the presence of individual node failures. Robustness to sensor failure was demonstrated through the ability to predict the 1-day ahead values for inside air temperature based on the measurements of all the variables collected in the previous 7 days.
The use of a single cable for supporting power delivery and RS485-based communication for all nodes in the network is a key advantage; there are issues and challenges associated with such a setup in terms of voltage drops, but the low-power, low-voltage sensing devices avoid these. The low power consumption was a key design constraint considered for all nodes: sensors, controllers, actuator interfacing modules, gateways and hubs. Low-power processing and energy saving strategies in the sensor firmware were used not only for the wireless (battery-powered) nodes but also for the wired ones in order to keep the average power for standard installations (one gateway, one hub, up to eight sensors, one controller)-less than 5 W. When paired with an LTE router, such a setup can be easily powered by a small photovoltaic system (panel, charger and battery) for autonomous operation in monitoring of remote greenhouses without grid connection.
The proposed solution comes with the advantages of scalability, robustness and remote operation at an affordable price (see Table 8). Although basic alarm conditions are handled by the embedded application, an alarm editor and handler are available through the software application.
A suite of applications was developed for making the acquired data and the setting of the environment control regimes remotely available in real time via the Internet. They were built in such a way that executables can be generated on Linux, Windows and macOS platforms and user interfaces can be localized in different languages for improved user-friendliness.

Conclusions
The ACS introduced in the paper can be seen from two perspectives: it can be seen as a low-cost embedded platform able to support scalable distributed control networks to be deployed for processes that are not fast, and it can also be seen as a greenhouse environment control system that is "humanized" through the presence of a suite of software applications with flows and interfaces developed from a grower-centric perspective.
When compared with other low-cost or cost-effective implementations, the proposed system has several distinctive advantages.
The distributed control architecture allows easy scaling of the system (addition of new sensor/controller nodes), clear decoupling of the actuator driving hardware from the controller hardware, simultaneous multipoint sensing of the greenhouse volume, much larger distances between sensing points (Modbus on RS485 allows for hundreds of meters of cable segments) and better resilience to faults than in the case of single processor/controller approaches like that of [65].
Adherence to a well-established communication protocol like Modbus brings two primary benefits: first, interoperability is guaranteed for a large range of commercially available Modbus output sensors; second, for all major sensor communication protocols/standards, there is a bridge toward Modbus available as a commercial device, meaning that virtually every other type of sensor can be integrated in the proposed ACS.
Integrated multi-tier architecture allows easy remote programming of the environmental regimes and easy switching between crops, along with the abstraction of the hardware implementation and control algorithm details through the presence of the dedicated crop planning module.
The modular approach that groups a subnetwork around the gateway nodes gives high flexibility in configuration and scaling: small or experimental greenhouse installations can be realized in a low-cost manner with just one gateway managing several dozens of devices, while for large-scale setups (big production greenhouse fields) a second-level communication backbone can be easily realized with wired/wireless Ethernet switches and routers.
Possibilities of electromechanical actuator fault detection were demonstrated within an affordable hardware setup. The alarm editing module allows much more complex alarm conditions than the case of simple growing controllers, supporting early detection of faults in heating, watering and ventilation systems.
Fault-tolerant behavior of the ACS was demonstrated by introducing a smart emulator module that can avoid extreme damage such as drought and freeze induced by malfunctions or communication failures of the sensors used in the control loops.