YosemitechParent class

The Sensor sub-class for all the Yosemitech sensors.

Base classes

class Sensor
The "Sensor" class is used for all sensor-level operations - waking, sleeping, and taking measurements.

Derived classes

class YosemitechY4000
The Sensor sub-class for the Yosemitech Y4000 multiparameter sonde.
class YosemitechY504
The Sensor sub-class for the Yosemitech Y502-A or Y504-A optical dissolved oxygen sensors.
class YosemitechY510
The Sensor sub-class for the Yosemitech Y510-B optical turbidity sensor.
class YosemitechY511
The Sensor sub-class for the Yosemitech Y511-A optical turbidity sensor with wiper.
class YosemitechY513
The Sensor sub-class for the Yosemitech Y513 sensor.
class YosemitechY514
The Sensor sub-class for the Yosemitech Y514 sensor.
class YosemitechY520
The Sensor sub-class for the Yosemitech Y520-A 4-electrode conductivity sensor.
class YosemitechY532
The Sensor sub-class for the Yosemitech Y532-A digital pH sensor.
class YosemitechY533
The Sensor sub-class for the Yosemitech Y533 ORP sensor.
class YosemitechY551
The Sensor sub-class for the Yosemitech Y551-B UV254/COD sensor with wiper.
class YosemitechY560
The Sensor sub-class for the Yosemitech Y560-A digital pH sensor.
class YosemitechY700
The Sensor sub-class for the Yosemitech Y700 pressure sensor.

Constructors, destructors, conversion operators

YosemitechParent(byte modbusAddress, Stream* stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, yosemitechModel model = UNKNOWN, const char* sensName = "Yosemitech-Sensor", uint8_t numVariables = 2, uint32_t warmUpTime_ms = 1500, uint32_t stabilizationTime_ms = 20000, uint32_t measurementTime_ms = 2000, uint8_t incCalcValues = 0)
Construct a new Yosemitech Parent object. This is only intended to be used within this library.
YosemitechParent(byte modbusAddress, Stream& stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, yosemitechModel model = UNKNOWN, const char* sensName = "Yosemitech-Sensor", uint8_t numVariables = 2, uint32_t warmUpTime_ms = 1500, uint32_t stabilizationTime_ms = 20000, uint32_t measurementTime_ms = 2000, uint8_t incCalcValues = 0)
Construct a new Yosemitech Parent object. This is only intended to be used within this library.
~YosemitechParent() virtual
Destroy the Yosemitech Parent object - no action taken.

Public functions

String getSensorLocation(void) -> String override
Get the pin or connection location between the mcu and the sensor.
bool setup(void) -> bool override
Do any one-time preparations needed before the sensor will be able to take readings.
bool wake(void) -> bool override
Wake the sensor up, if necessary. Do whatever it takes to get a sensor in the proper state to begin a measurement.
bool sleep(void) -> bool override
Puts the sensor to sleep, if necessary.
void powerUp(void) override
Turn on the sensor power, if applicable.
void powerDown(void) override
Turn off the sensor power, if applicable.
bool addSingleMeasurementResult(void) -> bool override
Get the results from a single measurement.

Function documentation

YosemitechParent::YosemitechParent(byte modbusAddress, Stream* stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, yosemitechModel model = UNKNOWN, const char* sensName = "Yosemitech-Sensor", uint8_t numVariables = 2, uint32_t warmUpTime_ms = 1500, uint32_t stabilizationTime_ms = 20000, uint32_t measurementTime_ms = 2000, uint8_t incCalcValues = 0)

Construct a new Yosemitech Parent object. This is only intended to be used within this library.

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 Yosemitech. 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. An RS485 adapter with integrated flow control is strongly recommended.
measurementsToAverage The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.
model The model of Yosemitech sensor.
sensName The name of the sensor. Defaults to "SDI12-Sensor".
numVariables The number of variable results returned by the sensor. Defaults to 2.
warmUpTime_ms The time in ms between when the sensor is powered on and when it is ready to receive a wake command. Defaults to 1500.
stabilizationTime_ms The time in ms between when the sensor receives a wake command and when it is able to return stable values. Defaults to 20,000 (20s).
measurementTime_ms The time in ms between when a measurement is started and when the result value is available. Defaults to 2000.
incCalcValues The number of included calculated variables from the sensor, if any. These are used for values that we would always calculate for a sensor and depend only on the raw results of that single sensor; optional with a default value of 0.

YosemitechParent::YosemitechParent(byte modbusAddress, Stream& stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, yosemitechModel model = UNKNOWN, const char* sensName = "Yosemitech-Sensor", uint8_t numVariables = 2, uint32_t warmUpTime_ms = 1500, uint32_t stabilizationTime_ms = 20000, uint32_t measurementTime_ms = 2000, uint8_t incCalcValues = 0)

Construct a new Yosemitech Parent object. This is only intended to be used within this library.

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 Yosemitech. 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. An RS485 adapter with integrated flow control is strongly recommended.
measurementsToAverage The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1.
model The model of Yosemitech sensor.
sensName The name of the sensor. Defaults to "SDI12-Sensor".
numVariables The number of variable results returned by the sensor. Defaults to 2.
warmUpTime_ms The time in ms between when the sensor is powered on and when it is ready to receive a wake command. Defaults to 1500.
stabilizationTime_ms The time in ms between when the sensor receives a wake command and when it is able to return stable values. Defaults to 20,000 (20s).
measurementTime_ms The time in ms between when a measurement is started and when the result value is available. Defaults to 2000.
incCalcValues The number of included calculated variables from the sensor, if any. These are used for values that we would always calculate for a sensor and depend only on the raw results of that single sensor; optional with a default value of 0.

String YosemitechParent::getSensorLocation(void) override

Get the pin or connection location between the mcu and the sensor.

Returns String Text describing how the sensor is attached to the mcu.

bool YosemitechParent::setup(void) override

Do any one-time preparations needed before the sensor will be able to take readings.

Returns bool True if the setup was successful.

This sets pin modes on the _powerPin, adapter power, and adapter enable pins. It also sets the expected stream timeout for modbus and updates the _sensorStatus. No sensor power is required. This will always return true.


bool YosemitechParent::wake(void) override

Wake the sensor up, if necessary. Do whatever it takes to get a sensor in the proper state to begin a measurement.

Returns bool True if the wake function completed successfully.

Verifies that the power is on and updates the _sensorStatus. This also sets the _millisSensorActivated timestamp.


bool YosemitechParent::sleep(void) override

Puts the sensor to sleep, if necessary.

Returns bool True if the sleep function completed successfully.

This also un-sets the _millisSensorActivated timestamp (sets it to 0). This does NOT power down the sensor!


void YosemitechParent::powerUp(void) override

Turn on the sensor power, if applicable.

Generally this is done by setting the _powerPin HIGH. Also sets the _millisPowerOn timestamp and updates the _sensorStatus.


void YosemitechParent::powerDown(void) override

Turn off the sensor power, if applicable.

Generally this is done by setting the _powerPin LOW. Also un-sets the _millisPowerOn timestamp (sets _millisPowerOn to 0) and updates the _sensorStatus.


bool YosemitechParent::addSingleMeasurementResult(void) override

Get the results from a single measurement.

Returns bool True if the function completed successfully.

This asks the sensor for a new result, verifies that it passes sanity range checks, and then adds the value to the result array.

This also un-sets the _millisMeasurementRequested timestamp (sets _millisMeasurementRequested to 0) and updates the _sensorStatus.