Yosemitech Y532 pH Sensor topic

Classes for the Yosemitech Y532 pH sensor.

Sensor Datasheet

Sensor Constructor

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

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

1#include <sensors/YosemitechY532.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 y532ModbusAddress = 0x32; // The modbus address of the Y532
8const int8_t y532AdapterPower = sensorPowerPin; // RS485 adapter power pin
9const int8_t y532SensorPower = A3; // Sensor power pin
10const int8_t y532EnablePin = 4; // Adapter RE/DE pin
11const uint8_t y532NumberReadings = 1;
12// The manufacturer actually doesn't mention averaging for this one
13
14// Create a Yosemitech Y532 pH sensor object
15YosemitechY532 y532(y532ModbusAddress, modbusSerial, y532AdapterPower,
16 y532SensorPower, y532EnablePin, y532NumberReadings);
17
18// Create pH, electrical potential, and temperature variable pointers for the
19// Y532
20Variable* y532Voltage =
21 new YosemitechY532_Voltage(&y532, "12345678-abcd-1234-ef00-1234567890ab");
22Variable* y532pH =
23 new YosemitechY532_pH(&y532, "12345678-abcd-1234-ef00-1234567890ab");
24Variable* y532Temp =
25 new YosemitechY532_Temp(&y532, "12345678-abcd-1234-ef00-1234567890ab");

Classes

class YosemitechY532
The Sensor sub-class for the Yosemitech Y532-A digital pH sensor.
class YosemitechY532_pH
The Variable sub-class used for the pH output from a Yosemitech Y532-A digital pH sensor.
class YosemitechY532_Temp
The Variable sub-class used for the temperature output from a Yosemitech Y532-A digital pH sensor.
class YosemitechY532_Voltage
The Variable sub-class used for the electrode electrical potential output from a Yosemitech Y532-A digital pH sensor.

Sensor Variable Counts

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

#define Y532_NUM_VARIABLES = 3
Sensor::_numReturnedValues; the Y532 can report 3 values.
#define Y532_INC_CALC_VARIABLES = 0
Sensor::_incCalcValues; we don't calculate any additional values.

Sensor Timing

The sensor timing for a Yosemitch Y532

#define Y532_WARM_UP_TIME_MS = 500
Sensor::_warmUpTime_ms; time before sensor responds after power - 500ms.
#define Y532_STABILIZATION_TIME_MS = 4500
Sensor::_stabilizationTime_ms; time between "StartMeasurement" command and stable reading - 4.5sec (4500ms).
#define Y532_MEASUREMENT_TIME_MS = 1800
Sensor::_measurementTime_ms; the Y532 takes ~1800ms to complete a measurement.

pH

The pH variable from a Yosemitch Y532

  • Range is 2 to 12 pH units
  • Accuracy is ± 0.1 pH units

YosemitechY532_pH::YosemitechY532_pH(YosemitechY532* parentSense, const char* uuid = "", const char* varCode = "Y532pH") explicit

Construct a new YosemitechY532_pH object.

Parameters
parentSense The parent YosemitechY532 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 "Y532pH".

#define Y532_PH_RESOLUTION = 2
Decimals places in string representation; pH should have 2 - resolution is 0.01 pH units.
#define Y532_PH_VAR_NUM = 0
Sensor variable number; pH is stored in sensorValues[0].
#define Y532_PH_VAR_NAME = "pH"
Variable name in ODM2 controlled vocabulary; "pH".
#define Y532_PH_UNIT_NAME = "pH"
Variable unit name in ODM2 controlled vocabulary; "pH" (dimensionless pH units)
#define Y532_PH_DEFAULT_CODE = "Y532pH"
Default variable short code; "Y532pH".

Temperature

The temperature variable from a Yosemitch Y532

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

YosemitechY532_Temp::YosemitechY532_Temp(YosemitechY532* parentSense, const char* uuid = "", const char* varCode = "Y532Temp") explicit

Construct a new YosemitechY532_Temp object.

Parameters
parentSense The parent YosemitechY532 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 "Y532Temp".

#define Y532_TEMP_RESOLUTION = 1
Decimals places in string representation; temperature should have 1 - resolution is 0.1°C.
#define Y532_TEMP_VAR_NUM = 1
Sensor variable number; temperature is stored in sensorValues[1].
#define Y532_TEMP_VAR_NAME = "temperature"
Variable name in ODM2 controlled vocabulary; "temperature".
#define Y532_TEMP_UNIT_NAME = "degreeCelsius"
Variable unit name in ODM2 controlled vocabulary; "degreeCelsius" (°C)
#define Y532_TEMP_DEFAULT_CODE = "Y532Temp"
Default variable short code; "Y532Temp".

Voltage

The voltage variable from a Yosemitch Y532

  • Range is -999 ~ 999 mV
  • Accuracy is ± 20 mV

YosemitechY532_Voltage::YosemitechY532_Voltage(YosemitechY532* parentSense, const char* uuid = "", const char* varCode = "Y532Potential") explicit

Construct a new YosemitechY532_Voltage object.

Parameters
parentSense The parent YosemitechY532 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 "Y532Potential".

#define Y532_VOLTAGE_RESOLUTION = 0
Decimals places in string representation; voltage should have 0 - resolution is 1mV.
#define Y532_VOLTAGE_VAR_NUM = 2
Sensor variable number; voltage is stored in sensorValues[2].
#define Y532_VOLTAGE_VAR_NAME = "voltage"
Variable name in ODM2 controlled vocabulary; "voltage".
#define Y532_VOLTAGE_UNIT_NAME = "millivolt"
Variable unit name in ODM2 controlled vocabulary; "millivolt" (mV)
#define Y532_VOLTAGE_DEFAULT_CODE = "Y532Potential"
Default variable short code; "Y532Potential".

Define documentation

#define Y532_NUM_VARIABLES = 3

Sensor::_numReturnedValues; the Y532 can report 3 values.


#define Y532_INC_CALC_VARIABLES = 0

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


#define Y532_WARM_UP_TIME_MS = 500

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


#define Y532_STABILIZATION_TIME_MS = 4500

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


#define Y532_MEASUREMENT_TIME_MS = 1800

Sensor::_measurementTime_ms; the Y532 takes ~1800ms to complete a measurement.


#define Y532_PH_RESOLUTION = 2

Decimals places in string representation; pH should have 2 - resolution is 0.01 pH units.


#define Y532_PH_VAR_NUM = 0

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


#define Y532_PH_UNIT_NAME = "pH"

Variable unit name in ODM2 controlled vocabulary; "pH" (dimensionless pH units)


#define Y532_PH_DEFAULT_CODE = "Y532pH"

Default variable short code; "Y532pH".


#define Y532_TEMP_RESOLUTION = 1

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


#define Y532_TEMP_VAR_NUM = 1

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


#define Y532_TEMP_VAR_NAME = "temperature"

Variable name in ODM2 controlled vocabulary; "temperature".


#define Y532_TEMP_UNIT_NAME = "degreeCelsius"

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


#define Y532_TEMP_DEFAULT_CODE = "Y532Temp"

Default variable short code; "Y532Temp".


#define Y532_VOLTAGE_RESOLUTION = 0

Decimals places in string representation; voltage should have 0 - resolution is 1mV.


#define Y532_VOLTAGE_VAR_NUM = 2

Sensor variable number; voltage is stored in sensorValues[2].


#define Y532_VOLTAGE_UNIT_NAME = "millivolt"

Variable unit name in ODM2 controlled vocabulary; "millivolt" (mV)


#define Y532_VOLTAGE_DEFAULT_CODE = "Y532Potential"

Default variable short code; "Y532Potential".