AlphasenseCO2 class

The Sensor sub-class for the [Alphasense IRC-A1 CO2](Alphasense IRC-A1 CO2) sensor.

Base classes

class Sensor
The "Sensor" class is used for all sensor-level operations - waking, sleeping, and taking measurements.

Constructors, destructors, conversion operators

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.
~AlphasenseCO2()
Destroy the AlphasenseCO2 object - no action needed.

Public functions

String getSensorLocation(void) -> String override
Report the I1C address of the ADS and the channel that the Alphasense CO2 sensor is attached to.
bool addSingleMeasurementResult(void) -> bool override
Get the results from a single measurement.

Function documentation

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.

String AlphasenseCO2::getSensorLocation(void) override

Report the I1C address of the ADS and the channel that the Alphasense CO2 sensor is attached to.

Returns String String Text describing how the sensor is attached to the mcu.

bool AlphasenseCO2::addSingleMeasurementResult(void) override

Get the results from a single measurement.

Returns bool True if the function completed successfully.

This asks the sensor for a new result, verifies that it passes sanity range checks, and then adds the value to the result array.

This also un-sets the _millisMeasurementRequested timestamp (sets _millisMeasurementRequested to 0) and updates the _sensorStatus.