Ads1115 Class

Definition

Analog-to-Digital Converter ADS1115

public class Ads1115 : IDisposable
type Ads1115 = class
    interface IDisposable
Public Class Ads1115
Implements IDisposable
Inheritance
Ads1115
Implements

Constructors

Ads1115(I2cDevice, GpioController, Int32, Boolean, InputMultiplexer, MeasuringRange, DataRate, DeviceMode)

Initialize a new Ads1115 device connected through I2C with an additional GPIO controller for interrupt handling.

Ads1115(I2cDevice, InputMultiplexer, MeasuringRange, DataRate)
Ads1115(I2cDevice, InputMultiplexer, MeasuringRange, DataRate, DeviceMode)

Initialize a new Ads1115 device connected through I2C

Properties

ComparatorLatching

Comparator latching mode. If enabled, the ALRT/RDY Pin will be kept signaled until the conversion value is read. Only relevant when the comparator is enabled.

ComparatorMode

Comparator mode. Only relevant if the comparator trigger event is set up and is changed by EnableComparator(Int16, Int16, ComparatorMode, ComparatorQueue).

ComparatorPolarity

Comparator polarity. Indicates whether the rising or the falling edge of the ALRT/RDY Pin is relevant. Default: Low (falling edge)

ComparatorQueue

Minimum number of samples exceeding the lower/upper threshold before the ALRT pin is asserted. This can only be set with EnableComparator(Int16, Int16, ComparatorMode, ComparatorQueue).

DataRate

ADS1115 Data Rate. The number of conversions per second that will take place. One conversion will take "1/rate" seconds to become ready. If in power-down mode, only one conversion will happen automatically, then another request is required. Setting this property will wait until a new value is available.

DeviceMode

ADS1115 operation mode. When set to Continuous the chip continously measures the input and the values can be read directly. If set to PowerDown the chip enters idle mode after each conversion and a new value will be requested each time a read request is performed. This is the recommended setting when frequently swapping between input channels, because a change of the channel requires a new conversion anyway.

InputMultiplexer

ADS1115 Input Multiplexer. This selects the channel(s) for the next read operation, InputMultiplexer. Setting this property will wait until a value is available from the newly selected input channel.

MeasuringRange

ADS1115 Programmable Gain Amplifier This sets the maximum value that can be measured. Regardless of this setting, the input value on any pin must not exceed VDD + 0.3V, so high ranges are only usable with a VDD of more than 5V. Setting this property will wait until a new value is available.

Methods

Dispose()

Cleanup. Failing to dispose this class, especially when callbacks are active, may lead to undefined behavior.

EnableComparator(ElectricPotential, ElectricPotential, ComparatorMode, ComparatorQueue)

Enable comparator callback mode. In traditional comparator mode, the callback is triggered each time the measured value exceeds the given upper value (for the given queueLength number of samples). It deasserts when the lower value is reached. In window comparator mode, the callback is triggered each time the measured value exceeds the given upper value or gets less than the given lower value.

EnableComparator(Int16, Int16, ComparatorMode, ComparatorQueue)

Enable comparator callback mode. In traditional comparator mode, the callback is triggered each time the measured value exceeds the given upper value (for the given queueLength number of samples). It deasserts when the lower value is reached. In window comparator mode, the callback is triggered each time the measured value exceeds the given upper value or gets less than the given lower value.

EnableConversionReady()

Enable conversion ready event. The AlertReadyAsserted event fires each time a new value is available after this method is called.

FrequencyFromDataRate(DataRate)

Returns the sampling frequency in Hz for the given data rate enumeration member.

MaxVoltageFromMeasuringRange(MeasuringRange)

Returns the voltage assigned to the given MeasuringRange enumeration value.

RawToVoltage(Int16)

Convert Raw Data to Voltage

ReadRaw()

Read Raw Data. If in PowerDown (single-shot) mode, one new sample is requested first.

ReadRaw(InputMultiplexer)

Reads the next raw value, first switching to the given input and ranges.

ReadRaw(InputMultiplexer, MeasuringRange, DataRate)

Reads the next raw value, first switching to the given input and ranges.

ReadVoltage()

Returns the electric potential (voltage) of the currently selected input.

ReadVoltage(InputMultiplexer)

Returns the electric potential (voltage) of the given channel, performs a measurement first

VoltageToRaw(ElectricPotential)

Converts voltage to raw data.

Events

AlertReadyAsserted

This event fires when a new value is available (in conversion ready mode) or the comparator threshold is exceeded. Requires setup through EnableConversionReady() or EnableComparator(ElectricPotential, ElectricPotential, ComparatorMode, ComparatorQueue).

Applies to