ModularSensors > Files > src / sensors / AnalogElecConductivity.h

AnalogElecConductivity.h file

Encapsulates an Electrical Conductivity sensors using an anlog input and onboard ADC and ADC ref.

Classes

class AnalogElecConductivity
Class for the analog Electrical Conductivity monitor.
class AnalogElecConductivity_EC
The variable class used for electricalConductivity measured using an analog pin connected to electrodes submerged in the medium.

Defines

#define ANALOGELECCONDUCTIVITY_NUM_VARIABLES = 1
Sensor::_numReturnedValues; we only get one value from the analog conductivity sensor.
#define ANALOGELECCONDUCTIVITY_INC_CALC_VARIABLES = 0
Sensor::_incCalcValues; we don't calculate any additional values - though we recommend users include a temperature sensor and calculate specific conductance in their own program.
#define ANALOG_EC_ADC_RESOLUTION = 10
Default resolution (in bits) of the voltage measurement.
#define ANALOG_EC_ADC_MAX = ((1 <<
The maximum possible value of the ADC - one less than the resolution shifted up one bit.
#define ANALOG_EC_ADC_RANGE = (1 <<
The maximum possible range of the ADC - the resolution shifted up one bit.
#define ANALOG_EC_ADC_REFERENCE_MODE = DEFAULT
The voltage reference mode for the processor's ADC.
#define ANALOG_EC_ADC_REFERENCE_MODE = AR_DEFAULT
The voltage reference mode for the processor's ADC.
#define RSERIES_OHMS_DEF = 499
The default resistance (in ohms) of the measuring resistor. This should not be less than 300 ohms when measuring EC in water.
#define SENSOREC_KONST_DEF = 1.0
Cell Constant For EC Measurements.

Sensor Timing

The timing for analog conductivity via resistance.

#define ANALOGELECCONDUCTIVITY_WARM_UP_TIME_MS = 2
Sensor::_warmUpTime_ms; giving 2ms for warm-up.
#define ANALOGELECCONDUCTIVITY_STABILIZATION_TIME_MS = 1
Sensor::_stabilizationTime_ms; we give just a tiny delay for stabilization.
#define ANALOGELECCONDUCTIVITY_MEASUREMENT_TIME_MS = 0
Sensor::_measurementTime_ms; we assume the analog voltage is measured instantly.

Electrical Conductance

The humidity variable from an AOSong DHT

  • Range: low 100's when open air, for short circuit: a high number
  • Accuracy: needs determining for each combination of ADC. ADC_REF, and series R. its designed as a very simple relative EC measurement

AnalogElecConductivity_EC(AnalogElecConductivity* parentSense, const char* uuid = "", const char* varCode = ANALOGELECCONDUCTIVITY_EC_DEFAULT_CODE)

Construct a new AnalogElecConductivity_EC object.

Parameters
parentSense The parent AnalogElecConductivity 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 "anlgEc".

#define ANALOGELECCONDUCTIVITY_EC_RESOLUTION = 1
Decimals places in string representation; EC should have 1.
#define ANALOGELECCONDUCTIVITY_EC_VAR_NUM = 0
Sensor vensor variable number; EC is stored in sensorValues[0].
#define ANALOGELECCONDUCTIVITY_EC_VAR_NAME = "electricalConductivity"
Variable name in ODM2 controlled vocabulary; "electricalConductivity".
#define ANALOGELECCONDUCTIVITY_EC_UNIT_NAME = "microsiemenPerCentimeter"
Variable unit name in ODM2 controlled vocabulary; "microsiemenPerCentimeter" (µS/cm)
#define ANALOGELECCONDUCTIVITY_EC_DEFAULT_CODE = "anlgEc"
Default variable short code; "anlgEc".