Turner Turbidity Plus topic

Classes for the Turner Turbidity Plus sensor.

Sensor Datasheet

Datasheet

Build flags

  • -D MS_USE_ADS1015
    • switches from the 16-bit ADS1115 to the 12 bit ADS1015

Sensor Constructor

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.

  • The ADS1x15 requires an input voltage of 2.0-5.5V
  • The Turbidity Plus itself requires a 3-15V power supply, which can be turned off between measurements.
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_adsDiffMux_t
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.


Example Code

The Alphasense CO2 sensor is used in the menu a la carte example.

1#include <sensors/TurnerTurbidityPlus.h>
2
3// NOTE: Use -1 for any pins that don't apply or aren't being used.
4const int8_t turbidityPlusPower = sensorPowerPin; // Power pin
5const int8_t turbidityPlusWiper = A3; // Wiper pin
6ttp_adsDiffMux_t turbidityPlusDiffMux = DIFF_MUX_2_3; // Differential voltage config
7const uint8_t turbidityPlusNumberReadings = 10;
8const uint8_t turbidityPlusADSi2c_addr = 0x48; // The I2C address of the ADS1115 ADC
9adsGain_t turbidityPlusGain = GAIN_ONE;// The gain of the ADS
10float tpVoltageDividerFactor = 1; // The factor for a voltage divider, if any
11
12// Turbidity Plus calibration information
13const float turbidityPlusStdConc = 1.000; // Concentration of the standard used
14 // for a 1-point sensor calibration.
15const float turbidityPlusStdVolt =
16 1.000; // The voltage (in volts) measured for the conc_std.
17const float turbidityPlusBlankVolt =
18 0.000; // The voltage (in volts) measured for a blank.
19
20// Create a Turner Turbidity Plus sensor object
21TurnerTurbidityPlus turbidityPlus(turbidityPlusPower, turbidityPlusWiper, turbidityPlusDiffMux,turbidityPlusStdConc,
22 turbidityPlusStdVolt, turbidityPlusBlankVolt, turbidityPlusADSi2c_addr,turbidityPlusGain,
23 turbidityPlusNumberReadings,tpVoltageDividerFactor);
24
25// Create the variable pointers
26Variable* turbidityPlusVoltage =
27 new TurnerTurbidityPlus_Voltage(&turbidityPlus, "12345678-abcd-1234-ef00-1234567890ab");
28Variable* turbidityPlusTurbidity = new TurnerTurbidityPlus_Turbidity(
29 &turbidityPlus, "12345678-abcd-1234-ef00-1234567890ab");

Classes

class TurnerTurbidityPlus
The Sensor sub-class for the Turner Turbidity Plus turbiditysensor".
class TurnerTurbidityPlus_Voltage
The Variable sub-class used for the [raw voltage output](sensor_turbidity_plus_voltage) from a [Turner Turbidity Plus](Turner Turbidity Plus).
class TurnerTurbidityPlus_Turbidity
The Variable sub-class used for the turbidity output from a Turner Turbidity Plus.

Configuration Defines

Defines to set the address of the ADD.

enum ttp_adsDiffMux_t: uint16_t { DIFF_MUX_0_1, DIFF_MUX_0_3, DIFF_MUX_1_3, DIFF_MUX_2_3 }
Enum for the pins used for differential voltages.
#define ADS1115_ADDRESS = 0x48
The assumed address of the ADS1115, 1001 000 (ADDR = GND)

Sensor Variable Counts

The number of variables that can be returned by Turbidity Plus

#define TURBIDITY_PLUS_NUM_VARIABLES = 2
Sensor::_numReturnedValues; the Turbidity Plus can report 2 values.
#define TURBIDITY_PLUS_INC_CALC_VARIABLES = 1
Sensor::_incCalcValues; turbidity is calculated from raw voltage using the input calibration equation.

Sensor Timing

The sensor timing for an Turbidity Plus

#define TURBIDITY_PLUS_WARM_UP_TIME_MS = 2
Sensor::_warmUpTime_ms; the ADS1115 warms up in 2ms.
#define TURBIDITY_PLUS_STABILIZATION_TIME_MS = 3000
Sensor::_stabilizationTime_ms; Turner states that it takes 3 sec settling time from power-on.
#define TURBIDITY_PLUS_MEASUREMENT_TIME_MS = 0
Sensor::_measurementTime_ms; the ADS1115 completes 860 conversions per second, but the wait for the conversion to complete is built into the underlying library, so we do not need to wait further here.

Calibrated Turbidity Output

The primary turbidity output from an Turbidity Plus

#define TURBIDITY_PLUS_VAR_NUM = 0
Variable number; the primary variable is stored in sensorValues[0].
#define TURBIDITY_PLUS_VAR_NAME = "turbidity"
Variable name in ODM2 controlled vocabulary; "turbidity".
#define TURBIDITY_PLUS_UNIT_NAME = "nephelometricTurbidityUnit"
Variable unit name in ODM2 controlled vocabulary; "nephelometricTurbidityUnit" (NTU)
#define TURBIDITY_PLUS_DEFAULT_CODE = "TurnerTurbidity"
Default variable short code; "TurnerTurbidity".
#define TURBIDITY_PLUS_RESOLUTION = 5
Decimals places in string representation; 5.

Voltage

The voltage variable from an Turbidity Plus

  • Range is 0 to 3.6V when using an ADS1x15 powered at 3.3V
    • Full sensor range is 0-5V
  • Accuracy:

TurnerTurbidityPlus_Voltage::TurnerTurbidityPlus_Voltage(TurnerTurbidityPlus* parentSense, const char* uuid = "", const char* varCode = "TurbidityPlusVoltage") explicit

Construct a new TurnerTurbidityPlus_Voltage object.

Parameters
parentSense The parent TurnerTurbidityPlus 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 "TurnerVoltage".

#define TURBIDITY_PLUS_VOLTAGE_VAR_NUM = 1
Variable number; voltage is stored in sensorValues[1].
#define TURBIDITY_PLUS_VOLTAGE_VAR_NAME = "voltage"
Variable name in ODM2 controlled vocabulary; "voltage".
#define TURBIDITY_PLUS_VOLTAGE_UNIT_NAME = "volt"
Variable unit name in ODM2 controlled vocabulary; "volt" (V)
#define TURBIDITY_PLUS_VOLTAGE_DEFAULT_CODE = "TurbidityPlusVoltage"
Default variable short code; "TurbidityPlusVoltage".
#define TURBIDITY_PLUS_VOLTAGE_RESOLUTION = 4
Decimals places in string representation; voltage should have 4.

Enum documentation

enum ttp_adsDiffMux_t: uint16_t

Enum for the pins used for differential voltages.

Enumerators
DIFF_MUX_0_1

differential across pins 0 and 1

DIFF_MUX_0_3

differential across pins 0 and 3

DIFF_MUX_1_3

differential across pins 1 and 3

DIFF_MUX_2_3

differential across pins 2 and 3


Define documentation

#define ADS1115_ADDRESS = 0x48

The assumed address of the ADS1115, 1001 000 (ADDR = GND)


#define TURBIDITY_PLUS_NUM_VARIABLES = 2

Sensor::_numReturnedValues; the Turbidity Plus can report 2 values.


#define TURBIDITY_PLUS_INC_CALC_VARIABLES = 1

Sensor::_incCalcValues; turbidity is calculated from raw voltage using the input calibration equation.


#define TURBIDITY_PLUS_STABILIZATION_TIME_MS = 3000

Sensor::_stabilizationTime_ms; Turner states that it takes 3 sec settling time from power-on.


#define TURBIDITY_PLUS_MEASUREMENT_TIME_MS = 0

Sensor::_measurementTime_ms; the ADS1115 completes 860 conversions per second, but the wait for the conversion to complete is built into the underlying library, so we do not need to wait further here.


#define TURBIDITY_PLUS_VAR_NUM = 0

Variable number; the primary variable is stored in sensorValues[0].


#define TURBIDITY_PLUS_UNIT_NAME = "nephelometricTurbidityUnit"

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


#define TURBIDITY_PLUS_DEFAULT_CODE = "TurnerTurbidity"

Default variable short code; "TurnerTurbidity".


#define TURBIDITY_PLUS_RESOLUTION = 5

Decimals places in string representation; 5.


#define TURBIDITY_PLUS_VOLTAGE_VAR_NUM = 1

Variable number; voltage is stored in sensorValues[1].


#define TURBIDITY_PLUS_VOLTAGE_DEFAULT_CODE = "TurbidityPlusVoltage"

Default variable short code; "TurbidityPlusVoltage".


#define TURBIDITY_PLUS_VOLTAGE_RESOLUTION = 4

Decimals places in string representation; voltage should have 4.

  • Resolution:
    • 12-bit ADC (ADS1015, using build flag MS_USE_ADS1015): 2 mV