#include <src/sensors/TurnerTurbidityPlus.h>
TurnerTurbidityPlus
class
The Sensor sub-class for the Turner Turbidity Plus turbiditysensor".
- Reference
- Detailed Descriptions
Base classes
- class Sensor
- The "Sensor" class is used for all sensor-level operations - waking, sleeping, and taking measurements.
Constructors, destructors, conversion operators
-
TurnerTurbidityPlus(int8_t powerPin,
int8_t wiperTriggerPin,
ttp_
adsDiffMux_ t adsDiffMux, float conc_std, float volt_std, float volt_blank, uint8_t i2cAddress = 0x48, adsGain_t PGA_gain = GAIN_ONE, uint8_t measurementsToAverage = 1, float voltageDividerFactor = 1) - Construct a new Turner Turbidity Plus object - need the power pin, the ADS1X15 data channel, and the calibration info.
- ~TurnerTurbidityPlus()
- Destroy the Turner Turbidity Plus object.
Public functions
- String getSensorLocation(void) -> String override
- Get the pin or connection location between the mcu and the sensor.
- void runWiper(void)
- Run one wiper cycle.
- 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.
- 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
TurnerTurbidityPlus:: TurnerTurbidityPlus(int8_t powerPin,
int8_t wiperTriggerPin,
ttp_ adsDiffMux_ t adsDiffMux,
float conc_std,
float volt_std,
float volt_blank,
uint8_t i2cAddress = 0x48,
adsGain_t PGA_gain = GAIN_ONE,
uint8_t measurementsToAverage = 1,
float voltageDividerFactor = 1)
Construct a new Turner Turbidity Plus object - need the power pin, the ADS1X15 data channel, and the calibration info.
Parameters | |
---|---|
powerPin | The pin on the mcu controlling power to the Turbidity Plus Use -1 if it is continuously powered.
|
wiperTriggerPin | The pin on the mcu that triggers the sensor's wiper. |
adsDiffMux | Which two pins on the TI ADS1115 that will measure differential voltage. See ttp_ |
conc_std | The concentration of the standard used for a 1-point sensor calibration. The concentration units should be the same as the final measuring units. |
volt_std | The voltage (in volts) measured for the conc_std. This voltage should be the final voltage after accounting for any voltage dividers or gain settings. |
volt_blank | The voltage (in volts) measured for a blank. This voltage should be the final voltage after accounting for any voltage |
i2cAddress | The I2C address of the ADS 1x15, default is 0x48 (ADDR = GND) |
PGA_gain | The programmable gain amplification to set on the ADS 1x15, default is GAIN_ONE (0-4.096V). |
measurementsToAverage | The number of measurements to take and average before giving a "final" result from the sensor; optional with a default value of 1. |
voltageDividerFactor | For 3.3V processors like the Mayfly, The Turner's 0-5V output signal must be shifted down to a maximum of 3.3V. This can be done either either with a level-shifting chip (e.g. Adafruit BSS38), OR by connecting the Turner's output signal via a voltage divider. This voltageDividerFactor is used for the latter case: e.g., a divider that uses 2 matched resistors will halve the voltage reading and requires a voltageDividerFactor of 2. The default value is 1. |
String TurnerTurbidityPlus:: 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 TurnerTurbidityPlus:: setup(void) override
Do any one-time preparations needed before the sensor will be able to take readings.
Returns | bool bool True if the setup was successful. |
---|
This sets pin mode on the wiper trigger pin
bool TurnerTurbidityPlus:: 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 _
void TurnerTurbidityPlus:: powerUp(void) override
Turn on the sensor power, if applicable.
Generally this is done by setting the _HIGH
. Also sets the _
void TurnerTurbidityPlus:: powerDown(void) override
Turn off the sensor power, if applicable.
Generally this is done by setting the _LOW
. Also un-sets the _
bool TurnerTurbidityPlus:: 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 _