ModularSensors > Classes > Sensor > KellerParent
ModularSensors > Modules > Keller Water Level Sensors > KellerParent


KellerParent class

The Sensor sub-class for all Keller water level sensors.

Base classes

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

Derived classes

class KellerAcculevel
The Sensor sub-class for the Keller Acculevel sensor.
class KellerNanolevel
The Sensor sub-class for the Keller nanolevel sensor.

Constructors, destructors, conversion operators

KellerParent(byte modbusAddress, Stream* stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, kellerModel model = OTHER, const char* sensName = "Keller-Sensor", uint8_t numVariables = 3, uint32_t warmUpTime_ms = 500, uint32_t stabilizationTime_ms = 5000, uint32_t measurementTime_ms = 1500)
Construct a new Keller Parent object. This is only intended to be used within this library.
KellerParent(byte modbusAddress, Stream& stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, kellerModel model = OTHER, const char* sensName = "Keller-Sensor", uint8_t numVariables = 3, uint32_t warmUpTime_ms = 500, uint32_t stabilizationTime_ms = 5000, uint32_t measurementTime_ms = 1500)
Construct a new Keller Parent object. This is only intended to be used within this library.
~KellerParent() virtual
Destroy the Keller Parent object - no action taken.

Public functions

String getSensorLocation(void ) override
Get the pin or connection location between the mcu and the sensor.
bool setup(void ) override
Do any one-time preparations needed before the sensor will be able to take readings.
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 ) override
Get the results from a single measurement.

Function documentation

KellerParent(byte modbusAddress, Stream* stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, kellerModel model = OTHER, const char* sensName = "Keller-Sensor", uint8_t numVariables = 3, uint32_t warmUpTime_ms = 500, uint32_t stabilizationTime_ms = 5000, uint32_t measurementTime_ms = 1500)

Construct a new Keller 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 Keller sensor. 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 Keller sensor.
sensName The name of the sensor. Defaults to "Keller-Sensor".
numVariables The number of variable results returned by the sensor. Defaults to 3.
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 500.
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 5,000.
measurementTime_ms The time in ms between when a measurement is started and when the result value is available. Defaults to 1,500.

KellerParent(byte modbusAddress, Stream& stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, kellerModel model = OTHER, const char* sensName = "Keller-Sensor", uint8_t numVariables = 3, uint32_t warmUpTime_ms = 500, uint32_t stabilizationTime_ms = 5000, uint32_t measurementTime_ms = 1500)

Construct a new Keller 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 Keller sensor. 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 Keller sensor.
sensName The name of the sensor. Defaults to "Keller-Sensor".
numVariables The number of variable results returned by the sensor. Defaults to 3.
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 500.
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 5,000.
measurementTime_ms The time in ms between when a measurement is started and when the result value is available. Defaults to 1,500.

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


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