Apogee SQ-212 topic

Classes for the Apogee SQ-212 quantum light sensor.

Introduction

The Apogee SQ-212 quantum light sensor measures photosynthetically active radiation (PAR) - typically defined as total radiation across a range of 400 to 700 nm. PAR is often expressed as photosynthetic photon flux density (PPFD): photon flux in units of micromoles per square meter per second (μmol m-2 s-1, equal to microEinsteins per square meter per second) summed from 400 to 700 nm. The raw output from the sensor is a simple analog signal which must be converted to a digital signal and then multiplied by a calibration factor to get the final PAR value. The PAR sensor requires a 5-24 V DC power source with a nominal current draw of 300 μA. The power supply to the sensor can be stopped between measurements.

To convert the sensor's analog signal to a high resolution digital signal, the sensor must be attached to an analog-to-digital converter. See the ADS1115 for details on the conversion.

The calibration factor this library uses to convert from raw voltage to PAR is that specified by Apogee for the SQ-212: 1 µmol mˉ² sˉ¹ per mV (reciprocal of sensitivity). If needed, this calibration factor can be modified by compiling with the build flag -D SQ212_CALIBRATION_FACTOR=x where x is the calibration factor. This allows you to adjust the calibration or change to another Apogee sensor (e.g. SQ-215 or SQ225) as needed.

Sensor Datasheet

Datasheet

Build flags

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

Sensor Constructor

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.


Example Code

The SQ-212 is used in the menu a la carte example.

1#include <sensors/ApogeeSQ212.h>
2
3// NOTE: Use -1 for any pins that don't apply or aren't being used.
4const int8_t SQ212Power = sensorPowerPin; // Power pin
5const int8_t SQ212ADSChannel = 3; // The ADS channel for the SQ212
6const uint8_t SQ212ADSi2c_addr = 0x48; // The I2C address of the ADS1115 ADC
7
8// Create an Apogee SQ212 sensor object
9ApogeeSQ212 SQ212(SQ212Power, SQ212ADSChannel, SQ212ADSi2c_addr);
10
11// Create PAR and raw voltage variable pointers for the SQ212
12Variable* sq212PAR =
13 new ApogeeSQ212_PAR(&SQ212, "12345678-abcd-1234-ef00-1234567890ab");
14Variable* sq212voltage =
15 new ApogeeSQ212_Voltage(&SQ212, "12345678-abcd-1234-ef00-1234567890ab");

Classes

class ApogeeSQ212
The Sensor sub-class for the Apogee SQ-212 sensor.
class ApogeeSQ212_PAR
The Variable sub-class used for the photosynthetically active radiation (PAR) output from an Apogee SQ-212.
class ApogeeSQ212_Voltage
The Variable sub-class used for the raw voltage output from an Apogee SQ-212.

Sensor Variable Counts

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

#define SQ212_NUM_VARIABLES = 2
Sensor::_numReturnedValues; the SQ212 can report 2 values, raw voltage and calculated PAR.
#define SQ212_INC_CALC_VARIABLES = 1
Sensor::_incCalcValues; PAR is calculated from the raw voltage.

Configuration Defines

Defines to set the calibration of the SQ-212 and the address of the ADD.

#define SQ212_CALIBRATION_FACTOR = 1
The calibration factor between output in volts and PAR (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 Timing

The sensor timing for an Apogee SQ-212

#define SQ212_WARM_UP_TIME_MS = 2
Sensor::_warmUpTime_ms; the warm up time is unknown; using the 2ms for the TI ADS1x15 to warm up.
#define SQ212_STABILIZATION_TIME_MS = 2
Sensor::_stabilizationTime_ms; the ADS1115 is stable after 2ms.
#define SQ212_MEASUREMENT_TIME_MS = 2
Sensor::_measurementTime_ms; ADS1115 takes almost 2ms to complete a measurement (860/sec).

PAR

The PAR variable from an Apogee SQ-212

  • Range is 0 to 2500 µmol m-2 s-1
  • Accuracy is ± 0.5%
  • Resolution:
    • 16-bit ADC (ADS1115): 0.3125 µmol m-2 s-1 (ADS1115)
    • 12-bit ADC (ADS1015, using build flag MS_USE_ADS1015): 5 µmol m-2 s-1 (ADS1015)
  • Reported as microeinsteins per square meter per second (µE m-2 s-1 or µmol m-2 s-1)

{{ ApogeeSQ212_PAR }}

#define SQ212_PAR_RESOLUTION = 4
Decimals places in string representation; PAR should have 4 when using an ADS1115.
#define SQ212_PAR_VAR_NUM = 0
Variable number; PAR is stored in sensorValues[0].
#define SQ212_PAR_VAR_NAME = "radiationIncomingPAR"
Variable name in ODM2 controlled vocabulary; "radiationIncomingPAR".
#define SQ212_PAR_UNIT_NAME = "microeinsteinPerSquareMeterPerSecond"
Variable unit name in ODM2 controlled vocabulary; "microeinsteinPerSquareMeterPerSecond" (µE m-2 s-1 or µmol * m-2 s-1)
#define SQ212_PAR_DEFAULT_CODE = "photosyntheticallyActiveRadiation"
Default variable short code; "photosyntheticallyActiveRadiation".

Voltage

The voltage variable from an Apogee SQ-212

  • 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)

{{ ApogeeSQ212_Voltage }}

#define SQ212_VOLTAGE_VAR_NUM = 1
Variable number; voltage is stored in sensorValues[1].
#define SQ212_VOLTAGE_VAR_NAME = "voltage"
Variable name in ODM2 controlled vocabulary; "voltage".
#define SQ212_VOLTAGE_UNIT_NAME = "volt"
Variable unit name in ODM2 controlled vocabulary; "volt" (V)
#define SQ212_VOLTAGE_DEFAULT_CODE = "SQ212Voltage"
Default variable short code; "SQ212Voltage".
#define SQ212_VOLTAGE_RESOLUTION = 4
Decimals places in string representation; voltage should have 4 when used with an ADS1115.

Define documentation

#define SQ212_NUM_VARIABLES = 2

Sensor::_numReturnedValues; the SQ212 can report 2 values, raw voltage and calculated PAR.


#define SQ212_INC_CALC_VARIABLES = 1

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


#define SQ212_CALIBRATION_FACTOR = 1

The calibration factor between output in volts and PAR (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 SQ212_WARM_UP_TIME_MS = 2

Sensor::_warmUpTime_ms; the warm up time is unknown; using the 2ms for the TI ADS1x15 to warm up.


#define SQ212_STABILIZATION_TIME_MS = 2

Sensor::_stabilizationTime_ms; the ADS1115 is stable after 2ms.

The stabilization time of the SQ-212 itself is not known!


#define SQ212_MEASUREMENT_TIME_MS = 2

Sensor::_measurementTime_ms; ADS1115 takes almost 2ms to complete a measurement (860/sec).


#define SQ212_PAR_RESOLUTION = 4

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


#define SQ212_PAR_VAR_NUM = 0

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


#define SQ212_PAR_VAR_NAME = "radiationIncomingPAR"

Variable name in ODM2 controlled vocabulary; "radiationIncomingPAR".


#define SQ212_PAR_UNIT_NAME = "microeinsteinPerSquareMeterPerSecond"

Variable unit name in ODM2 controlled vocabulary; "microeinsteinPerSquareMeterPerSecond" (µE m-2 s-1 or µmol * m-2 s-1)


#define SQ212_PAR_DEFAULT_CODE = "photosyntheticallyActiveRadiation"

Default variable short code; "photosyntheticallyActiveRadiation".


#define SQ212_VOLTAGE_VAR_NUM = 1

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


#define SQ212_VOLTAGE_UNIT_NAME = "volt"

Variable unit name in ODM2 controlled vocabulary; "volt" (V)


#define SQ212_VOLTAGE_DEFAULT_CODE = "SQ212Voltage"

Default variable short code; "SQ212Voltage".


#define SQ212_VOLTAGE_RESOLUTION = 4

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