Class Members

public float S

EC in Siemens per centimeter

public float mS

EC in milli-Siemens per centimeter

public float uS

EC in micro-Siemens per centimeter

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 tempC

Temperature in C

public float tempF

Temperature in F

Class Functions

measureEC

Starts an EC measurement.

uS, mS, S, PPM_500, PPM_640, PPM_700, salinityPSU are updated.

Parameters

  • newTemp boolean to take a new temperature measurement.

Usage

EC_Salinity::measureEC(bool newTemp);

If called without parameters, a new temperature is taken if useTemperatureCompensation is true.

EC_Salinity::measureEC();

Example

#include <ECSalinity.h>
EC_Salinity ec;

float mS = ec.measureEC();

Related

Returns

EC in mS, -1 on error

measureSW

Starts a salinity measurement. If called without parameters, a new temperature is taken if useTemperatureCompensation is true.

salinityPSU is updated.

Usage

EC_Salinity::measureSW(bool newTemp);

Example

#include <ECSalinity.h>
EC_Salinity ec;

float sal = ec.measureSW();

Related

Returns

salinity in PSU, -1 on error

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.

calibrateEC

Calibrates the probe for the EC (hydroponics and pools) range and saves the result for subsequent use.

When you pass the mS/cm value, ensure the correct value is used for the temperature. For example, if calibrating with a 1.413 mS/cm solution, and the solution's temperature is 20 C, the correct value is 1.278 mS/cm, which should be listed on the container or manufacturer's website.

useTemperatureCompensation must also be disabled prior to calling this method.

Parameters

  • solutionEC the calibration solution in mS/cm

Usage

EC_Salinity::calibrateEC(float solutionEC);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.useTemperatureCompensation(false);
ec.calibrateEC(2.0);

Related

Returns

none

calibrateSW

Calibrates the probe for the SW (seawater) range and saves the result for subsequent use.

When you pass the mS/cm value, ensure the correct value is used for the temperature. For example, if calibrating with a 53.0 mS/cm solution, and the solution's temperature is 20 C, the correct value is 58.7 mS/cm, which should be listed on the container or manufacturer's website.

useTemperatureCompensation must also be disabled prior to calling this method.

Parameters

  • solutionSW the calibration solution in mS/cm

Usage

EC_Salinity::calibrateSW(float solutionSW);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.useTemperatureCompensation(false);
ec.calibrateSW(53.0);

Related

Returns

none

getCalibrationEC

Retrieves the calibration data for the EC range.

Usage

EC_Salinity::getCalibrationEC();

Example

#include <ECSalinity.h>
EC_Salinity ec;

float calEC = ec.getCalibrationEC();

Related

Returns

the EC calibration data

getCalibrationSW

Retrieves the calibration data for the SW range.

Usage

EC_Salinity::getCalibrationSW();

Example

#include <ECSalinity.h>
EC_Salinity ec;

float calSW = ec.getCalibrationSW();

Related

Returns

the SW calibration data

setI2CAddress

Changes the default I2C address.

Usage

EC_Salinity::setI2CAddress(59);

Example

#include <ECSalinity.h>
EC_Salinity ec;

ec.setI2CAddress(59);

Returns

none

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);
ec.measureEC(false);

Related

Returns

none

getTempConstant

Retrieves the temperature constant.

Usage

EC_Salinity::getTempConstant();

Example

#include <ECSalinity.h>
EC_Salinity ec;

float 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;

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 true if temperature compensation is being used.

Usage

EC_Salinity::usingTemperatureCompensation();

Example

#include <ECSalinity.h>
EC_Salinity ec;

bool useTC = ec.usingTemperatureCompensation();

Related

Returns

none

getVersion

Retrieves the hardware 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

getFirmware

Retrieves the firmware version of the device.

Usage

EC_Salinity::getFirmware();

Example

#include <ECSalinity.h>
EC_Salinity ec;

uint8_t version = ec.getFirmware();

Related

Returns

version of firmware