Design and Validation of a Low Cost Programmable Controlled Environment for Study and Production of Plants, Mushroom, and Insect Larvae

: Study and optimization of biological processes involved in food production require the quantitative study of the environment’s inﬂuences on the organism and eventually the products and byproducts consumed and produced. Commercial growth chambers do not fully support such quantitative study due to the underlying limitations (cost, size, resource exchange, programmability, user interaction, etc.). This work presents a low cost programmable system designed to facilitate such studies in organisms such as plants, fungi, and insect larvae. The proposed system consists of modular units performing speciﬁc functions. A sensor cluster for measuring gas concentrations, air properties (temperature, humidity, pressure), and growing medium properties was implemented and tested. Actuators for resource exchange, air conditioning, and light spectrum adjustment are proposed. A three-tier hierarchical software framework consisting of open-source cloud platform for data aggregation and user interaction; microcontroller ﬁrmware; and an application development framework for test automation and experiment regime design is developed. Series of experiments and tests were performed using the designed hardware and software to evaluate its capabilities and limitations. This controlled environment was used to study photosynthesis in Ocimum basilicum and, in a second experiment, the evolution of the metabolic activity of Hermetia illucens larvae over its larval phase.


Introduction
The problems associated with food production due to the growing population, changing climate, reduced ground water resources, and increased transportation costs could be solved using concepts such as vertical farming [1], urban agriculture, and plant factories with artificial lights (PFAL) [2]. These modern food production techniques prove to be effective in increasing the biomass throughput per volume of water used per growing area, in comparison to the conventional farming techniques. These methods however, require a significant amount of energy for generating the artificial micro-climate necessary for the plants growing in them [3].
Several studies have been undertaken to evaluate the economic feasibility of a typical vertical farm and how these farms could be made profitable by combining different organisms (e.g., plants and fishes) and exploiting the symbiotic behavior between them. Such investigations are noticeable in the area of space research and exploration projects for designing bio-regenerative life-support systems: MELiSSA (Micro-Ecological Life Support System Alternative) [4], ACLS (Advanced Closed Loop System) [5], CELSS (Controlled Ecological Life Support System) [6], and CAB (Controllo Ambientale Biorigenerativo) [7]. Improved biomass output was shown when plants and mushrooms are grown in symbiosis [8]. Studies performed on farms with plant-fish integrated production have also shown reduced operation cost [9]. The economic feasibility analysis of the vertical farm performed by the German Aerospace Center DLR has shown that, on combining production of different organisms, the overall cost in such farms are reduced [10]. Quantification of mass and resource fluxes between organisms is important for performing simulation studies, designing experiments, and developing automation and farm infrastructure. CUBES Circle is another project, funded by the German Federal Ministry of Education and Research, aiming on the study of mass and energy fluxes among plants, fishes, and insects connected together [11].
The above discussed works highlight some of the research potential and shortfalls in the area of optimized food production in controlled and connected environments. This requires, firstly, a quantitative study of growth processes of individual organisms and its environmental factors; secondly, study of resource fluxes and symbiosis between organisms and its environment; and, finally, development of mathematical models that adequately describe them.
The fundamental step of such studies is the development of a controlled environment suitable for different organisms. Plants (Lactuca sativa and Ocimum basilicum), fungi (Agaricus bisporus, Lentinula edodes, etc.), and insect larvae (Hermetia illucens and Tenebrio molitor) are some of the candidates considered for developing the controlled environment proposed in this work. A preliminary analysis of the requirements for developing such system highlights the need for a sophisticated setup with actuators to generate the necessary micro-climate, sensors to measure various variables (e.g., O 2 , CO 2 , humidity, etc.), and interface to exchange resources (e.g., water, air, and nutrients). Some modern commercial growth chambers support CO 2 concentration regulation and inlet for additional sensors through instrument port, but infrastructure for resource exchange and test automation is either limited or non-existent [12]. Modification of these growth chambers for incorporating necessary infrastructure is theoretically possible but adds to the cost and complexity. The literature [13,14] also indicates the need for custom devices irrespective of the availability of commercial growth chambers for studying and phenotyping biological organisms. This is primarily due to a very high equipment cost (>6000 EUR for growth chamber and additional cost for control software), proprietary hardware/software, and requirements very specific to the nature of studies performed.
This work uses some of the concepts proposed in the literature and proposes novel ideas and modifications to develop a low cost system suitable for previously mentioned studies. The following are some of the design requirements considered and realized: • Actuators for air conditioning, light spectrum adjustment, and on-demand water and gas exchange with airtight containment • Measurement system for air quality, gas concentrations, air pressure, air and substrate temperatures, humidity, and substrate moisture • Modular design using off-the-shelf components and 3D printable parts • Software framework for experiment regime design and execution, user interaction, and data collection and analysis In the following sections, firstly, hardware component selection and electronic interface design are explained followed by software component design and integration of an example control regime. The results of sensor-actuator tests for performance evaluation of the designed system are then presented. Finally, the results of experiments executed for the study of growth of biological organisms are discussed.

Material and Methods
The rearing process of biological organism such as plants, fungi, and insects have special requirements with respect to climate, nutrient supply, and gas concentrations. This section describes in detail how these special requirements were translated into design choices using off-the-shelf hardware components, 3D-Printable custom parts, and open-source software. All design files, source code, and supporting documentation used in this work are available on-demand for reproduction and further development.

Hardware Design
A process model of a controlled environment (growth chamber), as shown in Figure 1, was drafted based on the functional requirements. The central chamber unit is where the organism of interest is reared and studied. This part, being the fundamental component of this process model, was selected first. A polypropylene container of 75 L volume with airtight sealable lid was selected. This volume was constrained due to the choice of an off-the-shelf container, which also corresponds to the volume of low-to mid-tier commercial growth chamber. Based on this chosen volume, specification of other modules (e.g., heater, cooler, and pumps) were derived. Modifications to the chamber to obtain desired functionalities are explained in the following sections.

Air Conditioning
The temperature of the growing chamber in which subjects grow influences various metabolic processes as well as triggers certain biological events. In the case of Lentinula edodes fungi, fruiting is triggered by a temperature drop [15]. Similarly, in the case of plants, biological processes, such as photosynthesis and even onset of anthesis is affected by temperature [16]. Humidity also influences the metabolic activities of both the subject and unwanted fungus. Humid environment with sufficiently warm temperature provides suitable platform for organisms such as unwanted fungus to thrive and possibly suppress or destroy the growth of the subject [17]. Therefore, it is important to condition the air inside the chamber.
Application of compact ceramic heating elements for heating air can be seen widely in industrial and home appliances [18,19]. However, cooling the air requires sophisticated mechanical parts and increases size and cost. Some research works [20,21] showcase the application of thermoelectric cooler (TEC) module for heating, cooling, and de-humidification.
Humidification on the contrary can be achieved by accelerating the evaporation of water. Despite the transpiration contributed by metabolic activities of the subject growing in the chamber, it requires long duration to reach desired humidity and is uncontrolled. To compensate for this shortcoming, the humidification process is controllably accelerated using an ultrasonic atomizer that breaks water into fine particles [22]. These technologies were combined together to implement the air conditioning system.

Construction
A combination of TEC module of varying cooling capacities (36 W, 75 W, and 126 W) were tested with heat exchanging components of different sizes for both hot and cold side. A 126 W module with peak current and voltage of 14.7 A and 14.5 V, respectively, was selected for highest performance. The side of the TEC module facing the inner side of the chamber is interfaced with an aluminium passive heat exchanger while the opposite side with an active water cooled heat exchanger. A combination of two PC-cooling fans are used in push-pull arrangement to actively cool the otherwise passive heat exchanger and also to introduce air circulation inside the chamber unit. This design choice of non-similar heat exchanger is made to improve the cooling/heating performance while maximizing the inner volume of the chamber unit. In cooling mode of operation, the inner heat exchanger condenses water, which is accumulated in a reservoir. An ultrasonic atomizer is integrated into the reservoir using the water stored in it for humidification. The enclosure is a custom designed 3D printed part with an integrated reservoir and encapsulates the passive heat exchanger, air circulation fans, and humidifier. These parts, as depicted within dashed box in Figure 1, constitutes the air conditioning unit.

TEC Driver
Operation of a TEC module for both heating and cooling requires the infrastructure for changing the magnitude and polarity of the voltage applied across it. Change of voltage polarity can be achieved using an H-bridge circuit but magnitude variation requires additional circuitry. This driver circuit, as shown in Figure 2, can be constructed using two half bridge BTN8982 device and a low-pass L-C filter [23]. This combination enables the change of current flow direction through the TEC, thus changing its operation mode. Using PWM signals to operate the driver in ON-OFF mode enables the control of current flowing through the device. However, the power loss in TEC module in such a configuration is higher than in the DC mode. To compensate this power loss, a low-pass L-C filter circuit with a cut-off frequency f c equal to 11.813 kHz is implemented between the TEC and the H-bridge driver. A signal with PWM frequency of 64 kHz is generated from the microcontroller such that the voltage ripples are minimized by the filter circuit, resulting in a smooth DC voltage. Using this setup, the voltage across the TEC can be regulated from 0 V to a 12 V maximum by varying the pulse width from 0% to 100%.

Gases, Water and Nutrient Exchange
The primary raw product and byproducts of the biological processes constitute O 2 , CO 2 , and H 2 O (liquid and vapor). Concentration measurement of these compounds in gaseous forms is necessary for quantitative study of the mass fluxes due to the underlying biological processes. This requires measurements to be performed in sealed chamber. Simultaneously, to enable normal growth, these concentrations must be regulated. Adding to the complexity, water and nutrient supply mechanisms for the subjects vary with some requiring overhead spray (fungi) and some through a water bath. These requirements pose a challenge to design the infrastructure that provides both air-tight containment and fluid exchange on demand. To overcome this limitation, a circulation unit constituting five membrane pumps (M1-M5) is used for fluid circulation into and out of the chamber. These pumps enable the circulation on demand while keeping the chamber air-tight. Pumps M1 and M2 are coupled to work in opposite flow directions such that Pump M1 removes the gas mixture from the chamber to the external sink and Pump M2 fills it with gases of known concentrations from an external source. The circulation unit uses Pumps M3-M5 for water and nutrient supply, where Pump M3 supplies water to internal reservoir and eventually to growing medium container on overflow, Pump M4 supplies water and nutrient mixture to spray nozzle or directly to growing medium container, and Pump M5 removes water to external reservoir where water could be recycled or enriched with nutrients as required, thus completing the water and gas circulation between chamber and the external source.

Lighting
The radiant flux required for the subjects of interest varies between species and organisms. Certain fungal species require white light while plant species mostly require red and blue components [24]. The literature also indicates the changes in chemical composition in plants in response to red and far-red light [25,26]. Events such as flowering and germination could be triggered by varying the spectral components and circadian rhythms [27,28]. This, therefore, requires light source with adjustable spectral composition and power. Narrow-band LEDs covering a wide range of wavelengths and wide-band white LEDs, as shown in Figure 3, are widely available from different manufacturers [29]. white LED series compared [29]; and (right) narrow-band LED series compared [29].
One of the goals of this work was to design and include a light source with adjustable spectrum. Spectral power distribution of typical white LEDs with different color temperature (3000-6500 K) could be used as the primary source and the additional wavelengths that influences various biological processes or trigger events could be included using narrow-band LEDs. A complete range of spectral requirements for various species is still unknown and needs to be studied. A preliminary LED lighting unit with a combination of neutral white, narrow-band red, blue, green, and support for inclusion of UV/far-blue and IR/far-red LEDs was designed.

LED Driver for Spectrum Regulation
Spectrum adjustment and light-based event triggering require that the individual channels (i.e., white, red, blue, green, UV/far-blue, and IR/far-red) be independently adjusted. LEDs used in this system are daisy-chained modules of three or four LEDs connected in series and operating at 12 V. As shown in Figure 4, every color channel has a MOSFET based low-side driver to adjust the radiant spectral power using PWM signals. These vertical columns of daisy-chained modules are combined into groups that are operated using relays. This grouping is done such that the first group corresponds to the central vertical column and the preceding groups correspond to the adjacent columns. The overall advantage of this setup is that the radiant spectral power and the total area covered by the LEDs can be varied as required.

Sensors
Thecombination of Sensors S1-S5, listed in Table 1, are capable of measuring CO 2 , O 2 , and volatile organic compound (VOC) concentrations; air and substrate temperatures; atmospheric pressure; relative humidity; and moisture of growing medium. Sensor S1 is a non-dispersive infrared sensor for CO 2 concentration measurement also housing an additional relative humidity and temperature sensing element. Sensor S2 is an environmental sensor for measuring relative humidity, temperature, pressure, and VOC concentration. The O 2 sensor (Sensor S3) is an electro-chemical galvanic cell that produces voltage on exposure to O 2 . Its sensitivity is proportional to the O 2 concentration but its analog output is out of range of the internal ADC of the microcontroller and thus an external ADC with programmable gain is used for signal amplification. All the above mentioned sensors use I2C communication interface to transfer measurement data to the microcontroller and is enclosed as a stand-alone sensor unit.
Temperature sensor (Sensor S4) is used for substrate temperature measurement and communicates with the controller using a proprietary one-wire interface. This interface allows addition of several sensors to the same data-bus without additional hardware changes. The substrate moisture concentration is measured using a capacitive sensor (Sensor S5) with analog voltage output. These two sensors are separated from the other sensors to facilitate their placement inside the substrate or the growing medium. The control unit, as shown in Figure 5, constitutes the microcontroller, drivers, switching circuits, voltage regulation, and current protection circuits. The microcontroller used is a 32-bit ARM Cortex M4 device from ST-Microelectronics clocked at 100 MHz. It is connected to a SD card for local data logging and storing configurations and calibration data. A real-time clock (RTC) is used for time keeping and timestamps for logged data. Communication to external system is realized using UART to USB interface. The PWM peripheral pins drives the LED lighting system, TEC heating-cooling system, internal circulation fans, and external heat exchanger fan. General purpose input-output drives the electromechanical relays of the LED group switch and Pumps M1-M5. The entire system is designed to be operated using a single 12 V DC source and thus incorporates the necessary DC-DC step-down converter for supplying 5 V for low voltage electronic components (microcontroller, humidifier, etc.).

Assembled System
Components constituting the modular units were assembled together with 3D printed parts and enclosures, as shown in Figure 6. The control unit enclosure is made of a 3D printed frame and acrylic walls with Molex connectors for connecting it with the chamber unit. The sensor unit is suspended inside the chamber unit with a 3D printed adjustable arm. The circulation unit is connected with the bulkhead connectors of the chamber unit using 4 mm polyvinyl chloride tubes, keeping the chamber unit air tight. The LED panel, not visible in the figure, is mounted on the inner side of the chamber lid and connected using a Molex connector to enable complete disconnection while opening the lid. Push-pull arrangement of the fans and the integrated humidifier can be seen in the highlighted air conditioning unit in Figure 6.

Software Design
Similar to the modular approach of the hardware design, software components were also developed as independent components and integrated using standard interfaces. To enable autonomous operation of the chamber and machine-to-machine (M2M) communication, the following requirements were established and realized: • Design and execution of control application or custom experiment regimes on the designed system • Access to measurement data and system states for performing data analytics, monitoring, and process control • Interface to specify optimal operation points (set-points) and control parameters computed externally (expert user or decision support system) These requirements were translated to a framework, as shown in Figure 7, with a three part solution: (1) open-source firmware core for control unit with necessary drivers, middleware and application interface for reliable operation of the chamber; (2) cloud platform with data, protocol and web sever for data aggregation. data visualization. and interaction with chambers for process control; and (3) code generation framework for control application or experiment regime development. This architecture facilitates the use of the controlled environment for different subjects and executing different experiments. The following sections explain the software design of the IoT Framework and device firmware in detail.  Figure 7. Software and information exchange framework: consisting of code generation framework for application development, hardware setup for experiment and data transmission, and cloud platform for data collection and user interaction.

Device Firmware
The firmware core, running on the microcontroller, is categorized into four layers to provide abstraction, as shown in Figure 8. The hardware abstraction layer is dependent on the microcontroller and is based on the Arduino libraries (arduino core) ported for STM-32 microcontrollers (STM32duino). The device manager layer contains managers, implemented as state machines, specific to each electronic component connected (e.g., sensors and actuators). These managers are responsible for: data access from sensors, driving the actuators, monitoring for faults, scheduling the measurements at specified intervals, intercepting external communication, and logging data. The middleware layer contains managers, which serve as brokers that direct the flow of data between the modules of different layers. Data from the sensors are accessed by the modules of different layers using a data structure managed by data manager. The message broker directs the function calls and data between the external system (e.g., decision support system or user) and the corresponding manager modules. The system manager checks if all other managers are running, periodically servicing the watchdog timer, and re-initializing their state machines in the case of error. The task scheduler implemented is preemptive priority based, with highest priority assigned to the components of device manager layer and lower priority to the layers above it. The application interface translates control decisions made by the application layer into suitable actuator commands, thus abstracting the application logic from the hardware. The application layer contains the experiment regimes or apps (e.g., climate control, respiration test, etc.) that are custom developed. This abstraction provides the system its programmability aspect that enables users to develop these regimes and execute them without having to deal with the underlying hardware and firmware.   Figure 8. Firmware architecture with its layers, components, and their interaction. The layers (a-e) correspond to application, middleware, device manager, hardware abstraction, and hardware layer, respectively.

Application Development
Application development requires the knowledge of C/C++ programming language since it involves the modification to the application layer in the firmware. When the experiments performed with the chamber differ, the application that runs on the control unit must be changed accordingly. This requires firmware modification and might not be feasible for all end users. To compensate this limitation, an additional development framework based on MATLAB/Simulink was developed to utilize the model-driven-development environment to create the experiment regimes (apps). This framework provides a Simulink interface model within which the application can be designed. Based on the designed Simulink model, this framework generates the application interface of the firmware and integrates the embedded code generated from the Simulink model into firmware core, as indicated in Figure 7. This framework also generates an application user interface that can be directly imported into the web interface of cloud platform. This is done using a developed MATLAB script that generates HTML code snippets for every input signals defined in the Simulink bus objects of the model. These code snippets are combined into standard user interface element (widget) for every bus object that can be used within the proposed cloud platform. This eliminates the need to develop user interfaces for accessing process variables and thus saves time. However, in the absence of MATLAB/Simulink, application can be developed using C/C++ IDE tools (e.g., Arduino) and the corresponding UI has to be manually configured in the cloud framework.

Cloud Framework
Monitoring of data in real-time and performing computation based on the measured values are crucial. It is also necessary to scale the number of devices that can be simultaneously operated. Suitability of ThingsBoard, an open-source software, as a candidate for implementing the cloud platform can be justified by its use in several research work in the internet of things (IoT) domain [30][31][32]. This platform includes a database server for data storage and retrieval; a web server for providing web-clients through which data and settings could be accessed or changed; and a protocol server (e.g., MQTT, HTTP) for enabling communication with end devices.
As a proof of concept, ThingsBoard was set up on a virtual machine and configured to aggregate data from multiple device instances. Interaction with the connected chamber is enabled through three configured dashboards (monitor, diagnose, and control) with the possibility to import additional widgets (user-interface/UI elements), as shown in Figure 9. Monitor dashboard displays various measured and system parameters in real-time. Diagnosis dashboard allows manual control of actuators and also provides command line interface for debugging the designed system. Control dashboard, containing widgets generated by the application development framework, is application specific and allows the configuration of its parameters (e.g., set-points, control parameters, etc.).

Data Exchange
Data between the server and the designed control unit are of four different types: telemetry data from the control unit to server; RPC (Remote Procedure Call) requests from server to control unit; RPC response from the control unit to server; and attributes (set-points, configs, etc.) from server to the control unit. These four types of messages are defined as three MQTT (Message Queuing Telemetry Transport) topics (i.e., telemetry, attributes, and RPC) in the server. The payload of these topics ia a JSON (JavaScript Object Notation) string that encapsulates the key-value pair (Listing 1). This key-value pair for telemetry and attributes are simply the parameter that is measured and its value, whereas, for RPC, there are only two key-value pairs, of which the first corresponds to the name of the method to be called and the second corresponds to the parameters that need to be passed to the method. Communication between the chamber and the server is realized using an external device indicated as MQTT Streamer in Figure 7. It forwards the JSON data received from the control units over USB to the server, after encapsulating the message into a MQTT broadcast messages. The RPC calls from the server is decoded into JSON string and is forwarded to the respective control unit over USB. This forms the bridge between the standalone control unit and the server.

Climate Control Application
A set of open loop and closed loop controllers, as shown in Figure 10, were implemented in Simulink using the application development framework. These constitute PID controller for temperature control; hysteresis controller for humidification and CO 2 concentration; circadian generator for LED light spectrum; and an additional cyclic controller for CO 2 concentration.

Circadian Rhythm Generator
The chamber does not include sensors for measuring the radiant flux. Therefore, any disturbance in this flux due to external source cannot be measured and is not compensated. If this disturbance is avoided, the light spectrum, and thus the spectral power, inside the chamber can be individually varied and the necessary radiant flux can be achieved. To achieve this, a configurable open-loop controller for circadian rhythm generation was designed. This uses a sinusoidal function to generate the base ON amplitude signal where t on , t off , and t offset are the ON, OFF, and offset times in seconds (s). Using the given set-points for minimum and maximum percentage radiation power, the input for individual LED channels are generated as where I mini and I maxi are the minimum and maximum spectral power in percentage (%) of the ith LED color channel and i = 1, 2, . . ., 6 corresponds to white, red, green, blue, far-red, and far-blue, respectively.

Results and Discussion
Validation of the designed system followed a series of automated test routines and growth experiments with plants and insect larvae executed in the designed growth chamber. This section consolidates the results obtained from these tests and provides an overview of the system capabilities and limitations.

Temperature Sensors and TEC Performance
An automated TEC test procedure implemented as part of the firmware was executed. This test procedure first heats the system with maximum power for a duration of 1 h and then reduces the power u T in steps of 5% after fixed intervals. This test covers the range of operation of the TEC module in both heating and cooling modes (100% to −100%). Temperature changes inside and outside the chamber and the corresponding power applied were recorded, as shown in Figure 11a.  Figure 11. Evaluation of sensor and actuator performance: (a) TEC actuator and temperature sensor test; (b) humidifier and humidity sensor test; (c) gas exchange test; and (d) light spectrum and circadian pattern generation. E1 and R1 correspond to measurements made outside and inside the chamber, respectively, using a reference sensor. Data represented by u correspond to actuator state.
In the first hour, the temperature inside chamber rises to about 44 • C and slowly saturates. When the power is reduced from 100% to 85%, the temperature raises by about 0.7 • C. This can be explained by the additional heating in the TEC due to the ripple voltage generated from the digital to analog conversion. At 100% power, there are no voltage ripples and therefore the thermal output is reduced. The range from 20% to −20% power produces no change in temperature. This behavior is again the result of digital to analog conversion where the PWM corresponding to this range does not produce voltage high enough to conduct current across the TEC. In the heating mode, the temperature inside the chamber could be raised to 20 • C above the ambient temperature. However, in cooling mode, the temperature could only be lowered by 10 • C. This phenomenon could be explained by Equation (3), representing a TEC model [33,34]. The heat transferred (W) by the TEC is given by where α q is the Seebeck coefficient (V K −1 ), I q is the current (A) flowing through, δT is the temperature difference (K) between the hot and cold sides, and R q is the series resistance (Ω) of the TEC module. It can be seen that the joule heating term, I q 2 R q , contributes positively to the heating mode while affecting the performance negatively in the cooling mode. It can also be noticed that the outside temperature also increases during the initial heating phase. This results from the heat transferring from the chamber to the outside. It can be concluded from this observation that the thermal conductivity of the chamber walls needs to be reduced to increase the thermal insulation of the chamber.

Humidity Sensors and Humidification
An automated test procedure for characterizing the humidifier and testing the sensor accuracy was implemented and executed. This procedure repeatedly activates the humidifier for a fixed short duration followed by a measurement phase, where the change in humidity is monitored. Figure 11b shows the course of this automated procedure and the captured measurements.
The humidity values from Sensor S1 deviate significantly from the reference measurement device (R1) due to self heating of the sensor (3 • C). To obtain correct humidity readings H from the sensor, the manufacturer recommends correction to the obtained raw humidity data H raw in percentage relative humidity (RH) as where k 1 = 17.62 and k 2 = 243.12 • C are coefficients for correction supplied by manufacturer, T raw is the temperature reading in • C from the sensor, and T = T raw − 3 • C is the compensated temperature in • C. Data S1-Corr in Figure 11b represents the sensor data after applying this correction for error compensation. Sensor S2 data also show deviation and this is due to its slow response and narrow measurement range (10-90% RH). The humidifier (ultrasonic atomizer) could raise the humidity inside the chamber to 100% within 2 min. This translated to a conversion rate of 0.01 × 10 −3 kg s −1 .

Gas Exchange
A substrate block colonized with Lentinula edodes fungi was placed in the chamber to raise the CO 2 concentration to about 2500 ppm. Concentration outside the chamber was measured around 600 ppm. Ventilation pumps were activated to reduce the concentration of CO 2 inside the chamber. After 18 min, the concentration of the air inside and outside the chamber equalized. This can be observed in Figure 11c.
The resulting volume exchange rate of the ventilator is 15 L min −1 . As a consequence of air exchange with external source, humidity inside the chamber also was reduced to that of the external source.

Light Spectrum
The circadian rhythm generator implemented in Section 2.2.5 was tested. The intensity for white LED channel, I max1 , was set to linearly vary from 100% to 80% over a period of three days with no offset time. I max2 and I max3 were fixed at 100% for red and blue LED channel with +ve and −ve offsets, respectively. The intensity for green LED channel I max4 was fixed at 20% without offset. These amplitudes and offsets were selected such that the morning light was enriched with blue and evening light was enriched with red wavelength components. The resulting control signals u NW , u R , u G , and u B corresponding to neutral white, red, green, and blue channels, respectively, are compared against the outside solar irradiation (I out ) in Figure 11d.
The controller was activated after Day 1 indicating the use of offsets to adjust the day and night times within the chamber. The shape and time periods of the control signal generated for u NW could reproduce that of the external light. Spectrum of the incident light could be enhanced with specific wavelengths temporally using the control logic and hardware configuration. Lack of sensor feedback in the current setup limits the control of the generated spectrum. Thus, any drift in spectral composition due to heating and LED degradation cannot be compensated online, therefore requiring offline compensation.

Plant Growth
A hydroponic growing tray consisting of about 16 Ocimum basilicum plants approximately one month old was placed in the chamber unit. Open loop controllers introduced in Section 2.2.5 were used for light gas and humidity regulation. The circadian generator was set to generate day-night (square wave) light cycles corresponding to an 18 h ON and 6 h OFF cycle. Ventilator was operated at a cyclic ON and OFF time of 120 s and 3420 s, respectively. The TEC was operated at a constant power of 40% in cooling mode to condense the transpired water. The data collected from this experiment are presented in Figure 12 for a period of 150 h.
The LED lighting status, indicated by u I in Figure 12a, shows the ON and OFF cycles. The temperature inside the chamber follows the trend of the outside temperature when the LED is ON and falls by 5 • C when the LED is OFF. This can be explained by the heat generated from the LED panels and the TEC operating at constant power. Variation of carbon dioxide inside and outside the chamber can be seen in Figure 12b. The CO 2 variation during the LED ON cycle, LED OFF cycle and over the entire time frame have different trend. During the LED ON cycle, the concentration drops when the ventilator is OFF and it increases when ventilator is ON. During the LED OFF cycle, the concentration increases when the ventilator is OFF and it decreases, reaching the same concentrations as outside, when ventilator is ON. The rate change during LED ON cycle has a correlation to the temperature. These observations can be used to draw conclusions about photosynthesis and respiration taking place in these plants. It can be stated that light and temperature influence plant photosynthesis resulting in production of CO 2 . Net CO 2 produced in the absence of light is negative, which indicates the respiration process. The plant species under study shows increase in photosynthesis rate with decrease in temperatures. Humidity, as shown in Figure 12c, stays constant during the LED ON cycle and is slightly elevated during the OFF cycle, indicating higher transpiration.  Figure 12. Plant growth experiment: (a) temperature and Light intensity variation; (b) CO 2 concentration variation due to ventilation, photosynthesis, and respiration; and (c) humidity variation inside and outside the chamber unit. E1 corresponds to measurements made outside the chamber using a reference sensor and data represented by u correspond to actuator state.

Larvae Growth
About 2000 hatchlings of Hermetia illucens were introduced in a growing tray containing a substrate made of chicken feed and water mixture. The growing tray was placed in the chamber unit with Sensors S4 and S5 submerged in the substrate. The example climate control application introduced in Section 2.2.5 was used as the application running on the control unit. A temperature set point of 33 • C was used to regulate the air temperature inside the chamber. Cyclic controller for ventilator was selected with an ON and OFF time of 600 s and 1200 s, respectively, to regulate the CO 2 concentration. The data collected using the designed system is presented in Figure 13 for a period of 40 h.  Figure 13. Larvae growth experiment: (a) temperature variation in growing medium, chamber unit and outside; (b,c) CO 2 and O 2 concentration variation due to ventilation and larval metabolic activity; and (d) humidity variation inside and outside the chamber unit. E1 corresponds to measurements made outside the chamber using a reference sensor and data represented by u correspond to actuator state.
The air temperature inside chamber is maintained at the set 33 • C, as shown in Figure 13a. The PID controller compensating the variation in temperature due to the ventilation can be seen in the peaks of the control signal u T . It can be noticed that the substrate temperature (Sensor S4) gradually increases and reaches a peak temperature of 45.5 • C at 35 h. Similarly, the variation in the CO 2 and O 2 concentrations increases gradually also reaching the peak around the same time step. These variations in substrate temperature and gas concentrations can be concluded to be results of larval metabolism. Correlating these three measurements, it can be stated that increase in temperature increases larval metabolic activity and thus the dependency of the larval growth on temperatures can be concluded. Another observation that can be made from the humidity measurement (Figure 13d) of air is that, after the time step corresponding to the peak metabolic activity, humidity gradually falls. Moisture in substrate is gradually lost through evaporation and consumption by the larvae. It can be stated that decrease in air humidity can be explained by the substrate drying up. It is however inconclusive from this experiment if the fall in larval metabolic activity is due to the dry substrate.

Summary of System Specifications
Technical specifications of the designed system are consolidated in Table 2. The energy consumption of the individual components based on the previously mentioned experiments and additional measurements performed on individual components are presented in Table 3. This table also consolidates the maximum output achieved from these components.

Conclusions
The design of a programmable controlled environment using off-the-shelf components, custom designed 3D printed parts, and open-source and self developed software was possible. Actuators for resource exchange, climate control, and light spectrum adjustment were designed, incorporated, and tested. Software framework was developed and tested for programming experiments and logging sensor data and system states. This framework also enabled access to logged data, adjusting controller parameters, and performing diagnostics through a graphical interface both locally and remotely. Example applications were developed using the application development framework to showcase the capability of the system to execute custom control algorithms and experiment procedures for automated study and information capture. Hardware and software were designed with focus on modularity and scalability, respectively, allowing integration of additional hardware components (sensors and actuators) and connecting multiple devices to the cloud framework. Results of the actuator and sensor tests revealed their capabilities, limitation, and also improvement areas such as chamber insulation for better thermal performance. These results also indicated that Sensors S1-S4 performed well in measuring the required parameters while Sensor S5 could be replaced for a more robust moisture sensor when available. Experiments performed with plants and larvae generated data that can be used to perform quantitative studies on the biomass and byproduct production. These experiments also provided data that can help study growth processes and their responses to the environmental factors.
The designed system fulfills the requirements of a controlled environment that is programmable, low-cost (<1000 EUR), open-source based, and suitable for small plants, insect larvae, and mushrooms. The results obtained and presented in this work serve as fundamental setup for the detailed study of individual subjects and development of mathematical models, which shall be the focus of future work.