ModularSensors > Modules > Supported Sensors > Yosemitech Sensors > Yosemitech Y504 Dissolved Oxygen Sensor

Yosemitech Y504 Dissolved Oxygen Sensor module

Classes for the Yosemitech Y502-A or Y504-A optical dissolved oxygen sensor.

Sensor Datasheet

Sensor Constructor

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

Construct a new Yosemitech Y504 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 Y504. 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 Y504 Dissolved Oxygen is used in the menu a la carte example.

#include <sensors/YosemitechY504.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          y504ModbusAddress  = 0x04;  // The modbus address of the Y504
const int8_t  y504AdapterPower   = sensorPowerPin;  // RS485 adapter power pin
const int8_t  y504SensorPower    = A3;              // Sensor power pin
const int8_t  y504EnablePin      = -1;              // Adapter RE/DE pin
const uint8_t y504NumberReadings = 5;
// The manufacturer recommends averaging 10 readings, but we take 5 to minimize
// power consumption

// Create a Yosemitech Y504 dissolved oxygen sensor object
YosemitechY504 y504(y504ModbusAddress, modbusSerial, y504AdapterPower,
                    y504SensorPower, y504EnablePin, y504NumberReadings);

// Create the dissolved oxygen percent, dissolved oxygen concentration, and
// temperature variable pointers for the Y504
Variable* y504DOpct =
    new YosemitechY504_DOpct(&y504, "12345678-abcd-1234-ef00-1234567890ab");
Variable* y504DOmgL =
    new YosemitechY504_DOmgL(&y504, "12345678-abcd-1234-ef00-1234567890ab");
Variable* y504Temp =
    new YosemitechY504_Temp(&y504, "12345678-abcd-1234-ef00-1234567890ab");

Classes

class YosemitechY504
The Sensor sub-class for the Yosemitech Y502-A or Y504-A optical dissolved oxygen sensors.
class YosemitechY504_DOpct
The Variable sub-class used for the dissolved oxygen percent saturation output from a Yosemitech Y502-A or Y504-A optical dissolved oxygen sensor.
class YosemitechY504_Temp
The Variable sub-class used for the temperature output from a Yosemitech Y504 optical dissolved oxygen sensor.
class YosemitechY504_DOmgL
The Variable sub-class used for the dissolved oxygen concentration output from a Yosemitech Y502-A or Y504-A optical dissolved oxygen sensor.

Defines

#define Y504_NUM_VARIABLES = 3
Sensor::_numReturnedValues; the Y504 can report 3 values.
#define Y504_INC_CALC_VARIABLES = 1
Sensor::_incCalcValues; we calculated DO concentration from the percent saturation and the temperature.

Sensor Timing

The sensor timing for a Yosemitch Y504

#define Y504_WARM_UP_TIME_MS = 375
Sensor::_warmUpTime_ms; time before sensor responds after power - 375ms.
#define Y504_STABILIZATION_TIME_MS = 8000
Sensor::_stabilizationTime_ms; time between "StartMeasurement" command and stable reading - 8sec (8000ms).
#define Y504_MEASUREMENT_TIME_MS = 1700
Sensor::_measurementTime_ms; the Y504 takes ~1700ms to complete a measurement.

Dissolved Oxygen Percent Saturation

The dissolved oxygen percent saturation variable from a Yosemitch Y504

  • Range is 0-20mg/L or 0-200% Saturation
  • Accuracy is ± 1 %

YosemitechY504_DOpct(YosemitechY504* parentSense, const char* uuid = "", const char* varCode = Y504_DOPCT_DEFAULT_CODE) explicit

Construct a new YosemitechY504_DOpct object.

Parameters
parentSense The parent YosemitechY504 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 "Y504DOpct".

#define Y504_DOPCT_RESOLUTION = 1
Decimals places in string representation; dissolved oxygen percent should have 1 - resolution is 0.1%.
#define Y504_DOPCT_VAR_NUM = 0
Sensor variable number; dissolved oxygen percent is stored in sensorValues[0].
#define Y504_DOPCT_VAR_NAME = "oxygenDissolvedPercentOfSaturation"
Variable name in ODM2 controlled vocabulary; "oxygenDissolvedPercentOfSaturation".
#define Y504_DOPCT_UNIT_NAME = "percent"
Variable unit name in ODM2 controlled vocabulary; "milligramPerLiter" (mg/L)
#define Y504_DOPCT_DEFAULT_CODE = "Y504DOpct"
Default variable short code; "Y504DOmgL".

Temperature

The temperature variable from a Yosemitch Y504

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

YosemitechY504_Temp(YosemitechY504* parentSense, const char* uuid = "", const char* varCode = Y504_TEMP_DEFAULT_CODE) explicit

Construct a new YosemitechY504_Temp object.

Parameters
parentSense The parent YosemitechY504 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 "Y504Temp".

#define Y504_TEMP_RESOLUTION = 1
Decimals places in string representation; temperature should have 1 - resolution is 0.1°C.
#define Y504_TEMP_VAR_NUM = 1
Sensor variable number; temperature is stored in sensorValues[1].
#define Y504_TEMP_VAR_NAME = "temperature"
Variable name in ODM2 controlled vocabulary; "temperature".
#define Y504_TEMP_UNIT_NAME = "degreeCelsius"
Variable unit name in ODM2 controlled vocabulary; "degreeCelsius" (°C)
#define Y504_TEMP_DEFAULT_CODE = "Y504Temp"
Default variable short code; "Y504Temp".

Dissolved Oxygen Concentration

The dissolved oxygen concentration variable from a Yosemitch Y504

  • Range is 0-20mg/L or 0-200% Saturation
  • Accuracy is ± 1 %

YosemitechY504_DOmgL(YosemitechY504* parentSense, const char* uuid = "", const char* varCode = Y504_DOMGL_DEFAULT_CODE) explicit

Construct a new YosemitechY504_DOmgL object.

Parameters
parentSense The parent YosemitechY504 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 "Y504DOmgL".

#define Y504_DOMGL_RESOLUTION = 2
Decimals places in string representation; dissolved oxygen concentration should have 2 - resolution is 0.01 mg/L.
#define Y504_DOMGL_VAR_NUM = 2
Sensor variable number; dissolved oxygen concentration is stored in sensorValues[2].
#define Y504_DOMGL_VAR_NAME = "oxygenDissolved"
Variable name in ODM2 controlled vocabulary; "oxygenDissolved".
#define Y504_DOMGL_UNIT_NAME = "milligramPerLiter"
Variable unit name in ODM2 controlled vocabulary; "milligramPerLiter" (mg/L)
#define Y504_DOMGL_DEFAULT_CODE = "Y504DOmgL"
Default variable short code; "Y504DOmgL".