API Reference

ADS122C04

CircuitPython driver for the Adafruit ADS122C04 24-Bit ADC - 4 Channel 2-kSPS - STEMMA QT / Qwiic

  • Author(s): Liz Clark

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_ads122c04.ads122c04.ADS122C04(i2c: busio.I2C, address: int = _DEFAULT_ADDR)

Driver for the ADS122C04 24-bit ADC.

Parameters:
  • i2c (I2C) – The I2C bus the ADS122C04 is connected to.

  • address (int) – The I2C device address. Default is 0x40.

property burn_out_current: bool

Burn-out current sources. True to enable 10 µA burn-out current.

property continuous_mode: bool

Conversion mode. True for continuous, False for single-shot.

static convert_to_temperature(raw_data: int) float

Convert a raw ADC reading to temperature (when in temperature sensor mode).

Parameters:

raw_data (int) – Signed 24-bit raw ADC value.

Returns:

Temperature in degrees Celsius.

Return type:

float

convert_to_voltage(raw_data: int) float

Convert a raw ADC reading to voltage.

Parameters:

raw_data (int) – Signed 24-bit raw ADC value.

Returns:

Voltage in volts.

Return type:

float

property crc_mode: int

CRC mode selection. Use one of the CRC_* constants.

Note

Setting this property also updates the internal cache used by read_data() and the register read/write helpers.

property data_counter_enabled: bool

Data counter. True to enable, False to disable.

property data_rate: int

Data rate selection. Use one of the RATE_* constants.

property data_ready: bool

True if new conversion data is ready. Read-only.

property effective_gain: float

The effective gain considering PGA bypass and single-ended restrictions.

In single-ended mode the PGA is automatically bypassed and gain is limited to 1, 2, or 4. Read-only.

property gain: int

Gain configuration. Use one of the GAIN_* constants.

property idac1_route: int

IDAC1 routing selection. Use one of the IDAC_ROUTE_* constants.

property idac2_route: int

IDAC2 routing selection. Use one of the IDAC_ROUTE_* constants.

property idac_current: int

IDAC current selection. Use one of the IDAC_* constants.

property last_data_valid: bool

True if the most recent read_data() passed integrity validation.

property mux: int

Input multiplexer configuration. Use one of the MUX_* constants.

property pga: bool

PGA enable. True to enable PGA, False to bypass.

Note: the hardware register bit is PGA_BYPASS, so the sense is inverted.

power_down() None

Enter power-down mode.

read_data() int

Read the raw 24-bit ADC conversion result.

Returns:

Signed 24-bit conversion result.

Return type:

int

Raises:

IOError – If CRC or data integrity validation fails.

read_voltage() float

Read the ADC and return the value as a voltage.

Returns:

Voltage in volts.

Return type:

float

property reference_voltage: float

Reference voltage used for voltage conversion calculations, in volts.

Defaults to 2.048 V (the internal reference). Set this to match your external reference if using VREF_EXTERNAL or VREF_SUPPLY.

reset() None

Reset the ADS122C04 to default settings.

start_sync() None

Start or sync a conversion.

temperature() float

Read the internal temperature sensor.

The temperature sensor must be enabled before calling this method.

Returns:

Temperature in degrees Celsius.

Return type:

float

property temperature_sensor: bool

Temperature sensor mode. True to enable, False to disable.

property turbo_mode: bool

Turbo mode. True for turbo, False for normal.

property vref_input: int

Voltage reference selection. Use one of the VREF_* constants.

adafruit_ads122c04.ads122c04.CRC_CRC16 = 2

CRC16 enabled.

adafruit_ads122c04.ads122c04.CRC_DISABLED = 0

CRC disabled.

adafruit_ads122c04.ads122c04.CRC_INVERTED = 1

Inverted data output.

adafruit_ads122c04.ads122c04.GAIN_1 = 0

Gain = 1.

adafruit_ads122c04.ads122c04.GAIN_128 = 7

Gain = 128.

adafruit_ads122c04.ads122c04.GAIN_16 = 4

Gain = 16.

adafruit_ads122c04.ads122c04.GAIN_2 = 1

Gain = 2.

adafruit_ads122c04.ads122c04.GAIN_32 = 5

Gain = 32.

adafruit_ads122c04.ads122c04.GAIN_4 = 2

Gain = 4.

adafruit_ads122c04.ads122c04.GAIN_64 = 6

Gain = 64.

adafruit_ads122c04.ads122c04.GAIN_8 = 3

Gain = 8.

adafruit_ads122c04.ads122c04.IDAC_1000UA = 6

1000 µA.

adafruit_ads122c04.ads122c04.IDAC_100UA = 3

100 µA.

adafruit_ads122c04.ads122c04.IDAC_10UA = 1

10 µA.

adafruit_ads122c04.ads122c04.IDAC_1500UA = 7

1500 µA.

adafruit_ads122c04.ads122c04.IDAC_250UA = 4

250 µA.

adafruit_ads122c04.ads122c04.IDAC_500UA = 5

500 µA.

adafruit_ads122c04.ads122c04.IDAC_50UA = 2

50 µA.

adafruit_ads122c04.ads122c04.IDAC_OFF = 0

IDAC off.

adafruit_ads122c04.ads122c04.IDAC_ROUTE_AIN0 = 1

IDAC connected to AIN0.

adafruit_ads122c04.ads122c04.IDAC_ROUTE_AIN1 = 2

IDAC connected to AIN1.

adafruit_ads122c04.ads122c04.IDAC_ROUTE_AIN2 = 3

IDAC connected to AIN2.

adafruit_ads122c04.ads122c04.IDAC_ROUTE_AIN3 = 4

IDAC connected to AIN3.

adafruit_ads122c04.ads122c04.IDAC_ROUTE_DISABLED = 0

IDAC disabled.

adafruit_ads122c04.ads122c04.IDAC_ROUTE_REFN = 6

IDAC connected to REFN.

adafruit_ads122c04.ads122c04.IDAC_ROUTE_REFP = 5

IDAC connected to REFP.

adafruit_ads122c04.ads122c04.MUX_AIN0 = 8

AIN0 vs AVSS.

Type:

Single-ended

adafruit_ads122c04.ads122c04.MUX_AIN0_AIN1 = 0

AINP=AIN0, AINN=AIN1.

Type:

Differential

adafruit_ads122c04.ads122c04.MUX_AIN0_AIN2 = 1

AINP=AIN0, AINN=AIN2.

Type:

Differential

adafruit_ads122c04.ads122c04.MUX_AIN0_AIN3 = 2

AINP=AIN0, AINN=AIN3.

Type:

Differential

adafruit_ads122c04.ads122c04.MUX_AIN1 = 9

AIN1 vs AVSS.

Type:

Single-ended

adafruit_ads122c04.ads122c04.MUX_AIN1_AIN0 = 3

AINP=AIN1, AINN=AIN0.

Type:

Differential

adafruit_ads122c04.ads122c04.MUX_AIN1_AIN2 = 4

AINP=AIN1, AINN=AIN2.

Type:

Differential

adafruit_ads122c04.ads122c04.MUX_AIN1_AIN3 = 5

AINP=AIN1, AINN=AIN3.

Type:

Differential

adafruit_ads122c04.ads122c04.MUX_AIN2 = 10

AIN2 vs AVSS.

Type:

Single-ended

adafruit_ads122c04.ads122c04.MUX_AIN2_AIN3 = 6

AINP=AIN2, AINN=AIN3.

Type:

Differential

adafruit_ads122c04.ads122c04.MUX_AIN3 = 11

AIN3 vs AVSS.

Type:

Single-ended

adafruit_ads122c04.ads122c04.MUX_AIN3_AIN2 = 7

AINP=AIN3, AINN=AIN2.

Type:

Differential

adafruit_ads122c04.ads122c04.MUX_REFPN_4 = 12

(REFP-REFN)/4 monitor.

adafruit_ads122c04.ads122c04.MUX_SHORTED = 14

Inputs shorted to (AVDD+AVSS)/2.

adafruit_ads122c04.ads122c04.MUX_SUPPLY_4 = 13

(AVDD-AVSS)/4 monitor.

adafruit_ads122c04.ads122c04.RATE_1000SPS = 6

1000 SPS (normal) / 2000 SPS (turbo).

adafruit_ads122c04.ads122c04.RATE_175SPS = 3

175 SPS (normal) / 350 SPS (turbo).

adafruit_ads122c04.ads122c04.RATE_20SPS = 0

20 SPS (normal) / 40 SPS (turbo).

adafruit_ads122c04.ads122c04.RATE_330SPS = 4

330 SPS (normal) / 660 SPS (turbo).

adafruit_ads122c04.ads122c04.RATE_45SPS = 1

45 SPS (normal) / 90 SPS (turbo).

adafruit_ads122c04.ads122c04.RATE_600SPS = 5

600 SPS (normal) / 1200 SPS (turbo).

adafruit_ads122c04.ads122c04.RATE_90SPS = 2

90 SPS (normal) / 180 SPS (turbo).

adafruit_ads122c04.ads122c04.VREF_EXTERNAL = 1

External reference (REFP/REFN).

adafruit_ads122c04.ads122c04.VREF_INTERNAL = 0

Internal 2.048V reference.

adafruit_ads122c04.ads122c04.VREF_SUPPLY = 2

Analog supply (AVDD-AVSS).

AnalogIn

AnalogIn for ADC readings.

  • Author(s): Liz Clark

class adafruit_ads122c04.analog_in.AnalogIn(adc: ADS122C04, pin: int)

AnalogIn-compatible wrapper for ADS122C04 single-ended readings.

Provides a value property scaled to a 16-bit unsigned range [0, 65535] and a voltage property in volts, matching the CircuitPython analogio.AnalogIn API.

Parameters:
  • adc (ADS122C04) – The ADS122C04 driver instance.

  • pin (int) – Single-ended channel (0-3).

property value: int

ADC reading as an unsigned 16-bit integer in the range [0, 65535].

The 24-bit signed result is clamped to the positive range and then scaled to 16 bits to match the analogio.AnalogIn API.

property voltage: float

ADC reading as a voltage in volts.