Using microcontrollers and sensors to build an inexpensive CO2 control system for growth chambers

PREMISE A CO2 control system is important for investigating how elevated CO2 affects plant growth. Our automatic CO2 monitoring and control system offers an inexpensive and flexible way to make CO2‐enriched environments. METHOD AND RESULTS Using microcontrollers paired with non‐dispersive infrared CO2 sensors, relays, and valves, we developed a low‐cost system for monitoring and controlling CO2 levels in growth chambers. CONCLUSIONS Compared with existing commercially available CO2 control systems, Arduino‐based microcontrollers offer affordable access to the data logging of CO2 levels in growth chambers, thereby reducing budget limitations for creating growth conditions with highly controlled CO2 concentrations.

http://www.wileyonlinelibrary.com/journal/AppsPlantSci © 2020 Chen and Markham advances in filtering in NDIR sensors have greatly reduced this interference (Yasuda et al., 2012). NDIR sensing technology has therefore been proven to be durable and stable for detecting CO 2 in a range of environmental settings; however, because temperature and duration of use can affect sensors (Yasuda et al., 2012), periodic calibration is still essential. Furthermore, the electrical noise associated with growth chambers (especially from lighting systems) can potentially interfere with the communication between a CO 2 sensor and its data acquisition system. To avoid this, we paired each sensor with a microcontroller in close physical proximity to the sensor and used serial communication, as opposed to a more electrically sensitive digital communication between the sensor and microcontroller. This setup offers an inexpensive and flexible way of making CO 2 -enriched environments, including the data logging of CO 2 levels in growth chambers, and can easily be modified to accommodate additional sensors and environmental controls.

METHODS AND RESULTS
Our system is based on K30 NDIR CO 2 sensors (Senseair AB, Delsbo, Sweden). They are inexpensive and have integrated calibration and communication circuits (see Table 1 for materials list). They are not sensitive to water vapor, meaning there is no need to use a desiccant to absorb water before sampling. NDIR CO 2 sensors come in a range of sensitivities and can send digital or analog signals to computer interfaces. The model we used can be calibrated at 0 or 400 ppm CO 2 by adding a contact switch to its circuit board (CO2meter.com, 2020). The sensors also easily connect to air supply tubing for calibration. Calibration takes approximately 3-5 min, pumping an air stream of 0 or 400 ppm CO 2 air over the sensor, and then closing the appropriate contact on the sensor circuit board. The sensors' circuit board and all of the other electrical components of our system have standard 2.5-mm electrical connector spacings, allowing the wiring to be connected with header pins and connectors (Dupont, JST type, or screw terminals), which are widely available from electronic parts suppliers. Because growth chambers generate considerable electrical noise, CO 2 sensors need to be in close proximity to their signal processors to ensure that sensor readings do not degrade. In our system, each CO 2 sensor is therefore connected to a separate microcontroller mounted on each growth chamber ( Fig. 1), which then controls a gas solenoid valve, via a relay switch, on a central manifold connected to a CO 2 supply tank (Figs. 2, 3). We used Arduino Uno-type microcontrollers to communicate with the CO 2 sensors. We used a data logging shield (Adafruit, New York, New York, USA), a real-time clock, and an SD card socket connected to each Arduino, following the manufacturer's instructions (Earl, 2013). The large SD cardholder can fit any SD card and store up to 32 GB of information (FAT16 or FAT32 format). The microcontroller can also communicate directly to a computer via a USB or wireless connection, allowing data to be monitored in real time and the microcontroller to be reprogrammed as needed.

FIGURE 1.
Wiring connections between the K30 CO 2 sensor (right) and the Arduino Uno-type microcontroller (left) using serial communication. A JST connector was soldered to the K30 circuit board and a calibration switch was soldered to the board to enable the recalibration of the CO 2 sensor. Calibration gas can be passed through the air sampling tube during calibration. The 5 V and ground pins of the CO 2 sensor are connected to the corresponding 5 V and ground pins of the microcontrollers (red and black wires, respectively). Pin 8 (RX on the microcontroller) connects to the TX pin on the sensor (yellow wire), and pin 9 (TX on the microcontroller) connects to the RX pins of the CO 2 sensor (green wire). The data logging shield (not shown) stacks onto the microcontroller. For use, the sensor is placed in an acrylic box with vent holes and mounted on the side of the growth chamber.
http://www.wileyonlinelibrary.com/journal/AppsPlantSci © 2020 Chen and Markham The CO 2 sensors receive their power supply from the microcontroller. Arduino-type microcontrollers can have a range of voltage inputs, but we found that providing 9 V of power to the microcontroller worked best. If supplied with less than 7 V, the microcontroller and sensor may be unstable and fail to record sensor readings. If using 12 V or higher, the voltage regulator of the microcontroller may overheat. Serial communications between the CO 2 sensor and the microcontroller require a four-wire connection (Fig. 1), made via the connectors on the data logging shield stacked on the microcontroller. The sensors can also communicate with the microcontrollers using a digital protocol, which could theoretically allow multiple sensors from many chambers to be connected to a single microcontroller; however, due to the electrical interference in growth chambers, each sensor needs to be placed in close proximity to a microcontroller so serial communication is more stable. The 5 V and ground pins of the sensor are connected to the corresponding 5 V and ground pins of the microcontroller. The transmitting (TX) pin of the sensor is connected to FIGURE 2. Connections between the Arduino microcontroller and the relays controlling the gas solenoid valves. Each microcontroller (shown with data logging shield removed) is wired to the relay board from its 5 V connection and digital pin (pin 2) to the 5 V connection and corresponding pin controlling a switch on the relay board. The relay board has its own 5 V power supply. The 12 V power supply for each solenoid valve runs through a corresponding relay switch. The CO 2 tank is connected to gas solenoid valves that are controlled by the Arduino microcontroller and the relays, which regulate the injection of pure CO 2 into each growth chamber.

FIGURE 3.
Overall layout of the CO 2 control system with one growth chamber: CO 2 sensor (A), Arduino microcontroller (B), relay board (C), gas solenoid valves (D), CO 2 tank (E), computer (F), and growth chamber (G). Each CO 2 sensor is attached to an internal wall of the growth chamber and communicates with an individual Arduino microcontroller outside the growth chamber. The extra five red (5 V) and blue (relay signals) wires from the relay board can be connected to five additional microcontroller 5 V pins and digital pins, respectively. http://www.wileyonlinelibrary.com/journal/AppsPlantSci © 2020 Chen and Markham pin 8 (a receiving [RX] pin) of the microcontroller. The RX pin of the sensor is connected to pin 9 of the microcontroller (the microcontroller's TX pin). The CO 2 injection system consists of a compressed CO 2 gas tank connected to a manifold of solenoid valves activated by electrical relays (Figs. 2, 3). Gas solenoid valves come in a range of voltages, but 12 V models are the most commonly available. Valves with 0.25-inch connections can be attached to a manifold made of brass tubing and T connectors, which are commonly available from plumbing or compressed air equipment suppliers. The CO 2 supply tank is connected to the manifold via a compressed air hose with a quick-release connection, so the tank can be easily replaced when empty. The CO 2 pressure in the manifold was adjusted to a low level (approximately 10 psi) because very little CO 2 is needed to increase its concentration in a chamber. Plastic tubing is used to connect the manifold to each growth chamber, and the CO 2 is released into the chamber at the end opposite the sensor.
Each microcontroller is connected to a relay switch controlling a valve on the CO 2 injection system (Fig. 2). Relay boards come in various configurations, and it is convenient but not essential to have a relay board with at least as many channels as there are sensors. Our system uses an eight-channel relay board with its own 5 V power supply; relay boards can be powered by a microcontroller, but this is not recommended due to the relay board's power consumption. The relay board can be wired such that the relays are in a closed position when not powered, which avoids injecting CO 2 into a chamber if there is a power interruption. Each microcontroller 5 V pin is connected to the 5 V pin of the relay board. A digital pin on each microcontroller is connected with a pin on the relay board, with each controlling a different relay switch on the board.
The microcontroller is programmed using Arduino software (https://www.ardui no.cc/en/main/software). The code provided here (Appendix S1) is an example of a chamber set to achieve an 800 ppm CO 2 concentration (Fig. 4). The chamber numbers, CO 2 levels, monitoring time, valve open time, etc. can be edited within the code based on the experimental conditions. Even a brief injection of CO 2 will cause a rapid increase in the CO 2 concentration in the chamber; thus, the CO 2 level that opens the valve must be set below the desired chamber CO 2 concentration and the valve should open for a short enough period to result in a CO 2 increase to near the desired concentration. In this example, the CO 2 sensors monitor the CO 2 level every 30 s. If the CO 2 level in a chamber drops below the set value, the corresponding gas valve is set to open for 0.2 s and will not reopen for 30 s, allowing the air to circulate in the chamber before adding more CO 2 . We tested the system using Conviron A1000 chambers (Conviron, Winnipeg, Canada), which have a 1000-L volume and were set at 24°C and ca. 36% humidity. The growth chambers had their external air supply valves closed and these were also covered in cellophane tape to reduce air leakage. An internal fan provides rapid air movement within the chamber. Figure 4 provides an example of the CO 2 concentration in chambers set to 600 ppm and 800 ppm CO 2 over a 24-h period. It took approximately 3 min for the chamber CO 2 level to increase from the ambient concentration to reach the target CO 2 level of 600 ppm. To achieve the desired CO 2 level of 600 ppm, the valve was set to open at 585 ppm and stay open for 0.15 s. This resulted in ca. 45 mL of CO 2 gas at atmospheric pressure being added to the chamber (i.e., 0.0045% of the volume of the chamber) each time the valve opened, and therefore had a negligible effect on other parameters of the chamber air (e.g., humidity and pressure). During a 24-h period, the CO 2 concentration ranged from 577 ppm to 642 ppm in the chamber, with a mean of 602.3 ppm and a standard deviation of 13.6 ppm, resulting in a 2% coefficient of variation. All of the readings were within ±7.0% of the target CO 2 level. In order to achieve a CO 2 concentration of 800 ppm, the valve was set to open at 780 ppm and stay open for 0.2 s. The CO 2 level ranged from 761 ppm to 845 ppm, with a mean of 798 ppm and a standard deviation of 18.3 ppm. All of the readings fell within ±5.6% of the target CO 2 level. Although the absolute value of the standard deviation was higher at this high CO 2 target, the coefficient of variation was 2%, the same as it was for 600 ppm. In contrast, the CO 2 control system described by Godfree et al. (2011) had a coefficient of variation of 15% in its CO 2 level. In our laboratory, we have run growth experiments using this system for six chambers simultaneously. The use of larger chambers or chambers with less air movement will require adjustments in the air sampling frequencies and the length of time for which the CO 2 supply remains open. These are easily adjusted in the microcontroller code, and the results can be viewed in real time by connecting the microcontroller to a computer. It is also relatively straightforward to add a display to the microcontroller to view the chamber CO 2 levels (see, for example, https://www.ardui no.cc/en/Tutor ial/ Liqui dCrys talDi splay [accessed 8 September 2020]). Because the NDIR sensors can lose accuracy over time (Yasuda et al., 2012), calibration should be carried out periodically (CO2meter.com, 2020). Although the growth chambers in this study control several environmental conditions, Arduino-type microcontrollers are compatible with a number of robust sensors (e.g., temperature, humidity, soil water content), allowing the user to easily keep track of and log various environmental conditions. The relays used to control the solenoid valves can also be used as switches for any growth-related equipment, opening a range of possibilities for adding new functionality to growth experiments.

CONCLUSIONS
Our CO 2 control system gives researchers access to a low-cost setup for monitoring and controlling CO 2 levels in controlled environmental conditions. The CO 2 control system can be run in multiple chambers simultaneously, and we provide a versatile code for the CO 2 control system, which can also be used in other areas (e.g., monitoring and controlling temperature, humidity, and soil moisture). The system can be easily adapted for different experimental conditions, and its low cost allows the replication of conditions to be achieved for more statistically robust growth experiments.