UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

ADS1015 Class

Module: ads1x15

The ADS1013, ADS1014, and ADS1015 are precision analog-to-digital converters (ADCs) with 12 bits of resolution offered in an ultra-small, leadless QFN-10 package or an MSOP-10 package. The ADS1013/4/5 are designed with precision, power, and ease of implementation in mind. The ADS1013/4/5 feature an onboard reference and oscillator. Data is transferred via an I2C-compatible serial interface; four I2C slave addresses can be selected. The ADS1013/4/5 operate from a single power supply ranging from 2.0V to 5.5V. The ADS1013/4/5 can perform conversions at rates up to 3300 samples per second (SPS). An onboard PGA is available on the ADS1014 and ADS1015 that offers input ranges from the supply to as low as +/- 256mV, allowing both large and small signals to be measured with high resolution. The ADS1015 also features an input multiplexer (MUX) that provides two differential or four single-ended inputs. The ADS1013/4/5 operate either in continuous conversion mode or a single-shot mode that automatically powers down after a conversion and greatly reduces current consumption during idle periods. The ADS1013/4/5 are specified from -40 deg C to +125 deg C.
Tested with Adafriut ADS1015 board: https://www.adafruit.com/products/1083
ads1015.jpg

Methods

ADS1015

(
  • bus
  • address
  • vref
)
Number

ADS1015 constructor
This constructor includes a vref parameter that can be used to set gain so it matches full scale value of input

Parameters:

  • bus Number

    i2c bus the sensor is attached to.

  • address Number

    Optional device address. Default is 0x48.

  • vref Number

    Optional reference (i.e. half full swing) voltage. Default is 2.048V

Returns:

Number:

setSPS

(
  • rate
)

Sets the sample rate of the device. This function needs to be overridden in subclasses as the ADS1115 and ADS1015 have different sample rates.

Parameters:

  • rate ADSSAMPLERATE

    ADSSAMPLERATE enum

getNumInputs

() Number

Get number of inputs

Returns:

Number:

number of inputs

getRawValue

(
  • input
)
Number

Read current value for current single ended analogue input

Parameters:

  • input Number

    undefined

Returns:

Number:

current conversion value

getVoltage

(
  • input
)
Number

Read current voltage for current single ended analogue input

Parameters:

  • input Number

    undefined

Returns:

Number:

current voltage

getResolutionInBits

() Number

Read current voltage for current single ended analogue input

Returns:

Number:

current voltage

getModuleName

() String

Returns module name

Returns:

String:

modulename as const char*

Properties

SPS_128

Enum ADSSAMPLERATE

SPS_250

Enum ADSSAMPLERATE

SPS_490

Enum ADSSAMPLERATE

SPS_920

Enum ADSSAMPLERATE

SPS_1600

Enum ADSSAMPLERATE

SPS_2400

Enum ADSSAMPLERATE

SPS_3300

Enum ADSSAMPLERATE