API Reference
ads1x15
CircuitPython base class driver for ADS1015/1115 ADCs.
Author(s): Carter Nelson
- class adafruit_ads1x15.ads1x15.ADS1x15(i2c: I2C, gain: float = 1, data_rate: int | None = None, mode: int = 256, comparator_queue_length: int = 0, comparator_low_threshold: int = -32768, comparator_high_threshold: int = 32767, comparator_mode: int = 0, comparator_polarity: int = 0, comparator_latch: int = 0, address: int = 72)[source]
Base functionality for ADS1x15 analog to digital converters.
- Parameters:
i2c (I2C) – The I2C bus the device is connected to.
gain (float) – The ADC gain.
data_rate (int) – The data rate for ADC conversion in samples per second. Default value depends on the device.
mode (Mode) – The conversion mode, defaults to
Mode.SINGLE.comparator_queue_length (int) – The number of successive conversions exceeding the comparator threshold before asserting ALERT/RDY pin. Defaults to 0 (comparator function disabled).
comparator_low_threshold (int) – Voltage limit under which comparator de-asserts ALERT/RDY pin. Must be lower than high threshold to use comparator function. Range of -32768 to 32767, default -32768
comparator_high_threshold (int) – Voltage limit over which comparator asserts ALERT/RDY pin. Must be higher than low threshold to use comparator function. Range of -32768 to 32767, default 32767
comparator_mode (Comp_Mode) – Configures the comparator as either traditional or window. Defaults to ‘Comp_Mode.TRADITIONAL’
comparator_polarity (Comp_Polarity) – Configures the comparator output as either active low or active high. Defaults to ‘Comp_Polarity.ACTIVE_LOW’
comparator_latch (Comp_Latch) – Configures the comparator output to only stay asserted while readings exceed threshold or latch on assertion until data is read. Defaults to ‘Comp_Latch.NONLATCHING’
address (int) – The I2C address of the device.
- class adafruit_ads1x15.ads1x15.Comp_Latch[source]
An enum-like class representing possible ADC Comparator latching modes.
- LATCHING = 4
ALERT_RDY pin remains asserted until data is read by controller
- NONLATCHING = 0
ALERT_RDY pin does not latch when asserted
- class adafruit_ads1x15.ads1x15.Comp_Mode[source]
An enum-like class representing possible ADC Comparator operating modes.
- TRADITIONAL = 0
Traditional Compartor Mode activates above high threshold, de-activates below low
- WINDOW = 16
Window Comparator Mode activates when reading is outside of high and low thresholds
- class adafruit_ads1x15.ads1x15.Comp_Polarity[source]
An enum-like class representing possible ADC Comparator polarity modes.
- ACTIVE_HIGH = 8
ALERT_RDY pin is HIGH when comparator is active
- ACTIVE_LOW = 0
ALERT_RDY pin is LOW when comparator is active
- class adafruit_ads1x15.ads1x15.Mode[source]
An enum-like class representing possible ADC operating modes.
- CONTINUOUS = 0
Continuous Mode
- SINGLE = 256
Single-Shot Mode
- class adafruit_ads1x15.ads1x15.Pin[source]
An enum-like class representing possible ADC pins.
- A0 = 0
Analog Pin 0
- A1 = 1
Analog Pin 1
- A2 = 2
Analog Pin 2
- A3 = 3
Analog Pin 3
ads1015
CircuitPython driver for ADS1015 ADCs.
Author(s): Carter Nelson
- class adafruit_ads1x15.ads1015.ADS1015(i2c: I2C, gain: float = 1, data_rate: int | None = None, mode: int = 256, comparator_queue_length: int = 0, comparator_low_threshold: int = -32768, comparator_high_threshold: int = 32767, comparator_mode: int = 0, comparator_polarity: int = 0, comparator_latch: int = 0, address: int = 72)[source]
Class for the ADS1015 12 bit ADC.
ads1115
CircuitPython driver for 1115 ADCs.
Author(s): Carter Nelson
- class adafruit_ads1x15.ads1115.ADS1115(i2c: I2C, gain: float = 1, data_rate: int | None = None, mode: int = 256, comparator_queue_length: int = 0, comparator_low_threshold: int = -32768, comparator_high_threshold: int = 32767, comparator_mode: int = 0, comparator_polarity: int = 0, comparator_latch: int = 0, address: int = 72)[source]
Class for the ADS1115 16 bit ADC.
analog_in
AnalogIn for single-ended and differential ADC readings.
Author(s): Carter Nelson, adapted from MCP3xxx original by Brent Rubell
- class adafruit_ads1x15.analog_in.AnalogIn(ads: ADS1x15, positive_pin: int, negative_pin: int | None = None)[source]
AnalogIn Mock Implementation for ADC Reads.
- Parameters:
- convert_to_value(volts: float) int[source]
Calculates a standard 16-bit integer value for a given voltage