Alphasense IRC-A1 CO2 topic

Classes for the Alphasense IRC-A1 Nondispersive Infrared (NDIR) Carbon Dioxide (CO2) sensor.

Introduction

The Alphasense IRC-A1 Nondispersive Infrared (NDIR) Carbon Dioxide (CO2) sensor The CO2 sensor requires a 2-5 V DC power source with a current draw of 20 to 60 mA. The power supply to the sensor can be stopped between measurements.

To convert the sensor's analog 4-20 mA signal to a high resolution digital signal, the sensor must be attached to an analog-to-digital converter with an resistor in series. Furthermore, https://www.alphasense.com/products/ndir-safety/ https://www.alphasense.com/wp-content/uploads/2018/04/IRC-A1.pdf https://www.alphasense.com/wp-content/uploads/2017/09/NDIR-Transmitter.pdf https://www.alphasense.com/wp-content/uploads/2022/10/AAN_202-04_App-Note_V0.pdf https://www.alphasense.com/wp-content/uploads/2022/10/AAN_201-06_App-Note_V0.pdf

See the ADS1115 for details on the ADC conversion.

Sensor Datasheet

Datasheet

Build flags

  • -D MS_USE_ADS1015
    • switches from the 16-bit ADS1115 to the 12 bit ADS1015
  • -D ALPHASENSE_CO2_CALIBRATION_FACTOR=x
    • Changes the calibration factor from 1 to x

Sensor Constructor

AlphasenseCO2::AlphasenseCO2(int8_t powerPin, aco2_adsDiffMux_t adsDiffMux = DIFF_MUX_2_3, uint8_t i2cAddress = 0x48, uint8_t measurementsToAverage = 7)

Construct a new Alphasense IRC-A1 CO2 object - need the power pin and the on the ADS1x15. Designed to read differential voltage between ads channels 2 and 3.

Parameters
powerPin

The pin on the mcu controlling power to the Alphasense CO2 sensor. Use -1 if it is continuously powered.

  • The Alphasense CO2 sensor requires 2-5 V DC; current draw 20-60 mA
  • The ADS1115 requires 2.0-5.5V but is assumed to be powered at 3.3V
adsDiffMux Which two pins on the TI ADS1115 that will measure differential voltage. See aco2_adsDiffMux_t.
i2cAddress The I2C address of the ADS 1x15, default is 0x48 (ADDR = GND)
measurementsToAverage The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 7 [seconds], which is one period of the cycle.


Example Code

The Alphasense CO2 sensor is used in the menu a la carte example.

1#include <sensors/AlphasenseCO2.h>
2
3// NOTE: Use -1 for any pins that don't apply or aren't being used.
4const int8_t AlphasenseCO2Power = sensorPowerPin; // Power pin
5aco2_adsDiffMux_t AlphasenseDiffMux = DIFF_MUX_2_3; // Differential voltage config
6const uint8_t AlphasenseCO2ADSi2c_addr =
7 0x48; // The I2C address of the ADS1115 ADC
8
9// Create an Alphasense CO2 sensor object
10AlphasenseCO2 alphasenseCO2(AlphasenseCO2Power, AlphasenseDiffMux,AlphasenseCO2ADSi2c_addr);
11
12// Create PAR and raw voltage variable pointers for the CO2
13Variable* asCO2 = new AlphasenseCO2_CO2(&alphasenseCO2,
14 "12345678-abcd-1234-ef00-1234567890ab");
15Variable* asco2voltage = new AlphasenseCO2_Voltage(
16 &alphasenseCO2, "12345678-abcd-1234-ef00-1234567890ab");

Classes

class AlphasenseCO2
The Sensor sub-class for the [Alphasense IRC-A1 CO2](Alphasense IRC-A1 CO2) sensor.
class AlphasenseCO2_CO2
The Variable sub-class used for the carbon dioxide (CO2) output from an Alphasense IRC-A1 CO2.
class AlphasenseCO2_Voltage
The Variable sub-class used for the raw voltage output from an Alphasense IRC-A1 CO2.

Configuration Defines

Defines to set the calibration of the Alphasense CO2 sensor and the address of the ADD.

enum aco2_adsDiffMux_t: uint16_t { DIFF_MUX_0_1, DIFF_MUX_0_3, DIFF_MUX_1_3, DIFF_MUX_2_3 }
Enum for the pins used for differential voltages.
#define ALPHASENSE_CO2_CALIBRATION_FACTOR = 1
The calibration factor between output in volts and CO2 (microeinsteinPerSquareMeterPerSecond) 1 µmol mˉ² sˉ¹ per mV (reciprocal of sensitivity)
#define ADS1115_ADDRESS = 0x48
The assumed address of the ADS1115, 1001 000 (ADDR = GND)

Sensor Variable Counts

The number of variables that can be returned by the Apogee SQ-212

#define ALPHASENSE_CO2_NUM_VARIABLES = 2
Sensor::_numReturnedValues; the Alphasense CO2 sensor can report 2 values, raw voltage and calculated CO2.
#define ALPHASENSE_CO2_INC_CALC_VARIABLES = 1
Sensor::_incCalcValues; CO2 is calculated from the raw voltage.

Sensor Timing

The sensor timing for an Alphasense IRC-A1 CO2

#define ALPHASENSE_CO2_WARM_UP_TIME_MS = 200
Sensor::_warmUpTime_ms; The TI ADS1x15 to warm up time is 2 ms, and we get Alphasense CO2 sensor readings in <200 ms second.
#define ALPHASENSE_CO2_STABILIZATION_TIME_MS = 35000
Sensor::_stabilizationTime_ms; The manufacturer provides the following stablization times:
#define ALPHASENSE_CO2_MEASUREMENT_TIME_MS = 1000
Sensor::_measurementTime_ms; The Alphasense IRC-A1 CO2 sensor will return a new number every 200 ms, but there appears to be a cyclic response with a ~7 sec period, so we recommend averaging 1 s measurements over 28 seconds (3 periods)

CO2 Concentration

The CO2 variable from an Alphasense IRC-A1 CO2

  • Accuracy is ± 1FS or ± 50 ppm (for IAQ type)
  • Range is 0 − 5000 ppm (for IAQ type)
  • Resolution: < 1 ppm
    • 16-bit ADC (ADS1115): < 1 ppm (5 significant figures)
    • 12-bit ADC (ADS1015): worse

{{ AlphasenseCO2_CO2 }}

#define ALPHASENSE_CO2_VAR_NUM = 0
Variable number; CO2 is stored in sensorValues[0].
#define ALPHASENSE_CO2_VAR_NAME = "carbonDioxide"
Variable name in ODM2 controlled vocabulary; "carbonDioxide".
#define ALPHASENSE_CO2_UNIT_NAME = "partPerMillion"
Variable unit name in ODM2 controlled vocabulary; "partPerMillion" (ppm)
#define ALPHASENSE_CO2_DEFAULT_CODE = "AlphasenseCO2ppm"
Default variable short code; "AlphasenseCO2ppm".
#define ALPHASENSE_CO2_RESOLUTION = 4
Decimals places in string representation; CO2 should have 4 when using an ADS1115.

Voltage

The voltage variable from an Alphasense IRC-A1 CO2

  • Range is 0 to 3.6V [when ADC is powered at 3.3V]
  • Accuracy is ± 0.5%
    • 16-bit ADC (ADS1115): < 0.25% (gain error), <0.25 LSB (offset error)
    • 12-bit ADC (ADS1015, using build flag MS_USE_ADS1015): < 0.15% (gain error), <3 LSB (offset error)
  • Resolution [assuming the ADC is powered at 3.3V with inbuilt gain set to 1 (0-4.096V)]:
    • 16-bit ADC (ADS1115): 0.125 mV (ADS1115)
    • 12-bit ADC (ADS1015, using build flag MS_USE_ADS1015): 2 mV (ADS1015)

{{ AlphasenseCO2_Voltage }}

#define ALPHASENSE_CO2_VOLTAGE_VAR_NUM = 1
Variable number; voltage is stored in sensorValues[1].
#define ALPHASENSE_CO2_VOLTAGE_VAR_NAME = "voltage"
Variable name in ODM2 controlled vocabulary; "voltage".
#define ALPHASENSE_CO2_VOLTAGE_UNIT_NAME = "volt"
Variable unit name in ODM2 controlled vocabulary; "volt" (V)
#define ALPHASENSE_CO2_VOLTAGE_DEFAULT_CODE = "AlphasenseCO2Voltage"
Default variable short code; "AlphasenseCO2Voltage".
#define ALPHASENSE_CO2_VOLTAGE_RESOLUTION = 4
Decimals places in string representation; voltage should have 4 when used with an ADS1115.

Enum documentation

enum aco2_adsDiffMux_t: uint16_t

Enum for the pins used for differential voltages.

Enumerators
DIFF_MUX_0_1

differential across pins 0 and 1

DIFF_MUX_0_3

differential across pins 0 and 3

DIFF_MUX_1_3

differential across pins 1 and 3

DIFF_MUX_2_3

differential across pins 2 and 3


Define documentation

#define ALPHASENSE_CO2_CALIBRATION_FACTOR = 1

The calibration factor between output in volts and CO2 (microeinsteinPerSquareMeterPerSecond) 1 µmol mˉ² sˉ¹ per mV (reciprocal of sensitivity)


#define ADS1115_ADDRESS = 0x48

The assumed address of the ADS1115, 1001 000 (ADDR = GND)


#define ALPHASENSE_CO2_NUM_VARIABLES = 2

Sensor::_numReturnedValues; the Alphasense CO2 sensor can report 2 values, raw voltage and calculated CO2.


#define ALPHASENSE_CO2_INC_CALC_VARIABLES = 1

Sensor::_incCalcValues; CO2 is calculated from the raw voltage.


#define ALPHASENSE_CO2_WARM_UP_TIME_MS = 200

Sensor::_warmUpTime_ms; The TI ADS1x15 to warm up time is 2 ms, and we get Alphasense CO2 sensor readings in <200 ms second.


#define ALPHASENSE_CO2_STABILIZATION_TIME_MS = 35000

Sensor::_stabilizationTime_ms; The manufacturer provides the following stablization times:


#define ALPHASENSE_CO2_MEASUREMENT_TIME_MS = 1000

Sensor::_measurementTime_ms; The Alphasense IRC-A1 CO2 sensor will return a new number every 200 ms, but there appears to be a cyclic response with a ~7 sec period, so we recommend averaging 1 s measurements over 28 seconds (3 periods)


#define ALPHASENSE_CO2_VAR_NUM = 0

Variable number; CO2 is stored in sensorValues[0].


#define ALPHASENSE_CO2_VAR_NAME = "carbonDioxide"

Variable name in ODM2 controlled vocabulary; "carbonDioxide".


#define ALPHASENSE_CO2_UNIT_NAME = "partPerMillion"

Variable unit name in ODM2 controlled vocabulary; "partPerMillion" (ppm)


#define ALPHASENSE_CO2_DEFAULT_CODE = "AlphasenseCO2ppm"

Default variable short code; "AlphasenseCO2ppm".


#define ALPHASENSE_CO2_RESOLUTION = 4

Decimals places in string representation; CO2 should have 4 when using an ADS1115.


#define ALPHASENSE_CO2_VOLTAGE_VAR_NUM = 1

Variable number; voltage is stored in sensorValues[1].


#define ALPHASENSE_CO2_VOLTAGE_DEFAULT_CODE = "AlphasenseCO2Voltage"

Default variable short code; "AlphasenseCO2Voltage".


#define ALPHASENSE_CO2_VOLTAGE_RESOLUTION = 4

Decimals places in string representation; voltage should have 4 when used with an ADS1115.