Class Members

public float S

EC in Siemens

public float mS

EC in milli-Siemens

public float uS

EC in micro-Siemens

public long PPM_500

Parts per million using 500 as a multiplier

public long PPM_640

Parts per million using 640 as a multiplier

public long PPM_700

Parts per million using 700 as a multiplier

public float salinityPSU

Salinity measured practical salinity units

public float salinityPPT

Salinity measured parts per thousand

public float salinityPPM

Salinity measured parts per million

public float tempC

Temperature in C

public float tempF

Temperature in F

Class Functions

measureEC

Starts an EC measurement.

The temperature coefficient is generally accepted to be 0.019 for freshwater (EC_Salinity::tempCoefEC) or 0.021 for saline water (EC_Salinity::tempCoefSalinity).

uS, mS, S, PPM_500, PPM_640, PPM_700, salinityPSU, salinityPPT and salinityPPM are updated.

Parameters

  • tempCoef the coefficient used to compensate for temperature. EC_Salinity::tempCoefEC, EC_Salinity::tempCoefSalinity, or any other appropriate value.
  • newTemp boolean to take a new temperature measurement.

Usage

EC_Salinity::measureEC(float tempCoef, bool newTemp);

If called without parameters, the temperature coefficient used is for freshwater (EC_Salinity::tempCoefEC), and a new temperature is taken only if useTemperatureCompensation is true.

EC_Salinity::measureEC();

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.setK(1.0);
float mS = ec.measureEC();

Related

Returns

EC in mS, -1 on error

WARNING

PPM is not valid if salinity is being measured, use salinityPPT and salinityPPM.

K must be set before taking a reading.

measureSalinity

Starts a salinity measurement. The temperature coefficient for saline water is generally accepted to be 0.021 (EC_Salinity::tempCoefSalinity) and is used for this measurement.

salinityPSU, salinityPPT and salinityPPM are updated.

Usage

EC_Salinity::measureSalinity();

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.setK(10.0);
float sal = ec.measureSalinity();

Related

Returns

salinity in PSU, -1 on error

WARNING

The PSU must be between 2 and 42; a value not within bounds will return -1. The temperature must be within -2 to 35.

K must be set before taking a reading.

measureTemp

Starts a temperature measurement.

Usage

EC_Salinity::measureTemp();

Example

#include <ECSalinity.h>
EC_Salinity ec;

float C = ec.measureTemp();

Related

Returns

temperature in C

ALSO...

Class variables tempC and tempF are updated.

WARNING

A value of -127 means the temperature sensor is not connected.

calibrateProbe

Calibrates the connected probe and saves the result in EEPROM. The offset will be saved in the device's EEPROM and used automatically thereafter.

Parameters

  • solutionEC the EC of the calibration solution in mS
  • tempCoef the coefficient used to calibrate the probe. EC_Salinity::tempCoefEC, EC_Salinity::tempCoefSalinity, or any other appropriate value.

Usage

EC_Salinity::calibrateProbe(float solutionEC, float tempCoef);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.calibrateProbe(2.0);

Related

Returns

none

calibrateProbeLow

Calibrates the dual-point values for the low reading and saves them in the devices's EEPROM.

Dual point uses two measures for low and high points. It needs the measured value (reading value) and the known value (reference value). Calling calibrateProbeLow saves both the reading and reference value.

Parameters

  • solutionEC the EC of the calibration solution in mS
  • tempCoef the coefficient used to calibrate the probe. EC_Salinity::tempCoefEC, EC_Salinity::tempCoefSalinity, or any other appropriate value.

Usage

EC_Salinity::calibrateProbeLow(float solutionEC, float tempCoef);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.setK(10.0);
ec.calibrateProbeLow(0.7, EC_Salinity::tempCoefEC);
ec.calibrateProbeHigh(1.0, EC_Salinity::tempCoefEC);

Related

Returns

none

calibrateProbeHigh

Calibrates the dual-point values for the high reading and saves them in the devices's EEPROM.

Dual point uses two measures for low and high points. It needs the measured value (reading value) and the known value (reference value). Calling calibrateProbeLow saves both the reading and reference value.

Parameters

  • solutionEC the EC of the calibration solution in mS
  • tempCoef the coefficient used to calibrate the probe. EC_Salinity::tempCoefEC, EC_Salinity::tempCoefSalinity, or any other appropriate value.

Usage

EC_Salinity::calibrateProbeHigh(float solutionEC, float tempCoef);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.setK(10.0);
ec.calibrateProbeLow(0.7, EC_Salinity::tempCoefEC);
ec.calibrateProbeHigh(1.0, EC_Salinity::tempCoefEC);

Related

Returns

none

calibrateDry

Determines the dry reading of the probe and saves the result in EEPROM. If subsequent measurements are taken that are less than the dry value, a -1 will be returned. This can be used to determine if the probe is not connected as well.

Usage

EC_Salinity::calibrateDry();

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.calibrateDry();

Related

Returns

none

setDualPointCalibration

Sets all the values for dual point calibration and saves them in the devices's EEPROM. The reference values will come from the known solution, the reading values will come from the actual probe to be calibrated taking a reading in the reference solution. Each probe and each device will be different.

Parameters

  • refLow the reference low point
  • refHigh the reference high point
  • readLow the measured low point in mS
  • readHigh the measured high point in mS

Usage

EC_Salinity::setDualPointCalibration(float refLow, float refHigh, float readLow, float readHigh);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.setDualPointCalibration(0.7, 1.0, 0.9, 2.2);

Related

Returns

none

setI2CAddress

Changes the default I2C address.

Usage

EC_Salinity::setI2CAddress(59);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.setI2CAddress(59);

Returns

none

setK

Updates the device with a new cell constant, referred to as K, and saves it in EEPROM. The K-value is typically either generally 1.0 or 10.0, or labeled on the probe with it's exact value.

Parameters

  • K the new cell constant

Usage

EC_Salinity::setK(float K);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.setK(1.121);

Related

Returns

none

getK

Retrieves the cell constant, referred to as K, from the device.

Usage

float K = EC_Salinity::getK();

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.getK();

Related

Returns

none

getCalibrateDry

Retrieves the dry reading of the probe.

Usage

EC_Salinity::getCalibrateDry();

Example

#include <ECSalinity.h>
EC_Salinity ec;

float dry = ec.getCalibrateDry();

Related

Returns

The reading, in mS, that the device will consider as a dry/unconnected probe reading

reset

Resets all the stored calibration information.

Usage

EC_Salinity::reset();

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.reset();

Related

Returns

none

setTempConstant

Configures device to use the provided temperature constant. The effect of using temperature compensation, will apply a formula that attempts to estimate what the reading would be at another temperature, referred to as the temperature constant.

Parameters

  • temp_constant the temperature to use for compensation

Usage

EC_Salinity::setTempConstant(uint8_t temp_constant);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.setTempConstant(25);

Related

Returns

none

getTempConstant

Retrieves the temperature constant.

Usage

EC_Salinity::getTempConstant();

Example

#include <ECSalinity.h>
EC_Salinity ec;

uint8_t tempConst = ec.getTempConstant();

Related

Returns

the temperature used for compensation

setTemp

Sets the temperature used by the device without using the attached temperature sensor.

Parameters

  • float tempC

Usage

EC_Salinity::setTemp(tempC);

Example

#include <ECSalinity.h>
EC_Salinity ec;

uint8_t tempConst = ec.setTemp(20.2);

Related

Returns

none

useTemperatureCompensation

Configures device to use temperature compensation.

Parameters

  • bool true/false

Usage

EC_Salinity::useTemperatureCompensation(bool);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.useTemperatureCompensation(true);

Related

Returns

none

usingTemperatureCompensation

Returns if temperature compensation is being used.

Usage

EC_Salinity::usingTemperatureCompensation();

Example

#include <ECSalinity.h>
EC_Salinity ec;

bool useTC = ec.usingTemperatureCompensation();

Related

Returns

none

useDualPoint

Configures device to use dual-point calibration.

Parameters

  • bool true/false

Usage

EC_Salinity::useDualPoint(bool);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.useDualPoint(true);

Related

Returns

none

usingDualPoint

Determines if dual point calibration is being used.

Usage

EC_Salinity::usingDualPoint();

Example

#include <ECSalinity.h>
EC_Salinity ec;

bool useDP = ec.usingDualPoint();

Related

Returns

true if using compensation, false otherwise

getCalibrateHighReference

Returns the dual-point calibration high-reference value.

Usage

EC_Salinity::getCalibrateHighReference();

Example

#include <ECSalinity.h>
EC_Salinity ec;

float refHigh = ec.getCalibrateHighReference();

Related

Returns

the dual-point calibration high-reference value

getCalibrateLowReference

Returns the dual-point calibration low-reference value.

Usage

EC_Salinity::getCalibrateLowReference();

Example

#include <ECSalinity.h>
EC_Salinity ec;

float lowRef = ec.getCalibrateLowReference();

Related

Returns

the dual-point calibration low-reference value

getCalibrateHighReading

Returns the dual-point calibration high-reading value.

Usage

EC_Salinity::getCalibrateHighReading();

Example

#include <ECSalinity.h>
EC_Salinity ec;

float highRef = ec.getCalibrateHighReading();

Related

Returns

the dual-point calibration high-reading value

getCalibrateLowReading

Returns the dual-point calibration low-reading value.

Usage

EC_Salinity::getCalibrateLowReading();

Example

#include <ECSalinity.h>
EC_Salinity ec;

float lowRead = ec.getCalibrateLowReading();

Related

Returns

the dual-point calibration low-reading value

setCalibrateOffset

Sets the single point offset value rather than having the device determine it using calibrateProbe. This value would be previously determined and is different for each probe and device.

Parameters

  • offset single point offset value

Usage

EC_Salinity::setCalibrateOffset(float offset);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.setCalibrateOffset(0.13);

Related

Returns

none

getCalibrateOffset

Retrieves the single point offset value.

Usage

EC_Salinity::getCalibrateOffset();

Example

#include <ECSalinity.h>
EC_Salinity ec;

float offset = ec.getCalibrateOffset();

Related

Returns

single point offset value

getVersion

Retrieves the firmware version of the device.

Usage

EC_Salinity::getVersion();

Example

#include <ECSalinity.h>
EC_Salinity ec;

uint8_t version = ec.getVersion();

Related

Returns

version of firmware