ModularSensors > Modules > Supported Sensors > Yosemitech Sensors > Yosemitech Y520 Conductivity Sensor

Yosemitech Y520 Conductivity Sensor module

Classes for the Yosemitech Y520 4-pole conductivity sensor.

Sensor Datasheet

Sensor Constructor

YosemitechY520(byte modbusAddress, Stream* stream, int8_t powerPin, int8_t powerPin2 = -1, int8_t enablePin = -1, uint8_t measurementsToAverage = 1)

Construct a new Yosemitech Y520 object.

Parameters
modbusAddress The modbus address of the sensor.
stream An Arduino data stream for modbus communication. See notes for more information on what streams can be used.
powerPin The pin on the mcu controlling power to the Y520. Use -1 if it is continuously powered.
powerPin2 The pin on the mcu controlling power to the RS485 adapter, if it is different from that used to power the sensor. Use -1 or omit if not applicable.
enablePin The pin on the mcu controlling the direction enable on the RS485 adapter, if necessary; use -1 or omit if not applicable.
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 Yosemitech Y520 conductivity sensor is used in the menu a la carte example.

#include <sensors/YosemitechY520.h>

// NOTE: Extra hardware and software serial ports are created in the "Settings
// for Additional Serial Ports" section

// NOTE: Use -1 for any pins that don't apply or aren't being used.
byte          y520ModbusAddress  = 0x20;  // The modbus address of the Y520
const int8_t  y520AdapterPower   = sensorPowerPin;  // RS485 adapter power pin
const int8_t  y520SensorPower    = A3;              // Sensor power pin
const int8_t  y520EnablePin      = -1;              // Adapter RE/DE pin
const uint8_t y520NumberReadings = 5;
// The manufacturer recommends averaging 10 readings, but we take 5 to minimize
// power consumption

// Create a Y520 conductivity sensor object
YosemitechY520 y520(y520ModbusAddress, modbusSerial, y520AdapterPower,
                    y520SensorPower, y520EnablePin, y520NumberReadings);

// Create specific conductance and temperature variable pointers for the Y520
Variable* y520Cond =
    new YosemitechY520_Cond(&y520, "12345678-abcd-1234-ef00-1234567890ab");
Variable* y520Temp =
    new YosemitechY520_Temp(&y520, "12345678-abcd-1234-ef00-1234567890ab");

Classes

class YosemitechY520
The Sensor sub-class for the Yosemitech Y520-A 4-electrode conductivity sensor.
class YosemitechY520_Cond
The Variable sub-class used for the conductivity output from a Yosemitech Y520-A 4-electrode conductivity sensor.
class YosemitechY520_Temp
The Variable sub-class used for the temperature output from a Yosemitech Y520-A 4-electrode conductivity sensor.

Defines

#define Y520_NUM_VARIABLES = 2
Sensor::_numReturnedValues; the Y520 can report 2 values.
#define Y520_INC_CALC_VARIABLES = 0
Sensor::_incCalcValues; we don't calculate any additional values.

Sensor Timing

The sensor timing for a Yosemitch Y520

#define Y520_WARM_UP_TIME_MS = 1600
Sensor::_warmUpTime_ms; time before sensor responds after power - 1600 ms.
#define Y520_STABILIZATION_TIME_MS = 10000
Sensor::_stabilizationTime_ms; time between "StartMeasurement" command and stable reading - 10sec (10,000ms).
#define Y520_MEASUREMENT_TIME_MS = 2700
Sensor::_measurementTime_ms; the Y520 takes ~2700ms to complete a measurement.

Conductivity

The conductivity variable from a Yosemitch Y520

  • Range is 1 µS/cm to 200 mS/cm
  • Accuracy is ± 1 % Full Scale

YosemitechY520_Cond(YosemitechY520* parentSense, const char* uuid = "", const char* varCode = Y520_COND_DEFAULT_CODE) explicit

Construct a new YosemitechY520_Cond object.

Parameters
parentSense The parent YosemitechY520 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 "Y520Cond".

#define Y520_COND_RESOLUTION = 1
Decimals places in string representation; conductivity should have 1.
  • resolution is 0.1 µS/cm.
#define Y520_COND_VAR_NUM = 0
Sensor variable number; conductivity is stored in sensorValues[0].
#define Y520_COND_VAR_NAME = "specificConductance"
Variable name in ODM2 controlled vocabulary; "specificConductance".
#define Y520_COND_UNIT_NAME = "microsiemenPerCentimeter"
Variable unit name in ODM2 controlled vocabulary; "microsiemenPerCentimeter" (µS/cm)
#define Y520_COND_DEFAULT_CODE = "Y520Cond"
Default variable short code; "Y520Cond".

Temperature

The temperature variable from a Yosemitch Y520

  • Range is 0°C to + 50°C
  • Accuracy is ± 0.2°C

YosemitechY520_Temp(YosemitechY520* parentSense, const char* uuid = "", const char* varCode = Y520_TEMP_DEFAULT_CODE) explicit

Construct a new YosemitechY520_Temp object.

Parameters
parentSense The parent YosemitechY520 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 "Y520Temp".

#define Y520_TEMP_RESOLUTION = 1
Decimals places in string representation; temperature should have 1 - resolution is 0.1°C.
#define Y520_TEMP_VAR_NUM = 1
Sensor variable number; temperature is stored in sensorValues[1].
#define Y520_TEMP_VAR_NAME = "temperature"
Variable name in ODM2 controlled vocabulary; "temperature".
#define Y520_TEMP_UNIT_NAME = "degreeCelsius"
Variable unit name in ODM2 controlled vocabulary; "degreeCelsius" (°C)
#define Y520_TEMP_DEFAULT_CODE = "Y520Temp"
Default variable short code; "Y520Temp".