Campbell OBS3+ topic
- Introduction
- Sensor Datasheet
- Build flags
- Sensor Constructor
- Example Code
- Reference
- Detailed Descriptions
Classes for the Campbell OBS3+ analog turbidity sensor.
Introduction
The OBS-3+ puts out a simple analog signal between 0 and 2.5V. When the sensor is purchased, included in the packaging is a calibration certificate to use to convert the voltage into turbidity.
The OBS3+ supports two different turbidity ranges. The low and high range signals are read independently of each other - the signals are on different wires. Each range has a separate calibrations.
Before applying any turbidity calibration, the analog output from the OBS3+ must be converted into a high resolution digital signal. See the ADS1115 page for details on the conversion.
Sensor Datasheet
Build flags
-D MS_USE_ADS1015
- switches from the 16-bit ADS1115 to the 12 bit ADS1015
Sensor Constructor
Construct a new Campbell OBS3 object - need the power pin, the ADS1X15 data channel, and the calibration info. The pin on the mcu controlling power to the OBS3+ Use -1 if it is continuously powered.
CampbellOBS3::
Parameters
powerPin
adsChannel
The analog data channel on the TI ADS1115 that the OBS3 is connected to (0-3).
x2_coeff_A
The x2 (A) coefficient for the calibration in volts
x1_coeff_B
The x (B) coefficient for the calibration in volts
x0_coeff_C
The x0 (C) coefficient for the calibration in volts
i2cAddress
The I2C address of the ADS 1x15, default is 0x48 (ADDR = GND)
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 Campbell OBS3+ is used in the menu a la carte example.
Classes
- class CampbellOBS3
- The Sensor sub-class for the Campbell OBS3 analog turbidity sensor.
- class CampbellOBS3_Turbidity
- The Variable sub-class used for the turbidity output from a Campbell OBS3+.
- class CampbellOBS3_Voltage
- The Variable sub-class used for the raw voltage output from a Campbell OBS3+.
Sensor Variable Counts
The number of variables that can be returned by OBS3
- #define OBS3_NUM_VARIABLES = 2
- Sensor::
_numReturnedValues; the OBS3 can report 2 values. - #define OBS3_INC_CALC_VARIABLES = 1
- Sensor::
_incCalcValues; turbidity is calculated from raw voltage using the input calibration equation.
Configuration Defines
Defines to set the address of the ADD.
- #define ADS1115_ADDRESS = 0x48
- The assumed address of the ADS1115, 1001 000 (ADDR = GND)
Sensor Timing
The sensor timing for an OBS3+
- #define OBS3_WARM_UP_TIME_MS = 2
- Sensor::
_warmUpTime_ms; the ADS1115 warms up in 2ms. - #define OBS3_STABILIZATION_TIME_MS = 2000
- Sensor::
_stabilizationTime_ms; minimum stabilization time for the OBS3 is 2s (2000ms). - #define OBS3_MEASUREMENT_TIME_MS = 100
- Sensor::
_measurementTime_ms; OBS3 takes 100ms to complete a measurement - Maximum data rate = 10Hz (100ms/sample).
Turbidity
The turbidity variable from an OBS3+
- Range: (depends on sediment size, particle shape, and reflectivity)
- Turbidity (low/high):
- T1: 250/1000 NTU
- T2: 500/2000 NTU
- T3: 1000/4000 NTU
- Mud: 5000 to 10,000 mg L–1
- Sand: 50,000 to 100,000 mg L–1
- Turbidity (low/high):
- Accuracy: (whichever is larger)
- Turbidity: 2% of reading or 0.5 NTU
- Mud: 2% of reading or 1 mg L–1
- Sand: 4% of reading or 10 mg L–1
- Resolution:
- 16-bit ADC, Turbidity:
- T1: 0.03125/0.125 NTU
- T2: 0.0625/0.25 NTU
- T3: 0.125/0.5 NTU
- OBS3_
RESOLUTION = 5
- 12-bit ADC, Turbidity:
- T1: 0.5/2.0 NTU
- T2: 1.0/4.0 NTU
- T3: 2.0/8.0 NTU
- OBS3_
RESOLUTION = 1
- 16-bit ADC, Turbidity:
Construct a new CampbellOBS3_
CampbellOBS3_
Parameters
parentSense
The parent CampbellOBS3 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 "OBS3Turbidity".
- #define OBS3_TURB_VAR_NUM = 0
- Variable number; turbidity is stored in sensorValues[0].
- #define OBS3_RESOLUTION = 5
- Decimals places in string representation; turbidity should have 5.
- #define OBS3_TURB_VAR_NAME = "turbidity"
- Variable name in ODM2 controlled vocabulary; "turbidity".
- #define OBS3_TURB_UNIT_NAME = "nephelometricTurbidityUnit"
- Variable unit name in ODM2 controlled vocabulary; "nephelometricTurbidityUnit" (NTU)
- #define OBS3_TURB_DEFAULT_CODE = "OBS3Turbidity"
- Default variable short code; "OBS3Turbidity".
Voltage
The voltage variable from an OBS3+
- Range is 0 to 2.5V
- Accuracy:
- 16-bit ADC (ADS1115): < 0.25% (gain error), < 0.25 LSB (offset errror)
- 12-bit ADC (ADS1015, using build flag
MS_USE_ADS1015
): < 0.15% (gain error), < 3 LSB (offset errror)
Construct a new CampbellOBS3_
CampbellOBS3_
Parameters
parentSense
The parent CampbellOBS3 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 "OBS3Voltage".
- #define OBS3_VOLTAGE_VAR_NUM = 1
- Variable number; voltage is stored in sensorValues[1].
- #define OBS3_VOLTAGE_VAR_NAME = "voltage"
- Variable name in ODM2 controlled vocabulary; "voltage".
- #define OBS3_VOLTAGE_UNIT_NAME = "volt"
- Variable unit name in ODM2 controlled vocabulary; "volt".
- #define OBS3_VOLTAGE_DEFAULT_CODE = "OBS3Voltage"
- Default variable short code; "OBS3Voltage".
- #define OBS3_VOLTAGE_RESOLUTION = 4
- Decimals places in string representation; voltage should have 4.
Define documentation
#define OBS3_NUM_VARIABLES = 2
#include <src/sensors/CampbellOBS3.h>
Sensor::
Low and high range are treated as completely independent, so only 2 "variables" are measured by each sensor - one for the raw voltage and another for the calibrated turbidity. To get both high and low range values, create two sensor objects!
#define OBS3_INC_CALC_VARIABLES = 1
#include <src/sensors/CampbellOBS3.h>
Sensor::
#define ADS1115_ADDRESS = 0x48
#include <src/sensors/CampbellOBS3.h>
The assumed address of the ADS1115, 1001 000 (ADDR = GND)
#define OBS3_WARM_UP_TIME_MS = 2
#include <src/sensors/CampbellOBS3.h>
Sensor::
#define OBS3_STABILIZATION_TIME_MS = 2000
#include <src/sensors/CampbellOBS3.h>
Sensor::
#define OBS3_MEASUREMENT_TIME_MS = 100
#include <src/sensors/CampbellOBS3.h>
Sensor::
#define OBS3_TURB_VAR_NUM = 0
#include <src/sensors/CampbellOBS3.h>
Variable number; turbidity is stored in sensorValues[0].
#define OBS3_RESOLUTION = 5
#include <src/sensors/CampbellOBS3.h>
Decimals places in string representation; turbidity should have 5.
#define OBS3_TURB_VAR_NAME = "turbidity"
#include <src/sensors/CampbellOBS3.h>
Variable name in ODM2 controlled vocabulary; "turbidity".
#define OBS3_TURB_UNIT_NAME = "nephelometricTurbidityUnit"
#include <src/sensors/CampbellOBS3.h>
Variable unit name in ODM2 controlled vocabulary; "nephelometricTurbidityUnit" (NTU)
#define OBS3_TURB_DEFAULT_CODE = "OBS3Turbidity"
#include <src/sensors/CampbellOBS3.h>
Default variable short code; "OBS3Turbidity".
#define OBS3_VOLTAGE_VAR_NUM = 1
#include <src/sensors/CampbellOBS3.h>
Variable number; voltage is stored in sensorValues[1].
#define OBS3_VOLTAGE_VAR_NAME = "voltage"
#include <src/sensors/CampbellOBS3.h>
Variable name in ODM2 controlled vocabulary; "voltage".
#define OBS3_VOLTAGE_UNIT_NAME = "volt"
#include <src/sensors/CampbellOBS3.h>
Variable unit name in ODM2 controlled vocabulary; "volt".
#define OBS3_VOLTAGE_DEFAULT_CODE = "OBS3Voltage"
#include <src/sensors/CampbellOBS3.h>
Default variable short code; "OBS3Voltage".
#define OBS3_VOLTAGE_RESOLUTION = 4
#include <src/sensors/CampbellOBS3.h>
Decimals places in string representation; voltage should have 4.
- Resolution:
- 12-bit ADC (ADS1015, using build flag
MS_USE_ADS1015
): 2 mV
- 12-bit ADC (ADS1015, using build flag