ModularSensors > Files > src / sensors / EverlightALSPT19.h

EverlightALSPT19.h file

Contains the EverlightALSPT19 sensor subclass and the variable subclasses EverlightALSPT19_Current and EverlightALSPT19_Illuminance.

These are used for the Everlight ALS-PT19 ambient light sensor.

Classes

class EverlightALSPT19
The Sensor sub-class for the Everlight ALS-PT19.
class EverlightALSPT19_Voltage
The Variable sub-class used for the relative current output from an Everlight ALS-PT19.
class EverlightALSPT19_Current
The Variable sub-class used for the relative current output from an Everlight ALS-PT19.
class EverlightALSPT19_Illuminance
The Variable sub-class used for the calculated illuminance output from an Everlight ALS-PT19.

Defines

#define ALSPT19_NUM_VARIABLES = 3
Sensor::_numReturnedValues; the ALS-PT19 can report 1 "raw" value (voltage) and we calculate current and illuminance from it.
#define ALSPT19_INC_CALC_VARIABLES = 2
Sensor::_incCalcValues; we calculate photocurrent from the supply voltage and loading resistance and illuminance from the photocurrent.
#define MAYFLY_ALS_POWER_PIN = -1
The power pin for the ALS on the EnviroDIY Mayfly v1.x.
#define MAYFLY_ALS_DATA_PIN = A4
The data pin for the ALS on the EnviroDIY Mayfly v1.x.
#define MAYFLY_ALS_SUPPLY_VOLTAGE = 3.3
The supply voltage for the ALS on the EnviroDIY Mayfly v1.x.
#define MAYFLY_ALS_LOADING_RESISTANCE = 10
The loading resistance for the ALS on the EnviroDIY Mayfly v1.x.
#define ALSPT19_ADC_RESOLUTION = 10
Default resolution (in bits) of the voltage measurement.
#define ALSPT19_ADC_MAX = ((1 <<
The maximum possible value of the ADC - one less than the resolution shifted up one bit.
#define ALSPT19_ADC_RANGE = (1 <<
The maximum possible range of the ADC - the resolution shifted up one bit.
#define ALSPT19_ADC_REFERENCE_MODE = DEFAULT
The voltage reference mode for the processor's ADC.
#define ALSPT19_ADC_REFERENCE_MODE = AR_DEFAULT
The voltage reference mode for the processor's ADC.

Sensor Timing

The sensor timing for an Everlight ALS-PT19

#define ALSPT19_WARM_UP_TIME_MS = 2
Sensor::_warmUpTime_ms; the ALS-PT19 should not need to warm up.
#define ALSPT19_STABILIZATION_TIME_MS = 1
Sensor::_stabilizationTime_ms; the ALS-PT19 rise time is 0.11 ms (typical).
#define ALSPT19_MEASUREMENT_TIME_MS = 1
Sensor::_measurementTime_ms; essentially 0 time is taken in a reading, just the analog read time, but we want to give more than the rise (0.11 ms) or fall (0.22 ms) time between readings.

Voltage

The voltage variable from an Everlight ALS-PT19

  • Range is dependent on supply voltage and loading resistor
    • 0 to 4.6 V with a 5V power supply and 75K resistor

EverlightALSPT19_Voltage(EverlightALSPT19* parentSense, const char* uuid = "", const char* varCode = ALSPT19_VOLTAGE_DEFAULT_CODE) explicit

Construct a new EverlightALSPT19_Voltage object.

Parameters
parentSense The parent EverlightALSPT19 providing the result values.
uuid A universally unique identifier (UUID or GUID) for the variable; optional with the default value of an empty string.
varCode A short code to help identify the variable in files; optional with a default value of "ALSPT19Current".

#define ALSPT19_VOLTAGE_RESOLUTION = 3
Decimals places in string representation; voltage should have 0.
#define ALSPT19_VOLTAGE_VAR_NUM = 0
Sensor variable number; current is stored in sensorValues[0].
#define ALSPT19_VOLTAGE_VAR_NAME = "voltage"
Variable name in ODM2 controlled vocabulary; "electricCurrent".
#define ALSPT19_VOLTAGE_UNIT_NAME = "volt"
Variable unit name in ODM2 controlled vocabulary; "microampere".
#define ALSPT19_VOLTAGE_DEFAULT_CODE = "ALSPT19Voltage"
Default variable short code; "ALSPT19Voltage".

Current

The current variable from an Everlight ALS-PT19

  • Range is 5 to 520 µA

EverlightALSPT19_Current(EverlightALSPT19* parentSense, const char* uuid = "", const char* varCode = ALSPT19_CURRENT_DEFAULT_CODE) explicit

Construct a new EverlightALSPT19_Current object.

Parameters
parentSense The parent EverlightALSPT19 providing the result values.
uuid A universally unique identifier (UUID or GUID) for the variable; optional with the default value of an empty string.
varCode A short code to help identify the variable in files; optional with a default value of "ALSPT19Current".

#define ALSPT19_CURRENT_RESOLUTION = 0
Decimals places in string representation; voltage should have 0.
#define ALSPT19_CURRENT_VAR_NUM = 1
Sensor variable number; current is stored in sensorValues[0].
#define ALSPT19_CURRENT_VAR_NAME = "electricCurrent"
Variable name in ODM2 controlled vocabulary; "electricCurrent".
#define ALSPT19_CURRENT_UNIT_NAME = "microampere"
Variable unit name in ODM2 controlled vocabulary; "microampere".
#define ALSPT19_CURRENT_DEFAULT_CODE = "ALSPT19Current"
Default variable short code; "ALSPT19Current".

Illuminance

The illuminance variable from an Everlight ALS-PT19

  • Range is 0 to 10000 lux

EverlightALSPT19_Illuminance(EverlightALSPT19* parentSense, const char* uuid = "", const char* varCode = ALSPT19_ILLUMINANCE_DEFAULT_CODE) explicit

Construct a new EverlightALSPT19_Illuminance object.

Parameters
parentSense The parent EverlightALSPT19 providing the result values.
uuid A universally unique identifier (UUID or GUID) for the variable; optional with the default value of an empty string.
varCode A short code to help identify the variable in files; optional with a default value of "ALSPT19Lux".

#define ALSPT19_ILLUMINANCE_RESOLUTION = 1
Decimals places in string representation; illuminance should have 0.
#define ALSPT19_ILLUMINANCE_VAR_NUM = 2
Sensor variable number; illuminance is stored in sensorValues[1].
#define ALSPT19_ILLUMINANCE_VAR_NAME = "illuminance"
Variable name in ODM2 controlled vocabulary; "illuminance".
#define ALSPT19_ILLUMINANCE_UNIT_NAME = "lux"
Variable unit name in ODM2 controlled vocabulary; "lux".
#define ALSPT19_ILLUMINANCE_DEFAULT_CODE = "ALSPT19Lux"
Default variable short code; "ALSPT19Lux".