Yosemitech Y504 Dissolved Oxygen Sensor topic

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

Sensor Datasheet

Sensor Constructor

YosemitechY504::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.

1#include <sensors/YosemitechY504.h>
2
3// NOTE: Extra hardware and software serial ports are created in the "Settings
4// for Additional Serial Ports" section
5
6// NOTE: Use -1 for any pins that don't apply or aren't being used.
7byte y504ModbusAddress = 0x04; // The modbus address of the Y504
8const int8_t y504AdapterPower = sensorPowerPin; // RS485 adapter power pin
9const int8_t y504SensorPower = A3; // Sensor power pin
10const int8_t y504EnablePin = -1; // Adapter RE/DE pin
11const uint8_t y504NumberReadings = 5;
12// The manufacturer recommends averaging 10 readings, but we take 5 to minimize
13// power consumption
14
15// Create a Yosemitech Y504 dissolved oxygen sensor object
16YosemitechY504 y504(y504ModbusAddress, modbusSerial, y504AdapterPower,
17 y504SensorPower, y504EnablePin, y504NumberReadings);
18
19// Create the dissolved oxygen percent, dissolved oxygen concentration, and
20// temperature variable pointers for the Y504
21Variable* y504DOpct =
22 new YosemitechY504_DOpct(&y504, "12345678-abcd-1234-ef00-1234567890ab");
23Variable* y504DOmgL =
24 new YosemitechY504_DOmgL(&y504, "12345678-abcd-1234-ef00-1234567890ab");
25Variable* y504Temp =
26 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.

Sensor Variable Counts

The number of variables that can be returned by a Yosemitech Y504

#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_DOpct(YosemitechY504* parentSense, const char* uuid = "", const char* varCode = "Y504DOpct") 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_Temp(YosemitechY504* parentSense, const char* uuid = "", const char* varCode = "Y504Temp") 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_DOmgL(YosemitechY504* parentSense, const char* uuid = "", const char* varCode = "Y504DOmgL") 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".

Define documentation

#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.


#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.


#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".


#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".


#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".