ModularSensors > Classes > Sensor > CampbellOBS3
ModularSensors > Modules > Campbell OBS3+ > CampbellOBS3


CampbellOBS3 class

The Sensor sub-class for the Campbell OBS3 analog turbidity 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!

Base classes

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

Constructors, destructors, conversion operators

CampbellOBS3(int8_t powerPin, uint8_t adsChannel, float x2_coeff_A, float x1_coeff_B, float x0_coeff_C, uint8_t i2cAddress = ADS1115_ADDRESS, uint8_t measurementsToAverage = 1)
Construct a new Campbell OBS3 object - need the power pin, the ADS1X15 data channel, and the calibration info.
~CampbellOBS3()
Destroy the Campbell OBS3 object.

Public functions

String getSensorLocation(void ) override
Get the pin or connection location between the mcu and the sensor.
bool addSingleMeasurementResult(void ) override
Get the results from a single measurement.

Function documentation

CampbellOBS3(int8_t powerPin, uint8_t adsChannel, float x2_coeff_A, float x1_coeff_B, float x0_coeff_C, uint8_t i2cAddress = ADS1115_ADDRESS, uint8_t measurementsToAverage = 1)

Construct a new Campbell OBS3 object - need the power pin, the ADS1X15 data channel, and the calibration info.

Parameters
powerPin

The pin on the mcu controlling power to the OBS3+ Use -1 if it is continuously powered.

  • The ADS1x15 requires an input voltage of 2.0-5.5V, but this library assumes the ADS is powered with 3.3V.
  • The OBS-3 itself requires a 5-15V power supply, which can be turned off between measurements.
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.

StringgetSensorLocation(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.

booladdSingleMeasurementResult(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.