ApogeeSQ212 class

The Sensor sub-class for the Apogee SQ-212 sensor.

Base classes

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

Constructors, destructors, conversion operators

ApogeeSQ212(int8_t powerPin, uint8_t adsChannel, uint8_t i2cAddress = 0x48, uint8_t measurementsToAverage = 1)
Construct a new Apogee SQ-212 object - need the power pin and the data channel on the ADS1x15.
~ApogeeSQ212()
Destroy the ApogeeSQ212 object - no action needed.

Public functions

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

Function documentation

ApogeeSQ212::ApogeeSQ212(int8_t powerPin, uint8_t adsChannel, uint8_t i2cAddress = 0x48, uint8_t measurementsToAverage = 1)

Construct a new Apogee SQ-212 object - need the power pin and the data channel on the ADS1x15.

Parameters
powerPin

The pin on the mcu controlling power to the Apogee SQ-212. Use -1 if it is continuously powered.

  • The SQ-212 requires 3.3 to 24 V DC; current draw 10 µA
  • The ADS1115 requires 2.0-5.5V but is assumed to be powered at 3.3V
adsChannel The analog data channel the Apogee SQ-212 is connected to on the TI ADS1115 (0-3).
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 1.

String ApogeeSQ212::getSensorLocation(void) override

Report the I1C address of the ADS and the channel that the SQ-212 is attached to.

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

bool ApogeeSQ212::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.