Yosemitech Y510 Turbidity Sensor topic

Classes for the Yosemitech Y510 turbidity sensor.

Sensor Datasheet

Sensor Constructor

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

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

1#include <sensors/YosemitechY510.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 y510ModbusAddress = 0x0B; // The modbus address of the Y510
8const int8_t y510AdapterPower = sensorPowerPin; // RS485 adapter power pin
9const int8_t y510SensorPower = A3; // Sensor power pin
10const int8_t y510EnablePin = -1; // Adapter RE/DE pin
11const uint8_t y510NumberReadings = 5;
12// The manufacturer recommends averaging 10 readings, but we take 5 to minimize
13// power consumption
14
15// Create a Y510-B Turbidity sensor object
16YosemitechY510 y510(y510ModbusAddress, modbusSerial, y510AdapterPower,
17 y510SensorPower, y510EnablePin, y510NumberReadings);
18
19// Create turbidity and temperature variable pointers for the Y510
20Variable* y510Turb =
21 new YosemitechY510_Turbidity(&y510, "12345678-abcd-1234-ef00-1234567890ab");
22Variable* y510Temp =
23 new YosemitechY510_Temp(&y510, "12345678-abcd-1234-ef00-1234567890ab");

Classes

class YosemitechY510
The Sensor sub-class for the Yosemitech Y510-B optical turbidity sensor.
class YosemitechY510_Turbidity
The Variable sub-class used for the turbidity output from a Yosemitech Y510-B optical turbidity sensor.
class YosemitechY510_Temp
The Variable sub-class used for the temperature output from a Yosemitech Y510-B optical turbidity sensor.

Sensor Variable Counts

The number of variables that can be returned by a Yosemitch Y510

#define Y510_NUM_VARIABLES = 2
Sensor::_numReturnedValues; the Y510 can report 2 values.
#define Y510_INC_CALC_VARIABLES = 0
Sensor::_incCalcValues; we don't calculate any additional values.

Sensor Timing

The sensor timing for a Yosemitch Y510

#define Y510_WARM_UP_TIME_MS = 500
Sensor::_warmUpTime_ms; time before sensor responds after power - 500ms.
#define Y510_STABILIZATION_TIME_MS = 22000
Sensor::_stabilizationTime_ms; time between "StartMeasurement" command and stable reading - 22sec (22000ms).
#define Y510_MEASUREMENT_TIME_MS = 1700
Sensor::_measurementTime_ms; the Y510 takes ~1700ms to complete a measurement.

Turbidity

The turbidity variable from a Yosemitch Y510

  • Range is 0.1 to 1000 NTU
  • Accuracy is ± 5 % or 0.3 NTU

YosemitechY510_Turbidity::YosemitechY510_Turbidity(YosemitechY510* parentSense, const char* uuid = "", const char* varCode = "Y510Turbidity") explicit

Construct a new YosemitechY510_Turbidity object.

Parameters
parentSense The parent YosemitechY510 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 "Y510Turbidity".

#define Y510_TURB_RESOLUTION = 2
Decimals places in string representation; turbidity should have 2 - resolution is 0.01 NTU.
#define Y510_TURB_VAR_NUM = 0
Sensor variable number; turbidity is stored in sensorValues[0].
#define Y510_TURB_VAR_NAME = "turbidity"
Variable name in ODM2 controlled vocabulary; "turbidity".
#define Y510_TURB_UNIT_NAME = "nephelometricTurbidityUnit"
Variable unit name in ODM2 controlled vocabulary; "nephelometricTurbidityUnit" (NTU)
#define Y510_TURB_DEFAULT_CODE = "Y510Turbidity"
Default variable short code; "Y510Turbidity".

Temperature

The temperature variable from a Yosemitch Y510

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

YosemitechY510_Temp::YosemitechY510_Temp(YosemitechY510* parentSense, const char* uuid = "", const char* varCode = "Y510Temp") explicit

Construct a new YosemitechY510_Temp object.

Parameters
parentSense The parent YosemitechY510 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 "Y510Temp".

#define Y510_TEMP_RESOLUTION = 1
Decimals places in string representation; temperature should have 1 - resolution is 0.1°C.
#define Y510_TEMP_VAR_NUM = 1
Sensor variable number; temperature is stored in sensorValues[1].
#define Y510_TEMP_VAR_NAME = "temperature"
Variable name in ODM2 controlled vocabulary; "temperature".
#define Y510_TEMP_UNIT_NAME = "degreeCelsius"
Variable unit name in ODM2 controlled vocabulary; "degreeCelsius" (°C)
#define Y510_TEMP_DEFAULT_CODE = "Y510Temp"
Default variable short code; "Y510Temp".

Define documentation

#define Y510_NUM_VARIABLES = 2

Sensor::_numReturnedValues; the Y510 can report 2 values.


#define Y510_INC_CALC_VARIABLES = 0

Sensor::_incCalcValues; we don't calculate any additional values.


#define Y510_WARM_UP_TIME_MS = 500

Sensor::_warmUpTime_ms; time before sensor responds after power - 500ms.


#define Y510_STABILIZATION_TIME_MS = 22000

Sensor::_stabilizationTime_ms; time between "StartMeasurement" command and stable reading - 22sec (22000ms).


#define Y510_MEASUREMENT_TIME_MS = 1700

Sensor::_measurementTime_ms; the Y510 takes ~1700ms to complete a measurement.


#define Y510_TURB_RESOLUTION = 2

Decimals places in string representation; turbidity should have 2 - resolution is 0.01 NTU.


#define Y510_TURB_VAR_NUM = 0

Sensor variable number; turbidity is stored in sensorValues[0].


#define Y510_TURB_VAR_NAME = "turbidity"

Variable name in ODM2 controlled vocabulary; "turbidity".


#define Y510_TURB_UNIT_NAME = "nephelometricTurbidityUnit"

Variable unit name in ODM2 controlled vocabulary; "nephelometricTurbidityUnit" (NTU)


#define Y510_TURB_DEFAULT_CODE = "Y510Turbidity"

Default variable short code; "Y510Turbidity".


#define Y510_TEMP_RESOLUTION = 1

Decimals places in string representation; temperature should have 1 - resolution is 0.1°C.


#define Y510_TEMP_VAR_NUM = 1

Sensor variable number; temperature is stored in sensorValues[1].


#define Y510_TEMP_VAR_NAME = "temperature"

Variable name in ODM2 controlled vocabulary; "temperature".


#define Y510_TEMP_UNIT_NAME = "degreeCelsius"

Variable unit name in ODM2 controlled vocabulary; "degreeCelsius" (°C)


#define Y510_TEMP_DEFAULT_CODE = "Y510Temp"

Default variable short code; "Y510Temp".