Skip to main content

Module ads1115

Module ads1115 

Source
Expand description

Texas Instruments ADS1115 16-bit I2C analog-to-digital converter.

The ADS1115 turns an analog signal (a soil-moisture probe, a pH electrode, a divider) into a 16-bit reading, and a single Config register selects the input, the gain, the rate, and the comparator. This module builds and parses that Config register field by field and converts a raw conversion result into a voltage at the selected full-scale range, following the datasheet’s register tables and per-gain LSB sizes.

Modules§

address
The I2C addresses the ADDR pin selects, by what it is tied to.
register
The ADS1115 register addresses, selected by the address pointer.
sim
An ADS1115 that is not there.

Structs§

Ads1115
An ADS1115 on an I2C bus, converting one input on demand.
Config
A decoded ADS1115 Config register.
Sample
One conversion result with the gain it was taken at, so it converts to volts.

Enums§

ComparatorLatch
Whether the comparator latches (Config bit 2).
ComparatorMode
The comparator mode (Config bit 4).
ComparatorPolarity
The ALERT/RDY pin polarity (Config bit 3).
ComparatorQueue
The comparator queue, or disable (Config bits 1:0).
DataRate
The output data rate (Config bits 7:5), in samples per second.
Mode
The conversion mode (Config bit 8).
Mux
The input multiplexer setting (Config bits 14:12).
Pga
The programmable gain amplifier’s full-scale range (Config bits 11:9).

Constants§

CONFIG_RESET
The power-on value of the Config register (0x8583).
CONVERSION_POLLS
How many times the Config register is polled, 1 ms apart, after the conversion time has elapsed before the conversion is called overdue.
POWER_UP_MICROS
The time from a stable supply until the part accepts a transfer, in microseconds.

Functions§

conversion_micros
The longest one conversion takes at a data rate, in microseconds.
to_nanovolts
Converts a raw conversion result to nanovolts at the selected full-scale range.
to_volts
Converts a raw conversion result to volts at the selected full-scale range.