Atlas EZO-EC topic

Classes for the Atlas Scientific EZO-EC conductivity circuit and probes.

The Atlas Scientifc Conductivity sensor outputs raw conductivity, TDS, salinity, and specific gravity

  • Accuracy is ± 2%
  • Range is 0.07 − 500,000+ μS/cm
  • Resolution is 3 decimal places

Sensor Datasheet

Sensor Constructors

AtlasScientificEC::AtlasScientificEC(int8_t powerPin, uint8_t i2cAddressHex = 0x64, uint8_t measurementsToAverage = 1) explicit

Construct a new Atlas Scientific EC object using the primary hardware I2C instance.

Parameters
powerPin

The pin on the mcu controlling powering to the Atlas EC circuit. Use -1 if it is continuously powered.

  • Requires a 3.3V and 5V power supply
i2cAddressHex The I2C address of the Atlas circuit; optional with the Atlas-supplied default address of 0x64.
measurementsToAverage The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.

AtlasScientificEC::AtlasScientificEC(TwoWire* theI2C, int8_t powerPin, uint8_t i2cAddressHex = 0x64, uint8_t measurementsToAverage = 1)

Construct a new Atlas Scientific EC object using a secondary hardware I2C instance.

Parameters
theI2C A TwoWire instance for I2C communication. Due to the limitations of the Arduino core, only a hardware I2C instance can be used. For an AVR board, there is only one I2C instance possible and this form of the constructor should not be used. For a SAMD board, this can be used if a secondary I2C port is created on one of the extra SERCOMs.
powerPin

The pin on the mcu controlling powering to the Atlas EC circuit. Use -1 if it is continuously powered.

  • Requires a 3.3V and 5V power supply
i2cAddressHex The I2C address of the Atlas circuit; optional with the Atlas-supplied default address of 0x64.
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 Atlas conductivity sensor is used in the menu a la carte example.

1#include <sensors/AtlasScientificEC.h>
2
3// NOTE: Use -1 for any pins that don't apply or aren't being used.
4const int8_t AtlasECPower = sensorPowerPin; // Power pin
5uint8_t AtlasECi2c_addr = 0x64; // Default for EC is 0x64 (100)
6// All Atlas sensors have different default I2C addresses, but any of them can
7// be re-addressed to any 8 bit number. If using the default address for any
8// Atlas Scientific sensor, you may omit this argument.
9
10// Create an Atlas Scientific Conductivity sensor object
11// AtlasScientificEC atlasEC(AtlasECPower, AtlasECi2c_addr);
12AtlasScientificEC atlasEC(AtlasECPower);
13
14// Create four variable pointers for the EZO-ES
15Variable* atlasCond = new AtlasScientificEC_Cond(
16 &atlasEC, "12345678-abcd-1234-ef00-1234567890ab");
17Variable* atlasTDS =
18 new AtlasScientificEC_TDS(&atlasEC, "12345678-abcd-1234-ef00-1234567890ab");
19Variable* atlasSal = new AtlasScientificEC_Salinity(
20 &atlasEC, "12345678-abcd-1234-ef00-1234567890ab");
21Variable* atlasGrav = new AtlasScientificEC_SpecificGravity(
22 &atlasEC, "12345678-abcd-1234-ef00-1234567890ab");
23
24// Create a calculated variable for the temperature compensated conductivity
25// (that is, the specific conductance). For this example, we will use the
26// temperature measured by the Atlas RTD above this. You could use the
27// temperature returned by any other water temperature sensor if desired.
28// **DO NOT** use your logger board temperature (ie, from the DS3231) to
29// calculate specific conductance!
30float calculateAtlasSpCond(void) {
31 float spCond = -9999; // Always safest to start with a bad value
32 float waterTemp = atlasTemp->getValue();
33 float rawCond = atlasCond->getValue();
34 // ^^ Linearized temperature correction coefficient per degrees Celsius.
35 // The value of 0.019 comes from measurements reported here:
36 // Hayashi M. Temperature-electrical conductivity relation of water for
37 // environmental monitoring and geophysical data inversion. Environ Monit
38 // Assess. 2004 Aug-Sep;96(1-3):119-28.
39 // doi: 10.1023/b:emas.0000031719.83065.68. PMID: 15327152.
40 if (waterTemp != -9999 && rawCond != -9999) {
41 // make sure both inputs are good
42 float temperatureCoef = 0.019;
43 spCond = rawCond / (1 + temperatureCoef * (waterTemp - 25.0));
44 }
45 return spCond;
46}
47
48// Properties of the calculated variable
49// The number of digits after the decimal place
50const uint8_t atlasSpCondResolution = 0;
51// This must be a value from http://vocabulary.odm2.org/variablename/
52const char* atlasSpCondName = "specificConductance";
53// This must be a value from http://vocabulary.odm2.org/units/
54const char* atlasSpCondUnit = "microsiemenPerCentimeter";
55// A short code for the variable
56const char* atlasSpCondCode = "atlasSpCond";
57// The (optional) universallly unique identifier
58const char* atlasSpCondUUID = "12345678-abcd-1234-ef00-1234567890ab";
59
60// Finally, create the specific conductance variable and return a pointer to it
61Variable* atlasSpCond =
62 new Variable(calculateAtlasSpCond, atlasSpCondResolution, atlasSpCondName,
63 atlasSpCondUnit, atlasSpCondCode, atlasSpCondUUID);

Classes

class AtlasScientificEC
The Sensor sub-class for the Atlas Scientific conductivity circuit and sensor.
class AtlasScientificEC_Cond
The Variable sub-class used for the conductivity output from an Atlas Scientific EC EZO circuit.
class AtlasScientificEC_TDS
The Variable sub-class used for the total dissolved solids output from an Atlas Scientific EC EZO circuit.
class AtlasScientificEC_Salinity
The Variable sub-class used for the salinity output from an Atlas Scientific EC EZO circuit.
class AtlasScientificEC_SpecificGravity
The Variable sub-class used for the specific gravity output from an Atlas Scientific EC EZO circuit.

Sensor Variable Counts

The number of variables that can be returned by the Atlas conductivity sensor

#define ATLAS_COND_NUM_VARIABLES = 4
Sensor::_numReturnedValues; Atlas EZO conductivity circuit can report 4 values.
#define ATLAS_COND_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.

Configuration Defines

Defines to configure and set the address of the Atlas conductivity sensor

#define ATLAS_COND_I2C_ADDR = 0x64
The default I2C address of the Atlas conductivity sensor is 0x64 (100)

Sensor Timing

The sensor timing for an Atlas EC (conducticity) sensor

#define ATLAS_COND_WARM_UP_TIME_MS = 745
Sensor::_warmUpTime_ms; Atlas EZO conductivity circuit warms up in 745ms.
#define ATLAS_COND_STABILIZATION_TIME_MS = 0
Sensor::_stabilizationTime_ms; Atlas EZO conductivity circuit is stable 0ms after warm-up. (stable at completion of warm up)
#define ATLAS_COND_MEASUREMENT_TIME_MS = 600
Sensor::_measurementTime_ms; Atlas EZO conductivity circuit takes 600ms to complete a measurement.

Conductivity

The conductivity variable from an Atlas EC (conducticity) sensor

  • Accuracy is ± 2%
  • Range is 0.07 − 500,000+ μS/cm

AtlasScientificEC_Cond::AtlasScientificEC_Cond(AtlasScientificEC* parentSense, const char* uuid = "", const char* varCode = "AtlasCond") explicit

Construct a new AtlasScientificEC_Cond object.

Parameters
parentSense The parent AtlasScientificEC 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 "AtlasCond".

#define ATLAS_COND_RESOLUTION = 3
Decimals places in string representation; conductivity should have 3.
#define ATLAS_COND_VAR_NUM = 0
Sensor variable number; conductivity is stored in sensorValues[0].
#define ATLAS_COND_VAR_NAME = "electricalConductivity"
Variable name in ODM2 controlled vocabulary; "electricalConductivity".
#define ATLAS_COND_UNIT_NAME = "microsiemenPerCentimeter"
Variable unit name in ODM2 controlled vocabulary; "microsiemenPerCentimeter" (µS/cm)
#define ATLAS_COND_DEFAULT_CODE = "AtlasCond"
Default variable short code; "AtlasCond".

Total Dissolved Solids

The TDS variable from an Atlas EC (conducticity) sensor

  • Accuracy is ± 2%
  • Range is 0.07 − 500,000+ μS/cm

AtlasScientificEC_TDS::AtlasScientificEC_TDS(AtlasScientificEC* parentSense, const char* uuid = "", const char* varCode = "AtlasTDS") explicit

Construct a new AtlasScientificEC_TDS object.

Parameters
parentSense The parent AtlasScientificEC 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 "AtlasTDS".

#define ATLAS_TDS_RESOLUTION = 3
Decimals places in string representation; TDS should have 3.
#define ATLAS_TDS_VAR_NUM = 1
Sensor variable number; TDS is stored in sensorValues[1].
#define ATLAS_TDS_VAR_NAME = "solidsTotalDissolved"
Variable name in ODM2 controlled vocabulary; "solidsTotalDissolved".
#define ATLAS_TDS_UNIT_NAME = "partPerMillion"
Variable unit name in ODM2 controlled vocabulary; "partPerMillion" (ppm)
#define ATLAS_TDS_DEFAULT_CODE = "AtlasTDS"
Default variable short code; "AtlasTDS".

Salinity

The salinity variable from an Atlas EC (conducticity) sensor

  • Accuracy is ± 2%
  • Range is 0.07 − 500,000+ μS/cm

AtlasScientificEC_Salinity::AtlasScientificEC_Salinity(AtlasScientificEC* parentSense, const char* uuid = "", const char* varCode = "AtlasSalinity") explicit

Construct a new AtlasScientificEC_Salinity object.

Parameters
parentSense The parent AtlasScientificEC 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 "AtlasSalinity".

#define ATLAS_SALINITY_RESOLUTION = 3
Decimals places in string representation; salinity should have 3.
#define ATLAS_SALINITY_VAR_NUM = 2
Sensor variable number; salinity is stored in sensorValues[2].
#define ATLAS_SALINITY_VAR_NAME = "salinity"
Variable name in ODM2 controlled vocabulary; "salinity".
#define ATLAS_SALINITY_UNIT_NAME = "practicalSalinityUnit"
Variable unit name in ODM2 controlled vocabulary; "practicalSalinityUnit".
#define ATLAS_SALINITY_DEFAULT_CODE = "AtlasSalinity"
Default variable short code; "AtlasSalinity".

Specific Gravity

The specific gravity variable from an Atlas EC (conducticity) sensor

  • Accuracy is ± 2%
  • Range is 0.07 − 500,000+ μS/cm

AtlasScientificEC_SpecificGravity::AtlasScientificEC_SpecificGravity(AtlasScientificEC* parentSense, const char* uuid = "", const char* varCode = "AtlasSpecGravity") explicit

Construct a new AtlasScientificEC_SpecificGravity object.

Parameters
parentSense The parent AtlasScientificEC 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 "AtlasSpecGravity".

#define ATLAS_SG_RESOLUTION = 3
Decimals places in string representation; specific gravity should have 3.
#define ATLAS_SG_VAR_NUM = 3
Sensor variable number; specific gravity is stored in sensorValues[3].
#define ATLAS_SG_VAR_NAME = "specificGravity"
Variable name in ODM2 controlled vocabulary; "specificGravity".
#define ATLAS_SG_UNIT_NAME = "dimensionless"
Variable unit name in ODM2 controlled vocabulary; "dimensionless".
#define ATLAS_SG_DEFAULT_CODE = "AtlasSpecGravity"
Default variable short code; "AtlasSpecGravity".

Define documentation

#define ATLAS_COND_NUM_VARIABLES = 4

Sensor::_numReturnedValues; Atlas EZO conductivity circuit can report 4 values.


#define ATLAS_COND_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 ATLAS_COND_I2C_ADDR = 0x64

The default I2C address of the Atlas conductivity sensor is 0x64 (100)


#define ATLAS_COND_WARM_UP_TIME_MS = 745

Sensor::_warmUpTime_ms; Atlas EZO conductivity circuit warms up in 745ms.

739-740 in tests


#define ATLAS_COND_STABILIZATION_TIME_MS = 0

Sensor::_stabilizationTime_ms; Atlas EZO conductivity circuit is stable 0ms after warm-up. (stable at completion of warm up)


#define ATLAS_COND_MEASUREMENT_TIME_MS = 600

Sensor::_measurementTime_ms; Atlas EZO conductivity circuit takes 600ms to complete a measurement.

only ~555 measurement time in tests, but keep the 600 recommended by manual


#define ATLAS_COND_RESOLUTION = 3

Decimals places in string representation; conductivity should have 3.


#define ATLAS_COND_VAR_NUM = 0

Sensor variable number; conductivity is stored in sensorValues[0].


#define ATLAS_COND_VAR_NAME = "electricalConductivity"

Variable name in ODM2 controlled vocabulary; "electricalConductivity".


#define ATLAS_COND_UNIT_NAME = "microsiemenPerCentimeter"

Variable unit name in ODM2 controlled vocabulary; "microsiemenPerCentimeter" (µS/cm)


#define ATLAS_COND_DEFAULT_CODE = "AtlasCond"

Default variable short code; "AtlasCond".


#define ATLAS_TDS_RESOLUTION = 3

Decimals places in string representation; TDS should have 3.


#define ATLAS_TDS_VAR_NUM = 1

Sensor variable number; TDS is stored in sensorValues[1].


#define ATLAS_TDS_VAR_NAME = "solidsTotalDissolved"

Variable name in ODM2 controlled vocabulary; "solidsTotalDissolved".


#define ATLAS_TDS_UNIT_NAME = "partPerMillion"

Variable unit name in ODM2 controlled vocabulary; "partPerMillion" (ppm)


#define ATLAS_TDS_DEFAULT_CODE = "AtlasTDS"

Default variable short code; "AtlasTDS".


#define ATLAS_SALINITY_RESOLUTION = 3

Decimals places in string representation; salinity should have 3.


#define ATLAS_SALINITY_VAR_NUM = 2

Sensor variable number; salinity is stored in sensorValues[2].


#define ATLAS_SALINITY_UNIT_NAME = "practicalSalinityUnit"

Variable unit name in ODM2 controlled vocabulary; "practicalSalinityUnit".


#define ATLAS_SALINITY_DEFAULT_CODE = "AtlasSalinity"

Default variable short code; "AtlasSalinity".


#define ATLAS_SG_RESOLUTION = 3

Decimals places in string representation; specific gravity should have 3.


#define ATLAS_SG_VAR_NUM = 3

Sensor variable number; specific gravity is stored in sensorValues[3].


#define ATLAS_SG_VAR_NAME = "specificGravity"

Variable name in ODM2 controlled vocabulary; "specificGravity".


#define ATLAS_SG_UNIT_NAME = "dimensionless"

Variable unit name in ODM2 controlled vocabulary; "dimensionless".


#define ATLAS_SG_DEFAULT_CODE = "AtlasSpecGravity"

Default variable short code; "AtlasSpecGravity".