*Article* **Use of Low-Cost Devices for the Control and Monitoring of CO2 Concentration in Existing Buildings after the COVID Era**

**Andrés Pastor-Fernández 1,\*, Alberto Cerezo-Narváez 1, Paz Montero-Gutiérrez 1, Pablo Ballesteros-Pérez <sup>2</sup> and Manuel Otero-Mateo <sup>1</sup>**


**Abstract:** In the COVID-19 era, a direct relationship has been consolidated between the concentration of the pollutant carbon dioxide (CO2) and indoor disease transmission. For reducing its spread, recommendations have been established among which air renewal is a key element to improve indoor air quality (IAQ). In this study, a low-cost CO2 measurement device was designed, developed, assembled, prototyped, and openly programmed so that the IAQ can be monitored remotely. In addition, this clonic device was calibrated for correct data acquisition. In parallel, computational fluid dynamics (CFD) modeling analysis was used to study the indoor air flows to eliminate non-representative singular measurement points, providing possible locations. The results in four scenarios (cross ventilation, outdoor ventilation, indoor ventilation, and no ventilation) showed that the measurements provided by the clonic device are comparable to those obtained by laboratory instruments, with an average error of less than 3%. These data collected wirelessly for interpretation were evaluated on an Internet of Things (IoT) platform in real time or deferred. As a result, remaining lifespan of buildings can be exploited interconnecting IAQ devices with other systems (as HVAC systems) in an IoT environment. This can transform them into smart buildings, adding value to their refurbishment and modernization.

**Keywords:** indoor air quality (IAQ); smart building; sustainable development goals (SDGs); COVID-19; CO2; refurbishment

#### **1. Introduction**

The World Health Organisation (WHO) declared on 11 March 2020 that COVID-19 disease had become pandemic [1]. Since then, the WHO has been constantly reporting on the outbreak and providing global guidelines for its control [2]. This has been a global challenge in air quality (AQ) research [3–5], especially on its prevention modes, and detection and protection systems [6,7]. For example, research has been performed on barriers to transmission, infection, and vaccines [6,8]. Many researchers are still working on these and other issues. Among them, the importance of air renewal to achieve adequate IAQ and avoid health risks can be highlighted.

The WHO identified direct contact with people suffering from the disease as an obvious source of contagion. Therefore, the social distance was delimited, the use of masks was made compulsory, and other types of actions were taken such as eye protection and use of biohazard clothing for professionals directly exposed (for example, hospital workers) [9,10]. In addition, general applicable options that are not dependent on the decision of the individual were also sought during this pandemic. For instance, closing public spaces, restricting seating capacity in places of assembly [11], and increasing indoor air renewal in public buildings [12,13] stand out. Capolongo et al. [14] summarised a series

**Citation:** Pastor-Fernández, A.; Cerezo-Narváez, A.; Montero-Gutiérrez, P.; Ballesteros-Pérez, P.; Otero-Mateo, M. Use of Low-Cost Devices for the Control and Monitoring of CO2 Concentration in Existing Buildings after the COVID Era. *Appl. Sci.* **2022**, *12*, 3927. https://doi.org/10.3390/ app12083927

Academic Editors: Tiziana Poli, Andrea Giovanni Mainini, Mitja Košir, Juan Diego Blanco Cadena and Gabriele Lobaccaro

Received: 30 November 2021 Accepted: 11 April 2022 Published: 13 April 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

of recommendations in a decalogue related to health strategies and pandemic challenges, which can be a great reference for addressing the future times ahead.

On the other hand, two means of transmission of this type of disease were established: surface and airborne. To combat the first mode, surfaces that have been in contact with secretions or particles from sick people must be treated to inactivate the virus [15]. In addition, cleanliness of hands and face have been increased to reduce the likelihood of infection [16]. Concerning airborne transmission, the spread can occur through "droplets" [17,18], which are larger than 100 micrometres in size, and aerosols, which are smaller than 10 micrometres in size. Research has proven that contagion can involve aerosols from distances of up to 10 m [11,17]. Therefore, how to reduce aerosol concentration in indoor spaces has been explored [19,20]. In this context, aerosol monitoring can be performed by means of characterisation systems [21].

Apart from being infected with the COVID-19 disease, exposure to air pollutants can affect different organs of people [22], damaging the respiratory, nervous, urinary, and digestive systems, among others. International standards and regulations [23–29] establish the following parameters for determining air quality (AQ):


It can be noted that these parameters are mostly assessed in outdoor environments using stations with specific instrumentation. The European Environment Agency (EEA) and the European Commission provide information on AQ [30] throughout Europe [31]. Clean air is a mixture of gases [32]. The percentage of CO2 corresponds to 0.035% among the different elements. However, excess CO2 is considered to be one of the main sources of environmental pollution. Unfortunately, measurement of CO2 concentration is not available at all stations.

To reduce harmful emissions in outdoor and indoor environments [33], many countries have established strict policies to improve AQ and comfort. In the current context, they are also serving to identify areas with a potential danger of contagion in the COVID-19 pandemic. In indoor environments, CO2 displaces oxygen and exposes users to the effects of hypoxia [34,35]. As proposed by Novakova and Kraus [36], the ideal indoor concentration can be established close to 350 parts per million (ppm) in environments with special requirements and 500 ppm in normal activity environments. Nevertheless, other reference values are provided in specific standards and regulations because it is considered an indicator that relates AQ and comfort level to CO2 concentration [37,38]. It can be noted that in the context of COVID-19, CO2 concentration [39–42] from occupant respiration has been used as an indicator of IAQ. As a baseline, the limit values set by the US Environmental Protection Agency (EPA) for CO2 concentrations (in ppm) and the corresponding AQ are shown in Table 1. In the same vein, the Technical report "CEN/TR 16798-2" [43] indicates that a value of 400 ppm can be assumed as the average outdoor concentration.

**Table 1.** AQ related to the pollutant CO2.


In living spaces, the main focus of CO2 increase is of metabolic origin, which is related to the type of activity [44,45]. As a result, the more effort a person makes, the more exhalations are produced, and the more CO2 is emitted. The WHO has classified activities according to the "intensity of physical activity", relating them to the metabolic equivalent unit (MET). Table 2 provides a classification of activities with the range of physical intensities in METs. In this regard, Soares et al. conducted research [46] using low-cost devices, concluding that an increase in activity results in an increase in MET concentration and exhaled metabolic CO2.


**Table 2.** Activity classification according to metabolic equivalent level (MET).

COVID-19 is currently a major global concern. Peng and Jimenez confirmed that CO2 co-exhaled with aerosols containing SARS-CoV-2 by COVID-19 can be used as an indicator of indoor SARS-CoV-2 concentrations [47]. Other researchers have pointed out that group immunity is expected by the end of 2024 [48] thanks to the vaccination process, but broader strategies must be put in place that can respond to future diseases. Therefore, buildings should aim to act smarter [49], renovating indoor air to achieve better quality. These activities are in accordance with the sustainable development goals (SDGs) of the 2030 Agenda [50]. Although the need for AQ control in public, residential, and business buildings has been analysed in many studies [36,51,52], the price of the systems required for this purpose has been a barrier to implementation. This applies mainly to low-income households [53] and socially disadvantaged environments [54].

The Center for Disease Control and Prevention (CDC) has published extensive research on aerosol concentrations in different situations. In unventilated shared-use spaces, CO2 concentration is high [36] and infections are higher. This context is unchanged even if a social distance greater than two metres or six feet is maintained [11,55,56]. Although there are other methods to reduce pollutants such as filtration with HEPA filters [57], ultraviolet radiation treatments, or disinfection with ozone [58], they were not considered because they are beyond the scope of this research. In this context, ventilation has become a fundamental solution [59,60] for the reduction in indoor pollutant concentrations and for the improvement of IAQ [61]. In some cases, the way to achieve air renewal is by means of natural ventilation (cross, outdoor, indoor) [33,62,63]. In other cases, a forced ventilation system must be used [64]. In all cases, pollutant concentrations are reduced if air is renewed. These lead to a decrease in CO2 concentration in indoor spaces [65]. It can be noted that the current trend for effective AQ control is to promote natural ventilation through strategies combining large external openings [66] with intelligent ventilation [67], which also allows optimizing energy consumption by increasing its efficiency [68,69].

Several studies have analysed methods and models to determine the air renewal required to achieve acceptable IAQ parameters [70–73]. In all of them, the amount of exhaled CO2 has emerged as a critical factor in establishing the number of air renewals. In addition, different standards indicate the number of air renewals recommended in the diverse living spaces of buildings according to their use and occupancy. Among them, those set by ASHRAE [74,75] and the national legislation in Spain [76], which comes from the Directive 2010/31/EU of the European Parliament and of the Council of 19 May 2010 on the energy performance of buildings, stand out.

Monitoring IAQ, and more specifically CO2 concentration in buildings, can be realised using professional (commercial) equipment or clonic devices. These clonic systems are increasingly being used due to their reliability and prestige in the electronics market. Villanueva et al. [77] carried out a research focused on commercial equipment and clonic devices used in Spain for the measurement of CO2 during the COVID-19 pandemic. As a noteworthy result of this research, it must be noted that the price of commercial instruments on the market ranges from EUR 75 for the cheapest to EUR 400 for the most expensive, although they include other functionalities to measure relative humidity, temperature, and particle size. In addition, they also evaluated clonic devices. They showed that the measurement error varies over a spectrum ranging from 9% to 15% in environments with 500 ppm CO2 and from 7% to 12% when concentrations are closed to 700 ppm CO2.

On the one hand, professional equipment are electronic devices designed and commercialised by manufacturers intended for a professional audience (laboratories and health and safety services), which can monitor any physical or chemical parameter of AQ. They can be classified according to their portability, autonomy, and number of parameters monitored. In addition, these systems have the advantage that their probes and sensors are calibrated in metrological laboratories with controlled atmospheres. They also allow data to be stored and sent instantly to other devices. However, the high weight of some of them, due to the high number of measuring sensors, is a disadvantage for their portability.

On the other hand, clonic measurement devices are composed of electronic components and open-sourced software. The scalable configuration of clonic devices makes it possible to customize and increase the number of features of professional equipment. To begin with, a motherboard must be selected. Raspberry Pi and Arduino are two of the manufacturers offering more competitiveness in this field. According to studies reviewed, 37.5% of clonic devices are based on Arduino microcontrollers and 35% on Raspberry Pi ones [78]. The use of a motherboard allows the connection of peripherals that help in capturing information on physical and chemical parameters of IAQ. Specifically, between 67% and 70% of the sensors that monitor IAQ are intended to measure CO2 [78,79]. Measurement range, sensitivity, and response time are their key sensors features. In addition to the two elements described, a communication unit must be included. This enables data storage, processing, and further analysis to be performed [79].

The interconnection of clonic devices with other systems favors the use of the Internet of Things (IoT) and data storage in the cloud. These enabling technologies allow wirelessly collected data to be evaluated for interpretation, in real time or deferred, for a real monitoring and control of the IAQ [79,80]. This has the potential to transform an existing building to be renovated into a smart building [81]. Several researches have studied the application of IoT for IAQ control [82,83]. They stress the advantages of system integration with connections to smartphone applications, ease of installation and scalability as an element to achieve cost improvements [84]. In this regard, Marquez et al. [85] developed research on an IoT solution that monitors CO2 concentration in smart buildings. In this way, the IAQ can be controlled and therefore, the health of the occupants be improved.

It can be noted that clonic devices present a series of limitations. These are related to the maintenance and calibration of the sensors assembled, the communication protocols, and their power consumption [86]. Fortunately, with the aim of creating devices that help to promote healthy, sustainable, and smart cities, considerable progress has been made in recent years dealing with these issues [79].

The first objective of this research was to design, develop, assemble, and prototype a low-cost clonic device to provide buildings [87] with smart functionalities in the IAQ field [88]. As indoor comfort is currently taking a back seat to the priority of maintaining safe CO2 levels to protect from COVID-19, research focused on the use of CO2 sensors. Another purpose addressed was the choice of the best location to place the clonic device. To this end, computational fluid dynamics (CFD) simulations [89] were carried out in different scenarios (ventilation options) for a living space that was used as case study. It can be noted that, to the best of our knowledge, this has not been addressed before. Once the

best locations for the placement and distribution of the instruments were determined, an experimental study was performed. Data were obtained with a calibrated equipment that was used as a reference standard and also with the low-cost prototype device. Comparisons were then made to check if measurements were acceptable for IAQ monitoring and control. In summary, the three main objectives and their relationship are shown in Figure 1:


**Figure 1.** Objectives of the research.

The main novel contributions of this paper can be summarised in the following four elements:


In summary, we showed for the first time, to the best of our knowledge, all the details of the components of the clonic device so that it can be cloned by anyone interested in the "do it yourself" philosophy. It also incorporated open source programming code, allowing other researchers to replicate the research and generalize this contribution to the scientific community and society. Furthermore, the use of the CFD methodology provided the most suitable points to determine the CO2 concentration in the space to be studied, eliminating points that could generate distortions in the control and monitoring systems. In addition, using an open-source system allowed the connection with other smart building systems, which in the COVID-19 era can be considered a preventive measure to analyze IAQ.

#### **2. Materials and Methods**

This section describes the methodology used in the research, including its application in a case study. The methodology is primarily based on the use of CFD to determine the positioning of the CO2 measurement system, for which simulations were carried out to identify those places where there is no air renewal. Next, it is necessary to design, configure, and develop a programmable clonic device.

The starting point was to select the living space where the prototype will be tested. A single-family house was taken in which a single bedroom was to be used as a study room. In this space, the calibration of the clonic device was carried out using a high-precision and high-cost calibration instrument. For this purpose, different assumptions and scenarios were defined, which are described in detail further in the next sections. Furthermore, this room is the space used to perform the CFD simulations. For obtaining the main results, the geometry was modeled in CATIA V5, and the different boundary conditions defined in ANSYS Discovery 2021 R2. These results allowed us to identify the best location of the programmable clonic device inside the room.

#### *2.1. CFD Analysis*

CFD is an area of engineering knowledge that belongs to the computer aided engineering (CAE) simulation programs. These analyses allow the numerical and visual simulation of flows, heat transfer, and even chemical reactions. These simulations and analyses are increasingly used to characterise living spaces, determining how the ventilation is operating and therefore the level of existing pollution. In short, CFD analysis helps to detect where the air is fouled. Thanks to this, preventive measures can be taken to avoid air quality risks [90]. These rises may be due to an increase in the number of people inside living spaces or a lack of ventilation in them [86,90]. In this study, CFD simulations helped to detect CO2 concentration.

For this research, two different software packages were used: ANSYS Fluent 2021 R2 and ANSYS Discovery 2021 R2 (available at www.ansys.com). ANSYS Fluent was used for static and dynamic simulations. In addition, ANSYS Discovery was used only for dynamic simulations. The main features that had to be selected are:


To begin with the analysis, the geometry and boundary conditions had to be previously defined to establish the convergence of the solution [86]. These boundary conditions were related to CO2 concentration and ventilation flow, helping to determine the location of the measurement instruments. The case study analyses the indoor atmosphere of a mediumsized room in a single-family house was simulated. In order to perform it, a series of conditions and restrictions had to be established:

• The building is located in Medina Sidonia, a village in the province of Cadiz (southern Spain). Its height above the sea is 337 m. In addition, its coordinates are as follows: longitude 5◦55 37.81 W and latitude 36◦27 25.02 N.


Four scenarios were defined for the CFD analysis. This made four situations possible: closed window and door (no ventilation), closed window but opened door (internal ventilation which is an indirect ventilation through other spaces that are also being renovated), opened window but closed door (external ventilation) and opened window and door (cross ventilation). In each of them, it was essential to guarantee the continuity of the simulation. For this purpose, an air inlet and outlet opening had to be established.


The boundary conditions refer to the mass flow of air and CO2 entering and exiting the room. For the analysis of the renewal of IAQ in the presence of a CO2 emission source, the geometry was created using DesignModeler, defining the inlets and outlets for each of the gases considered. A turbulent flow was modelled, specifically governed by the equations of the k-omega SST turbulence model. The physico-chemical characteristics of the gases involved were taken from the ANSYS database, activating the "Species" model. The composition of exhaled air is 78.6% N2, 1.8% H2O, 15.6% O2 and 4% CO2. Accordingly, the mass flux of CO2 emitted by a person breathing is small. For instance, the amount of air emitted by a person while performing activities at rest is approximately 0.0004 kg/s [91]. This emission was considered to be ideal and constant. Although a mesh with small elements would lead to a more precise solution, this increased the calculation time. This mesh was defined with small triangular elements which were between 0.05 and 0.1 m in size. In addition, the air inlet was considered to be the exterior window opened, and the

air outlet was considered to be the interior door opened. To determine the mass flow, the following Equations (1) and (2) were used:

$$V\_{\bar{i}} = L\_{\bar{i}} \times \mathcal{W}\_{\bar{i}} \times H\_{\bar{i}} \tag{1}$$

where:

*Vi* is the volume of the *scenarioi Li* is the length of the *scenarioi Wi* is the width of the *scenarioi Hi* is the heigth of the *scenarioi*

$$M\_f = D\_{\dot{a}\dot{r}} \times V\_f \tag{2}$$

where:

*Dair* is the density of the air at temperature of 25 ◦C *Mf* is the Mass flow *Vf* is the Volumetric flow

Applying the values from the case study:

$$V = 3.9 \times 2.4 \times 2.5 = 23.4 \text{ m}^3/\text{s}$$

$$D\_{air} \text{ (25 °C)} = 1.3 \text{ Kg/} \text{m}^3$$

In the first simulation, cross ventilation: A static analysis was performed in which the gas present in the indoor atmosphere was air. Similarly, for the inlet and outlet opened, the incoming and outgoing gas was also defined as air. For the inlet, the mass flow considered was 0.024 kg/s, which corresponds to three renewals per hour for the volumetric flow. The output of this simulation was defined by the "outflow", which allowed the law of conservation of mass to be satisfied: the entire mass flow of air entering through the window passes out the door. In addition, CO2 was injected, simulating the constant exhalation of a person in a resting state.

In the second simulation, outdoor ventilation: The renewal airflow was performed through the window opened (one sliding leaf), the door being closed. A static analysis was carried out in which the gas present in the indoor atmosphere was air. Similarly, through the inlet opened, the incoming gas was air. The mass flow rate considered corresponded to one point five hourly renewals for the volumetric flow, then the mass flow was 0.012 kg/s. In this case, a slit at the bottom of the door (its clearance) was defined as the exit. This allowed for continuity within the room. The output of this simulation was defined by the "outflow", which allowed the law of conservation of mass to be satisfied: all the mass flow of air entering through the window opened passes out the door slit. Analogous to the previous simulation, CO2 was injected, simulating the constant exhalation of a person in a resting state.

In the third simulation, indoor ventilation: The renewal air flow was performed through the door opened, the window being closed. A static analysis is carried out in which the gas present in the indoor atmosphere was air. Similarly, through the inlet opened, the incoming gas was air. The renewal air mass flow rate was 0.008 kg/s. In this case, a slit in the side window (its permeability) was defined as the exit. This allowed for continuity within the room. The output of this simulation was defined by the "outflow", which allowed the law of conservation of mass to be satisfied: all the mass flow of air entering through the door opened passes out the window slit. Analogous to previous simulations, CO2 was injected, simulating the constant exhalation of a person in a resting state.

#### *2.2. Professional Equipment*

To select the professional equipment to be considered as a reference standard, a series of characteristics related to its weight, dimensions, and price were required. To begin with, the equipment must be certified by a recognised accredited agency. In addition, they must include human and battery autonomy, which allows measurements to be taken over long periods of time (greater than 50 h). A probe with infrared sensor for CO2 measurement must be coupled. A wireless connection between the equipment and the probes available must be provided. The measurement modules must operate with different parameters and temperature ranges (from −20 ◦C to +80 ◦C). Finally, the professional equipment must measure in working environments with neutral gases. Among those available on the market, a KIMO HQ-210 was chosen. The equipment is supplied with a calibration certificate for the temperature, hygrometry, and CO2 concentration probes (code NEM1700592 SCOH 112).

#### *2.3. Low-Cost (Clonic) Device*

Main advantages and disadvantages of the commercial equipment were considered as a reference to select the main components of the clonic device. In this regard, two elements were fundamental to create it: a sensor to monitor the concentration of CO2 and an electronic motherboard that allows the processing of atmospheric data. In order to select the most suitable components, a series of criteria matrices were used to score the characteristics considered, which are detailed below.

Firstly, a CO2 sensor was chosen, for which its main characteristics evaluated were:


Four different sensors were considered: Amphenol Advanced Sensors Telaire T6713, Sensirion SCD30, DFRobot SEN0219, and Amphenol SGX Sensortech MiCS-VZ-89TE. The result of the criteria matrix is shown in Appendix A. After performing the criteria matrix (see Table A1), the most suitable sensor was the SEN0219. This is an analog sensor capable of monitoring CO2 in an exclusive way by using non-dispersive infrared (NDIR) principle to detect the existence of CO2 in the air. It features a long life, high resolution, accuracy and sensitivity, as well as a medium response speed. In addition, it is easy to install on any microcontroller and its price is relatively low (between EUR 30 and EUR 60).

Secondly, the selected motherboards included the Raspberry Pi Model B+ microcomputer and the Arduino MEGA 2560 R3 and ELEGOO MEGA 2560 R3 microcontrollers. Due to the similarities between the Arduino and ELEGOO microcontrollers, ELEGOO was considered because of its lower price. Their main factors evaluated were:


The result of the criteria matrix is shown in Appendix A. Although both boards were suitable and had the right features for mounting the programmable device (see Table A2), ELEGOO MEGA 2560 Rev3 had a more intuitive and user-friendly software interface. The C++-based programming language allows fast programming of the SEN0219 sensor, as it is designed for implementation on microcontrollers. Although Raspberry Pi has many advantages, this project could not make full use of them. Additionally, the programming language (mainly Python, which is one of the base programming languages of Raspberry

Pi) is complex and designed for expert programmers. After performing the criteria matrix (see Table A3), the most suitable motherboard was the ELEGOO MEGA 2560 Rev3.

#### *2.4. Programming and Calibration of the Device*

Once the motherboard and the sensor to be used were selected, they were assembled and programmed. The SEN0219 CO2 sensor could be easily connected to the ELEGOO MEGA 2560 R3 microcontroller (see Appendix B, Figure A1). The software and programming language used was Arduino. The prototype is shown in Figure 2.

**Figure 2.** Clonic device assembled with SEN0219 and ELEGOO MEGA 2560 R3.

Data captured by the sensor in the Arduino Serial Monitor were stored in a Microsoft Excel spreadsheet. For this purpose, additional programming code was carried out in the Visual Studio Code editor. This allowed the data stored to be analysed from time to time. This parameter was defined in the programming code depending on the monitoring needs. Once the system was ready, the next step consisted of the calibration of the zero point (which is based on the idea that if the sensor is placed into a 100% concentration of an alternate gas, the sensor reads absolute zero). This process was performed according to the datasheet of the manufacturer of the sensor, by shorting the circuit between the HD and GND pins for 7 s at least, but previously ensuring that the sensor was stable for more than 20 min at fresh air (400 ppm ambient environment). However, other alternative methods

could have been used such as exposing the sensor to a gas with a known CO2 concentration or to a gas with no CO2 present. After that, since it was intended as a low-cost device, it was not required to correct the input voltage and gain (offset voltage) unless anomalies were detected in the readouts. Finally, if measurements were not within the tolerance range, then an adjustment inside the calibration was required. This was done by linear regression.

The calibration line was included in the programming code (see Appendix C). It relates the CO2 concentration (in ppm) with the voltage values (in mV) captured by the sensor. Both parameters were related by two constants (C1 and C2 in Equation (3)), which were provided by the DataSheet of the analog sensor. These constants needed to be calculated in order to modify the regression line and achieve the adjustment within the calibration of the programmable device. The calibration line consisted of the following form:

$$\text{CO}\_{2i} = (\text{C}\_1 \times V\_i) - \text{C}\_2 \tag{3}$$

where:

CO2*<sup>i</sup>* is the concentration in ppm unit at "*i*" time. *Vi* is the voltage in mV unit at "*i*" time.

*C*<sup>1</sup> is the first constant in linear regression line.

*C*<sup>2</sup> is the second constant in linear regression line.

The regression line obtained allowed the calibration process of the clonic device to be carried out. An analytical process of data collection is explained below. To achieve this, the data from the device was compared with a calibrated highly accurate and costly measuring instrument. To be precise, the KIMO HQ-210 equipment from KIMO Electronic Pvt. Ltd. (Mumbai, India), was selected. It consists of two probes capable of monitoring CO2, temperature, and humidity. The error of this measuring instrument was reflected in the calibration certificate provided by the manufacturer. This error was also considered in the error of the clonic device calibration. Prototype calibration was also possible thanks to the collection of a lot of data from both the sensor device and the KIMO equipment. To obtain the calibration line, the voltage measured by the sensor was related to the exact and real concentration value provided by the reference standard. This line changed every time a new calibration was performed. To be accurate, three rounds of calibration were needed to achieve a maximum target error of less than 10%.

All the calibrations were performed in the same location during a 9 h measurement interval. This location was the same as the one considered in the CFD simulations. The SEN0219 sensor device and the KIMO equipment were placed side-by-side. Only the characteristics considered were changed for obtaining the minimum error for each calibration. Data collection by the sensor device and the KIMO equipment was carried out at regular intervals of 5 min (which provided 108 measurement points each). A shorter time between measurements was beneficial to obtain more data, helping to obtain a more accurate and successful calibration line. Additionally, this time could be linked to the resolution of the IAQ monitoring device. A longer time between data collection meant that changes in CO2 concentration were neglected.

Calibrations compare the experimental data from the KIMO equipment with the prototype estimates. To validate these comparisons, different error rates are used. This allows to observe how well the prototype device reproduces the behavior of the reference standard equipment. Several indices for validating models are reported in the literature, which can be classified according to their dependence on the scale of the compared signals. To begin with, errors that depend on the scale [92] such as the mean absolute error (MAE) used by [93] which measures the average magnitude of the error between the measured data by the equipment and the data estimated by the device, the mean error (ME) used by [94] which measures whether the device measures whether the device overestimates or underestimates the measured data, and the root mean square error (RMSE), used by [95] which weights the forecasts that are farthest away from the measured value by the equipment. Additional examples include the errors that do not depend on the scale [96] such

as the mean absolute percentage error (MAPE) used by [97] which measures the average percentage error of the estimates and the best fit index (FIT) used by [98] which compares the measured and estimated data with respect to the average of the measured data.

It can be noted that the coefficient of determination (R2) only measures the proportion of the variance in the dependent variable that is predictable from the independent one [99]. In addition, R2 is invariant for linear transformations of the distribution of the independent variables [100], so that an output value close to one does not always produce a good prediction regardless of the scale on which these variables are measured. In this context, indicators as MAPE are recommended when it is more important being sensitive to relative variations than to absolute variations [101]. However, although scale-independent errors are widely used in the literature, since they are used when comparing data with different scales, the weighting of the larger-scale error causes adjustments with larger deviation the higher the CO2 concentration to penalize against others. For instance, RMSE gives a relatively high weight to large errors since the errors are squared before they are averaged, so that it is useful when large errors are particularly undesirable [102].

#### 2.4.1. First Round of Calibration

This was the first contact with the sensor. The upward and downward trend of the concentration recorded by the sensor corresponded to those obtained by the KIMO equipment. Even so, there was a large error that must be resolved by calibration. Figure 3 shows the first calibration line. This error became larger in case of high CO2 concentrations. This is shown in Figure 4. However, after the adjustment, the error between the prototype device and the KIMO equipment decreased significantly, as shown in Table 3. Therefore, a further calibration had to be performed, taking into account these considerations:


**Figure 3.** Linear regression of the first round of calibration.

**Figure 4.** Measurements of the first calibration and adjustment.


**Table 3.** Statistical parameters related to the errors of the first calibration.

#### 2.4.2. Second Round of Calibration

Since the errors after the first calibration were greater than 10%, a second calibration was performed. Although with the adjustment the errors could be lowered, there was no guarantee that under other conditions this adjustment could be contradictory. With the adjustment after the first calibration, the second calibration was performed. In the subsequent data, there was still a significant difference between the values monitored by the two instruments. Figure 5 shows the second calibration line. This still resulted in an average error of more than 10%, as shown in Table 4. Despite this, progress was favourable (when adjusting) and the graphs began to look similar in low and medium CO2 concentration, as shown in Figure 6. In addition, several conclusions could be drawn from this calibration:


**Figure 5.** Linear regression of the second calibration.



**Figure 6.** Measurements of the second calibration and adjustment.

#### 2.4.3. Third Round of Calibration

All considerations from the two previous calibrations were made. With the adjustment after the second calibration, the third calibration was performed. The average error obtained was below 10% even before the adjustment, as shown in Table 5. Therefore, this calibration could already be considered suitable to start testing the different scenarios. Figure 7 shows the third regression line after calibration. As a result, the difference between the clonic device and the KIMO equipment was small, as shown in Figure 8. With this milestone, the calibration process was completed. However, to ensure that the clonic device measured constantly, regularly, and correctly, a preventive maintenance had to be scheduled. It is recommended to carry out calibrations every short period of time. This allows one to transform it into a predictive maintenance, since both absolute and relative error rates can be studied.

**Figure 7.** Regression line of the third calibration.

**Figure 8.** Measurements of the third calibration and adjustment.


**Table 5.** Statistical parameters related to the errors of the third calibration.

#### **3. Results and Discussion**

For presenting the results of the research and their discussion in an organised structure, the diagram presented in Figure 9 is followed. Then, the most relevant milestones involved in all phases of the research is summarised.

**Figure 9.** Research framework scheme.

#### *3.1. Phase 1: Perform CFD Simulations*

As indicated in the previous section, the study was performed in four scenarios. They were those corresponding to the same living space of 9.4 m2 with a unique occupant in soft sorting activities (minor than 6 MET), but in the following conditions:


The hygrometric comfort conditions were considered acceptable in all simulations, with temperature (T) ranging between 17 ◦C and 25 ◦C and relative humidity (RH) between 40% and 70%. The room faces southeast (taking the plane of the window as a reference). As the characteristic wind in this area comes from the east, ventilation with an open window was satisfactory. Figure 10 shows the working space employed in the research. The room was modelled with Ansys 2021 R2 version software.

**Figure 10.** Working space for the research.

The main parameters considered in the simulations was the mass flow of incoming and outgoing air through the different openings and the concentration (or mass flow) of CO2 from the metabolic exhalation of the occupant in the working space. Among four scenarios, cross-ventilation had the highest air renewal. This example could be extrapolated to public spaces that require a high air renewal rate to keep CO2 levels low. Therefore, the location of measurement points was based on this scenario, as it was the most unfavourable. In this scenario, static and transitional tests were performed. For this purpose, an inlet air mass flow rate of 0.008 kg/s for each hourly renewal considered, depending on the scenario, was defined. Figure 11 shows the zones in the space where vortices are formed. It must be noted that these points were not suitable for the placement of the CO2 sensors for IAQ control.

On the other hand, in the case of no-ventilation (Scenario 4), the same mass flow of air was considered and there was an increase of exhaled metabolic CO2. The permeability of the door and window allowed for pressure balancing through minimal air renewal, which was considered. Figure 12 shows the simulation of this scenario for a period of 9 h. As can be observed, as time progressed, the CO2 concentration in the working space became uniform, being higher in the areas close to the CO2 emitter.

To decide a good sensor location in each of the four scenarios, the parameters for the mass flow of air from the concentration of CO2 emitted by the people in the room measured and the ventilation were used. The amount of CO2 reflected in all simulations performed was 0.0004 kg/s. However, the mass flow of air from the ventilation varied according to the scenario considered. Among all of them, the highest mass air flow came from the highest air renewal (Scenario 1, cross ventilation) with three renewals per hour, corresponding to a volumetric flow rate of 20 L/s per person. By studying the behavior of the turbulent flow by CFD, the vortices in the room were observed. These points were not suitable for sensor placement. On the contrary, in Scenario 4 (no ventilation), there was no air flow that caused vortices and the CO2 concentration increased progressively, uniformly filling the volume tested. For this reason, the location of the sensors in Scenario 4 was the most demanding case for monitoring CO2.

**Figure 11.** Process for determining vortices with ANSYS Discovery 2021 R2 Student Version.

Figure 13 shows the three points selected among suitable ones for the CO2 concentration measurement. They were placed in positions that do not correspond to the vortices nor currents of air, avoiding distorting measurement points. The red colour shows areas with high renewal, so that placing the sensors in these areas would distort the average level in the space. Despite the statements of previous research (to the best of our knowledge) and current legislation [103,104] which establish that measurements should be taken at 1.2 metres above the ground, equivalent measurements can be taken at higher or lower points, as they are not modified either by renovations or by CO2 concentration in the most unfavourable scenarios. They are as follows:


**Figure 12.** CO2 concentration in a room with no-ventilation (closed window and closed door).

**Figure 13.** Location of three the points selected for the CO2 concentration measurement.

As Location 1 complies with current legislation for all kind of activities that can be undertaken in the living space, this is the one selected for the series of measurements.

#### *3.2. Phase 2: Study Low-Cost Elements for the Prototype*

In this research, high-precision and high-cost instruments were used. However, other research with CO2 measuring devices allowing CO2 concentrations to be monitored less expensive were also analysed. The cheapest cost of these clonic devices, according to the latest research by Villanueva et al. [77], was EUR 75. The clonic device proposed has an open programming language, which is available in Appendix C. In addition, its price is approximately EUR 60, which is 20% cheaper. Therefore, users and construction companies can include it as an element for the transformation of buildings into smart buildings.

Regarding the parametric considerations, the error of the prototype compared to equipment calibrated was in the range between 0 and 7.49%. This error was much lower for Scenario 1 and comparable to commercial equipment in Scenario 4, according to research by Villanueva et al. [77]. The connection between prototype and cloud allows the collection of data and its further management, which is not possible with static devices that only provide a point measurement of the CO2 concentration.

#### *3.3. Phase 3: Calibrate the Prototoype*

As detailed in the previous section, the calibration of the prototype was performed through iterations with regression lines. In successive calibrations, better and better fits were obtained. The last calibration determined that the error between the measurements obtained by the calibrated equipment (KIMO) and the prototype sensor device was less than the principal milestone of the project: less than 10%. Absolute indicators as RMSE as well as relative ones as MAPE could be used to check this. Therefore, after this process, a reliable prototype was obtained whose performance is comparable to other commercial or even clonic devices on the market such as those studied by Villanueva et al. [77].

#### *3.4. Phase 4: Evaluate the Scenarios and Determine the Measurement Error*

In this phase, a comparative analysis of the measurements made by the prototype device compared to those from the calibrated instrument was carried out. This statistical analysis of the data obtained was performed for each of the four scenarios. It consisted of capturing data every 5 min over a period of 6 h. The data obtained for the measurements in the four scenarios are shown graphically.

Figure 14 shows the data for Scenario 1 (cross-ventilation). It can be observed that the data corresponding to the measurement with the prototype coincided with those of the equipment calibrated. The minimum difference between the recopilated data (error) could be caused by cross-ventilation because the atmosphere was not completely steady. In addition, the CO2 concentration was observed to remain at healthy levels, close to the IAQ values that can be achieved in outdoor environments. The amount exhaled by the occupant of the space had hardly any effect on the total concentration when the ventilation was cross-ventilation.

**Figure 14.** Data for Scenario 1.

Figure 15 shows the data for Scenario 2 (outdoor-ventilation). The data from the measurement with the prototype matched those of the equipment calibrated. The CO2 concentration was close to health thresholds in a small range, as the window being open, the airflow renewed the amount of clean air, keeping the scene in a healthy condition for the occupant.

**Figure 15.** Data for Scenario 2.

Figure 16 shows the data for Scenario 3 (indoor-ventilation). The data from the measurement with the prototype match those of the equipment calibrated. Air renewal depends on the interior connection between the room and the rest of the building. Except for occasional measurements, the IAQ is considered to be adequate. In this case, in order to have more information, it would be necessary to perform the study of the entire building (including all the points where there could be air renewal).

**Figure 16.** Data for Scenario 3.

Figure 17 shows the data for Scenario 4 (no-ventilation). The data from the measurement with the prototype matched those of the equipment calibrated. It can be observed how the amount of CO2 increased to levels considered unhealthy. After approximately 50 min, concentrations close to 1000 ppm of CO2 were obtained.

The instantaneous error of each measurement corresponded to the difference between the measurement obtained by the low-cost clonic device and the commercial instrument calibrated (KIMO). This measurement already incorporated the corrected measurement uncertainty of the KIMO instrument. Details of all measurements are included in the Supplementary Materials.

Simultaneous measurements were obtained with both the low-cost clonic device and the instrument calibrated (KIMO), which was employed as a reference standard. As stated before, these device measurements already included both the correction and the measurement uncertainty of the KIMO instrument. The values of the mean, minimum, maximum, and standard deviation values were studied. Table 6 shows these values:


**Table 6.** Comparative study of the sample with KIMO and prototype measurements.

Note: The unit of measurement for CO2 concentrations is ppm.

**Figure 17.** Data for Scenario 4.

As explained before, an average outdoor concentration of 400 ppm was assumed, according to the technical report "CEN/TR 16798-2". Then, normality (with the Kolmogorov– Smirnov test) and homoscedasticity (with the Fisher F-test) was probed. Table 7 shows the values of the statistics for each of the scenarios.

**Table 7.** Normality and homoscedasticity proofs between KIMO and prototype (*p*-value).


Then, an equivalence test (the two-one sided test (TOST test)) was used to determine whether the means for both equipment measurements were close enough to be considered equivalent. Finally, the concordance between both samples was checked with the Bland-Altman plot, identifying any systematic difference between the measurements (as fixed bias) or possible outliers. Table 8 shows the values of the statistics for each of the scenarios.

**Table 8.** Equivalence and concordance proofs between KIMO and prototype (*p*-value).


All the statistical indices shown in Tables 7 and 8 as well as in Figure 18, indicate that there was normality and homoscedasticity between the values obtained by the prototype sensor device and the reference standard equipment. In addition, equivalence and concordance were also satisfactorily tested. Finally, the instantaneous error, which is the difference between the measurement of the low-cost prototype sensor device and the KIMO equipment, was calculated. This calculation was made for the 72 measurements taken every 5 min. The mean value was also considered. This study helped to determine the percentage error in each of the scenarios. Data are shown in Table 9.

**Table 9.** Comparative study of the error with KIMO equipment vs. prototype device.


As can be observed, the comparative measurement error in all scenarios was less than 8%. If the experiment was performed in a case whose ventilation is maximum (cross-ventilation is 1 m/s), the values obtained were similar to the results of the study by Villanueva et al. [77] for other clonic devices.

**Figure 18.** Bland and Altman analysis of different scenarios.

#### *3.5. Phase 5: Integrate into a Smart Building*

Smart building infrastructures aim to maximise building efficiency in different fields of application. Specifically, this research focused on the assessment of IAQ to maintain a safe atmosphere for building occupants. However, given that the main issue at present day is the transmission of the COVID-19 disease, the parameter related to CO2 concentration was used as a reference. For this purpose, a low-cost device was designed to transfer the captured data to the cloud. In this way, it is possible to retrieve the information for decision making or integration with other systems, such as those in charge of ventilation and air conditioning (HVAC) or even other systems for automatic opening and closing of elements for natural air renewal.

The other issue that has been addressed is the definition of a location for this equipment that allows it to be properly measured. In this regard, CFD studies have shown that, although the general recommendation of up to 1.2 m above the floor is correct, there are many more points where reliable data on CO2 concentration averages can be obtained. In

addition, vortices were determined and excluded from the potential location of the device, as its measurements would be distorted from the actual average. A functional scheme of the investigation is presented graphically in Figure 19. Integration with other systems in smart building was not addressed within the scope of this research, although this would allow better monitoring and control of these systems, promoting efficient energy use and helping to control indoor quality for disease prevention.

**Figure 19.** Communication scheme between devices and systems in a smart building.

#### **4. Conclusions**

In the COVID-19 era, CO2 concentration is the most important indicator related to IAQ to measure the degree of air pollution. This research addressed how to monitor and control CO2 concentration in order to implement a clonic device to help prevent disease transmission. From commercial components (sensor and motherboard), a lowcost device to measure the concentration of the pollutant CO2 was designed, developed, assembled, openly programmed, prototyped, and calibrated. The statistical analysis of normality, homoscedasticity, equivalence, and concordance performed determined that the measurements made by the equipment certified (KIMO) used as reference standard and the low-cost clonic device were equivalent, with a maximum error of less than 8% and an average of less than 3%. Therefore, these devices can be used to monitor IAQ by measuring CO2 concentration.

To the best of our knowledge, they can do so at a lower price than other similar devices proposed by previous research, and much lower than those offered by existing commercial equipment on the market. In addition, it is worth noting that the open-source programming included is easily replicable by other researchers or even end users. This eliminates the economic barriers derived from the high prices of calibrated instruments and equipment that prevent their widespread use, as well as the technical barriers derived from the programming.

On the other hand, a CFD study was carried out to choose the most suitable locations for data collection, identifying and discarding locations that may provide nonrepresentative and unreliable measurements due to the existence of vortices in the air flows, depending on the ventilation scenarios proposed (cross, outdoor, indoor-indirect). The study enabled the selection of a series of points that respond to the needs of CO2 monitoring and control which go beyond those established in the legislation or those collected in previous research, as far as we are aware. Therefore, a methodology was proposed that

helps to select the CO2 control points according to the existing conditions in the indoor spaces under study.

The data collected wirelessly for interpretation could be evaluated on an Internet of Things (IoT) platform, in real time or deferred. As a result, IAQ could be controlled, interfacing IAQ devices with other systems (such as HVAC). The integration of this type of low-cost clonic devices into existing buildings allows regulation of ventilation, balancing safety through air renewal with comfort and energy efficiency. This ensures adequate sanitary conditions for the occupants while also favoring the optimization of energy resources. In this way, a smarter building was achieved, adding value to its refurbishment and modernization.

Future lines of research should focus on cataloging and parameterizing the location and distribution of the devices according to the behavior of indoor air in other scenarios and measuring the influence of this control on the comfort and energy sustainability of the building, since ventilation, as a means of natural air renewal, can exert a negative influence on energy efficiency when spaces are conditioned. Finally, to facilitate the replicability and comparability of this research, data analysis organised by spreadsheets is included as Supplementary Materials.

**Supplementary Materials:** The following are available online at https://www.mdpi.com/article/10 .3390/app12083927/s1. Process of Calibration, Scenario 1: Cross-ventilation, Scenario 2: Outdoorventilation, Scenario 3: Indoor-ventilation, Scenario 4: No-ventilation.

**Author Contributions:** Conceptualization, A.P.-F. and A.C.-N.; methodology, A.P.-F., P.M.-G. and A.C.-N.; software, P.M.-G.; validation, A.P.-F., P.M.-G. and P.B.-P.; formal analysis, A.P.-F. and A.C.-N.; investigation, A.P.-F., A.C.-N. and M.O.-M.; resources, M.O.-M. and P.M.-G.; data curation, M.O.-M. and P.M.-G.; writing—original draft preparation, A.P.-F. and P.M.-G.; writing—review and editing, A.C.-N. and P.B.-P.; visualization, M.O.-M. and P.M.-G.; supervision, A.P.-F., A.C.-N. and P.B.-P.; project administration, A.P.-F. and A.C.-N.; funding acquisition, A.P.-F., A.C.-N. and M.O.-M. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** All the data are included in the article (main text or Appendices A–C) or in Supplementary Materials.

**Acknowledgments:** All authors acknowledge the help received by the research group TEP-955 from the PAIDI, the ERGOMET Project of the Program for the Promotion of Research Activity of the UCA, the Project "Design of a low-cost non-invasive ergonomic capture system for the analysis of musculoskeletal disorders" of the Program for the Promotion of Research and Transfer of the UCA and the National Plan Research Project PID2019-108669RB-100/AEI/10.13039/501100011033.

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **Appendix A. Criteria Matrices for Components Selection**

*Appendix A.1. Sensor Selection*

The factors considered for the choice of the sensor that suits the needs of the research are (which are weighted according to a scale from 0 (lowest score) to 2 (best score)):


The results are shown in Table A1:

**Table A1.** Criteria matrix for sensor selection.


#### *Appendix A.2. Motherboard Selection*

The compilation of the different characteristics extracted, which are of interest for the elaboration of the corresponding criteria matrix, are shown in Table A2:


**Table A2.** Criteria matrix for sensor selection.

The factors considered for the choice of the motherboard encompass its main characteristics (mentioned above). In addition, factors related to the functionality and intended uses of the programmable device have also been added (the importance is weighted with values from 0 to 2, the latter being the best score depending on the factor considered):


The results are shown in Table A3:

**Table A3.** Criteria matrix for sensor selection.


#### **Appendix B. Sensor Connection**

ELEGOO Mega 2560 R3 motherboard is an open source ATMega2560-ATMEGA16U2 microcontroller board with 54 digital input and output pins, 16 analogue inputs, USB connection, RESET button and external power input. When purchasing the ELEGOO MEGA board, the USB cable for connection via serial port with the computer where the sensor programming is to be carried out is included.

As the SEN0219 sensor is analogue, one of the analogue inputs of the board must be used. Specifically, the analogue input A0 is selected. This input could be any other input as long as it is reflected in the programming code (from A1 to A7). In the same vein, the ground (GND) and voltage pins are essential to receive data from the sensor. The SEN0219 sensor works with a voltage between 4.5 and 5.5 V, so the connection will be made to the 5 V (Power) connection pin on the motherboard.

**Figure A1.** Wiring diagram between SEN0219 sensor and ELEGOO MEGA.

#### **Appendix C. Programming Code in Arduino Software and Visual Studio Code**

```
Appendix C.1. Arduino Base Code
```

```
int sensorIn = A0;
void setup(){
  Serial.begin(115200);
  analogReference(DEFAULT);
}
void loop(){
  //Lectura de la tensión
  int sensorValue = analogRead(sensorIn);
  // La señal analogica es convertida a tension
  float voltage = sensorValue*(5000/1024.0);
  if(voltage == 0)
  {
    Serial.println("Fault");
  }
  else if(voltage < 400)
  {
    Serial.println("preheating");
  }
  else
  {
    //Recta de regresion lineal utilizada para la calibracion del sensor
    float p_cero = 2.9713;
    float p_uno = −1150.3;
    float concentration=voltage*p_cero+p_uno;
    Serial.print(voltage);
    Serial.print(",");
    Serial.print(concentration);
    Serial.println(";");
  }
```

```
delay(1000);
     }
Appendix C.2. Visual Studio Code–Python Programming to Create Data Storage
     import serial
     import xlwt
     from datetime import datetime
     class SerialToExcel:
         def __init__(self,port,speed):
              self.port = port
              self.speed = speed
              self.wb = xlwt.Workbook()
              self.ws = self.wb.add_sheet("Data from Serial",cell_overwrite_ok = True)
              self.ws.write(0, 0, "Data from Serial")
              self.columns = ["Date Time"]
              self.number = 100
         def setColumns(self,col):
              self.columns.extend(col)
         def setRecordsNumber(self,number):
              self.number = number
         def readPort(self):
              ser = serial.Serial(self.port, self.speed, timeout = 1)
              c=0
              for col in self.columns:
                   self.ws.write(1, c, col)
                   c=c+1
              self.fila = 2
              i=0
              while(i < self.number):
                   line = str(ser.readline())
                   if(len(line) > 0):
                       now = datetime.now()
                       date_time = now.strftime("%m/%d/%Y, %H:%M:%S")
                       print(date_time,line)
                       if(line.find(",")):
                            c=1
                            self.ws.write(self.fila, 0, date_time)
                            columnas = line.split(",")
                            for col in columnas:
                                 self.ws.write(self.fila, c, col)
                                 c=c+1
                       i=i+1
                       self.fila = self.fila + 1
         def writeFile(self,archivo):
              self.wb.save(archivo)
```
*Appendix C.3. Visual Studio Code—Data Storage*

Define where the data search is performed (Arduino Serial Monitor), number of data to be collected, name of parameters collected according to Arduino programming and time between data storage. from serialToExcel import SerialToExcel serialToExcel = SerialToExcel("COM3",115200)

```
columnas = ["voltage","concentration"]
serialToExcel.setColumns(["voltage","concentration"])
```
serialToExcel.setRecordsNumber(1800) serialToExcel.readPort() serialToExcel.writeFile("archivo2.xls")

#### **References**

