Skip to main content

ADS1219 24-bit ADC - Channel Selection

This page covers selecting which of the ADS1219's four input channels (or which differential pair) actually gets converted, using the input multiplexer.


Connections

Connect the ADS1219 board via Qwiic, and wire REFP/REFN to your chosen reference (see Single-Shot Reading for reference-voltage options).

Connect a signal source to AIN0 and GND - this example reads AIN0 single-ended, but any of the mux options below can be swapped in instead.


Selecting a channel

#include <Wire.h>
#include "ADS1219-SOLDERED.h"

ADS1219_Soldered adc;

void setup()
{
Serial.begin(115200);
Wire.begin();

while (!adc.begin())
{
Serial.println("ADS1219 not found. Check wiring! Retrying...");
delay(1000);
}

// Use REFP/REFN as the reference (tie them to VCC/GND, or a precision source)
adc.setVoltageReference(ADS1219_VREF_EXTERNAL);

// AIN0 vs GND (single-ended)
adc.setMux(ADS1219_MUX_SINGLE_0);
}

void loop()
{
if (!adc.startSync())
{
Serial.println("Failed to start conversion. Check wiring! Retrying...");
delay(1000);
return;
}

while (!adc.dataReady())
delay(10);

adc.readConversion();

// 3300.0f is the reference voltage in millivolts (3.3V here) - change this
// to match whatever you actually wired to REFP/REFN
float mV = adc.getConversionMillivolts(3300.0f);

Serial.print("Voltage (mV): ");
Serial.println(mV, 3);
}

adc.setMux()

Selects which input channel or differential pair is routed to the ADC.

Returns value: Boolean value, true on success.

Function parameters:

TypeNameDescription
ads1219_mux_tmuxADS1219_MUX_SINGLE_0 through _3 for single-ended channels (each measured against GND), ADS1219_MUX_DIFF_P0_N1 / _P1_N2 / _P2_N3 for differential pairs, or ADS1219_MUX_SHORTED to measure the internal offset (AVDD/2 vs itself).
ℹ️
Swap ADS1219_MUX_SINGLE_0 for any of the other mux constants to read a different channel or pair - everything else in the sketch stays the same. ADS1219_MUX_DIFF_P0_N1 (AIN0 vs AIN1) is the default at power-on.

Open the Serial Monitor at 115200 baud to see the reading for whichever channel you selected.

Below are the Serial Monitor outputs from swapping in ADS1219_MUX_SINGLE_1, ADS1219_MUX_SINGLE_2, and ADS1219_MUX_SINGLE_3 in turn - reading AIN1, AIN2, and AIN3 the same way, with nothing else in the sketch changed.

Serial Monitor output reading AIN1
ADS1219_MUX_SINGLE_1 - reading AIN1 vs GND
Serial Monitor output reading AIN2
ADS1219_MUX_SINGLE_2 - reading AIN2 vs GND
Serial Monitor output reading AIN3
ADS1219_MUX_SINGLE_3 - reading AIN3 vs GND

Multiplexer.ino

Full input-multiplexer example for the ADS1219 24-bit ADC