ModularSensors > Files > src / sensors / TIADS1x15.h

TIADS1x15.h file

This file contains the TIADS1x15 sensor subclass and the TIADS1x15_Voltage variable subclass.

These are used for any voltage measureable on a TI ADS1115 or ADS1015. There is a multiplier allowed for a voltage divider between the raw voltage and the ADS.

This depends on the soligen2010 fork of the Adafruit ADS1015 library.

Classes

class TIADS1x15
The Sensor sub-class for the external votlage as measured by TI ADS1115 or ADS1015.
class TIADS1x15_Voltage
The Variable sub-class used for the voltage output from a TI ADS1115 or ADS1015.

Typedefs

using ExternalVoltage = TIADS1x15 deprecated in v0.33.0
typedef for backwards compatibility; use the TIADS1x15 class in new code
using ExternalVoltage_Volt = TIADS1x15_Voltage deprecated in v0.33.0
typedef for backwards compatibility; use the TIADS1x15_Voltage class in new code

Defines

#define TIADS1X15_NUM_VARIABLES = 1
Sensor::_numReturnedValues; the ADS1115 can report 1 value.
#define TIADS1X15_INC_CALC_VARIABLES = 0
Sensor::_incCalcValues; we don't calculate any additional values.
#define ADS1115_ADDRESS = 0x48
The assumed address of the ADS1115, 1001 000 (ADDR = GND)

Sensor Timing

The sensor timing for a TI ADS1x15 analog-to-digital converter (ADC) The timing used for simple external voltage measurements is that of the ADS1x15.

#define TIADS1X15_WARM_UP_TIME_MS = 2
Sensor::_warmUpTime_ms; the ADS1115 warms up in 2ms.
#define TIADS1X15_STABILIZATION_TIME_MS = 0
Sensor::_stabilizationTime_ms; the ADS1115 is stable 0ms after warm-up.
#define TIADS1X15_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.

Voltage

The volt variable from a TI ADS1x15 analog-to-digital converter (ADC)

  • Range:
    • without voltage divider: 0 - 3.6V [when ADC is powered at 3.3V]
    • 1/gain = 3x: 0.3 ~ 12.9V
    • 1/gain = 10x: 1 ~ 43V
  • 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)
  • Resolution:
    • 16-bit ADC (ADS1115):
    • 12-bit ADC (ADS1015, using build flag MS_USE_ADS1015):

TIADS1x15_Voltage(TIADS1x15* parentSense, const char* uuid = "", const char* varCode = TIADS1X15_DEFAULT_CODE) explicit

Construct a new TIADS1x15_Voltage object.

Parameters
parentSense The parent TIADS1x15 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 "extVoltage".

#define TIADS1X15_VAR_NUM = 0
Variable number; voltage is stored in sensorValues[0].
#define TIADS1X15_VAR_NAME = "voltage"
Variable name in ODM2 controlled vocabulary; "voltage".
#define TIADS1X15_UNIT_NAME = "volt"
Variable unit name in ODM2 controlled vocabulary; "volt".
#define TIADS1X15_DEFAULT_CODE = "extVoltage"
Default variable short code; "extVoltage".
#define TIADS1X15_RESOLUTION = 4
Decimals places in string representation; voltage should have 4.