# D105: Connecting a CO2 sensor

### Carbon dioxide sensor

The universal device smart-MAC D105 can be connected to a sensor for measuring the level of carbon dioxide CO2, in common people "carbon dioxide". The measuring range for CO2 is 0-5000ppm (the number of CO2 particles per million air particles).

Wiring diagram:

Option 1.

• pin 21 connect the white wire of the sensor to terminal 5: ADC
• pin 22 connect the black wire of the sensor to terminal 1: GND (Ground or -5V)
• pin 23 connect the red wire of the sensor to terminal 6: + 5V

Connection diagram of the CO2 sensor to the smart-MAC D105.

Option 2.

• pin 1 connect the white wire of the sensor to terminal 6: +5В
• pin 3 connect the black wire of the sensor to terminal 1: GND
• pin 5 connect the white wire of the sensor to terminal 5: ADC

#### Dashboard and widget settings

Add a widget indicator, chart or table to the board.

The CO2 sensor has an analog output at which the voltage varies between 0.4 - 2V for a CO2 level of 0-5000ppm.

Accordingly, the voltage at the output of the sensor varies within 1.6V, and 125 accounts for 3125 ppm.

In the "Arithmetic operation" section, select the function f (x) and write down the function for calculating the CO2 level in the units of measure you need:

ppm f(x):

`d.ADC > 0.4 ? (d.ADC-0.4)*3125 : '--'`

% f(x):

`d.ADC > 0.4 ? (d.ADC-0.4)*3125/10000 : '--'`

#### Set up notifications on the device and control the built-in relay.

To set up notifications on the D105 device and automatically control the built-in relay by CO2 level, you need to determine the formula for calculating the voltage at the analog input at the corresponding CO2 level.

`Vout = ( ppm + 1250 ) / 3125`

Where:
pm - CO2 level at which an alert should come or a relay trip;