Skip to content

Introduction

Qwiic ADC Banner Image

The SparkFun Qwiic 24 Bit ADC - 4 Channel (ADS1219) is a simple Qwiic breakout board for the ADS1219 Analog-to-Digital converter. This breakout lets you add four channels of I2C controlled ADC input to your project. The ADS1219's channels can be used as single-ended inputs or in pairs for differential inputs and run at sample rates of up to 1kHz. The ADC also has a programmable gain amplifier (x1 or x4) to allow you to "zoom in" on very small changes in analog voltage (though this affects the input range and resolution). The ADS1219 has an internal 2.048V reference voltage but also allows for an external reference via the REFP/REFN PTH pads broken out on the board. This breakout naturally routes the power and I2C lines to a pair of Qwiic connectors for easy integration into a Qwiic circuit. Lastly, this breakout nets both of the ADS1219's supply voltages (analog/AVDD and digital/DVDD) to a single input but you can provide your own analog by opening the 3V3/VDDA jumper and connecting a voltage supply to the VDDA PTH pad.

In this guide we'll cover everything you need to familiarize yourself with this Qwiic breakout, assemble it into a Qwiic circuit and how to use it with the SparkFun ADS1219 Arduino Library.

Required Materials

In order to use this Qwiic breakout board, you'll need the following materials:

Quick Start Materials

If you'd like to build the demo circuit in the Quick Start guide you'll need the following extra items:

Topics Covered

This guide contains three main sections: Quickstart Guide, Hardware and Software.

The Quickstart Guide goes over a simple demo circuit for the Qwiic ADC - AS1219 using a flex sensor to read voltage changes using the SparkFun ADS1219 Arduino Library. This section assumes a working knowledge of how to use a development board with Arduino, through-hole soldering and building prototype circuits using a breadboard.

The Hardware section provides a detailed overview of the ADS1219 and other hardware present on the Qwiic 24 Bit ADC as well as instructions on assembling it into a Qwiic circuit.

The Software section covers how to install the SparkFun AS1219 Arduino Library along with brief overviews of some of the examples included in the library.

Resources and Support Documentation

You'll find the board design files (KiCad files & schematic), relevant documentation (datasheets, white papers, etc.) and other helpful links in the Resources. Lastly, the Support section includes a Troubleshooting page that includes any helpful tips specific to this board as well as information on how to receive technical support from SparkFun.

Quickstart Guide

In this Quick Start guide we'll go over how to assemble the SparkFun Qwiic 24 Bit ADC - 4 Channel (ADS1219) in a Qwiic circuit to measure the output voltage of a flex sensor assembled to function as a voltage divider.

This guide assumes users have a basic understanding of using Qwiic breakout and development boards, through-hole soldering, breadboard prototyping as well as how to use the Arduino IDE. If you're not familiar with all of these concepts, read on through the rest of this Hookup Guide for detailed information on how to use this breakout board with the Arduino IDE.

Flex Sensor Demo Assembly

Since we're doing some prototype testing with this board, we opted to solder male headers to the Qwiic ADC - AS1219's PTH pads to easily connect jumper wires to the board.

Connect the flex sensor to the Qwiic ADC - AS1219 with the following steps:

  • Plug the flex sensor into the breadboard.
  • Connect one leg of a 10kΩ resistor to one of the flex sensor's pins and the other to a free row on the breadboard.
  • Take one jumper wire (white wire in the photo below) and connect AIN0 on the Qwiic ADC to same row on the breadboard as the Flex Sensor pin connected to the 10kΩ resistor.
  • Next, use a second jumper wire (red wire in the photo below) to connect the flex sensor's other pin to the Qwiic ADC's VDDA pin (this label is on the bottom of the board).
  • Now use the third jumper wire (black wire in the photo below) and connect the other or "free" end of the 10kΩ resistor to one of the ground pins on the Qwiic ADC.

Your circuit should look similar to the photo below:

Photo showing flex sensor connected to the Qwiic ADC - AS1219

Now that we've finished assembling our flex sensor circuit, it's time to connect the Qwiic ADC - AS1219 to our RedBoard IoT - ESP32. Simply connect the two together with a Qwiic cable plugged into the Qwiic connectors:

Photo showing completed flex sensor demo circuit

Arduino Example

For this example, we'll be using a slightly modified version of Example 01 - Single Shot from the SparkFun AS1219 Arduino Library.

  • Open the Arduino IDE.
  • Open the Library Manager tool, search for "SparkFun AS1219" and install the latest version. This library was built using the SparkFun Toolkit so if you have not already installed it, search for "SparkFun Toolkit" in the Library Manager to install the dependency.
  • Open "Example 01 - Single Shot".
  • Add the following code to the void setup() below this line: Serial.println("ADC initialized");:
      myADC setInputMultiplexer(ADS1219_CONFIG_MUX_SINGLE_0);
    
      Serial println("Reading from A0");
    
  • Select your Board (SparkFun RedBoard IoT - ESP32 or other board) and Port and click "Upload".
  • After the code compiles and finishes uploading, open the serial monitor with the baud set to 115200.
  • Now, gently bend the flex sensor and you should see the voltage readings move down like the screenshot below. Continue flexing the sensor and it should drop further or release it and the voltages should jump back up.

Screenshot of serial monitor output in Arduino

Code to Note

The Single Shot example defaults to measure a differential input from the A0 and A1 channels so in the instructions above we modified the code to configure the ADS1219 to just read a single input on A0 using the setInputMultiplexer() function and then perform a serial print informing of the change:

  myADC setInputMultiplexer(ADS1219_CONFIG_MUX_SINGLE_0);

  Serial println("Reading from A0");

The main loop of this example attempts to start a single-shot conversion and waits for it to complete every 10ms:

  if (myADC.startSync()) // Start a single-shot conversion. This will return true on success.
  {
    while (myADC.dataReady() == false) // Check if the conversion is complete. This will return true if data is ready.
    {
      delay(10); // The conversion is not complete. Wait a little to avoid pounding the I2C bus.
    }    

If that single-shot conversion completes, we read the result, convert it to millivolts and print out that value with three decimal points. If it fails, it prints out a failure message and waits one second before attempting again:

    myADC.readConversion(); // Read the conversion result from the ADC. Store it internally.
    float milliVolts = myADC.getConversionMillivolts(); // Convert to millivolts.
    Serial.print("ADC voltage (mV): ");
    Serial.println(milliVolts, 3); // Print milliVolts with 3 decimal places
  }
  else
  {
    Serial.println("ADC start conversion failed. Please check your wiring! Retrying...");
    delay(1000);
  }

Hardware Overview

Let's take closer look at the ADS1219 ADC and other hardware on this Qwiic breakout. Refer to the annotated image below as you read through.

Annotated photo of the Qwiic ADC - AS1219

ADS1219 Analog-to-Digital Converter

The ADS1219 is a high-precision, 24-bit analog-to-digital converter that communicates over I2C. It has two differential or four single-ended inputs managed by an internal input multiplexer, programmable gain settings of 1 or 4, rail-to-rail input buffers to allow connecting high-impedence devices directly to the ADS1219 and has 16 available I2C addresses so if you really need it, you can connect 16 of these to have up to 64 single-ended (or 32 differential) analog inputs on a single I2C bus! It also features an internal 2.048-V voltage reference and oscillator. Users can provide their own reference voltage throuh the REFN and REFP PTH pins on the board.

The ADS1219 has a supply voltage range of 2.3 to 5.5V. The I2C address is configured via connecting the two address select pins (A0 and A1) to four pins on the ADS1219; Ground, DVDD, SDA and SCL. The board includes eight solder jumpers to set the ADS1219's address. Read on to the "Solder Jumpers" section on this page for information on adjusting the ADS1219's I2C address.

Connectors

Qwiic Connectors

As you'd expect, this breakout includes a pair of Qwiic connectors to easily integrate it into a Qwiic circuit. They connect to the ADS1219's I2C signals (SDA/SCL) and also power the ADC with 3.3V.

PTHs

The board breaks out all of the ADS1219's pins to three 0.1"-spaced PTH headers. On one side there is a 6-pin PTH header that routes the ADS1219's data and power pins including the I2C signals, reset and data ready pins. The other side of the board has a pair of 6-pin PTH headers. The outer header includes the ADS1219's four analog inputs as well as the positive and negative external reference voltage inputs. The inner header breaks out the ADS1219's analog voltage input (VDDA) along with five ground pins for the analog inputs and analog voltage input. Make sure to open the 3V3/VDDA solder jumper before connecting an external analog voltage input.

LED

The sole LED on this board is a red power status LED to indicate when the board has power.

Solder Jumpers

The board has eleven solder jumpers. The list below outlines the functionality of the three solder jumpers not related to setting the device's I2C address:

  • LED - The LED jumper completes the red power LED circuit and is CLOSED by default. Open this jumper to disable the power LED.
  • I2C - The I2C jumper pulls the SDA and SCL signals to 3.3V through a pair of 2.2KΩ resistors. Open the three-way jumper completely to remove the pull-ups from the bus if needed.
  • 3V3-VDDA - The 3V3-VDDA jumper nets the ADS1219's digital and analog supply voltages together to both operate at 3.3V and is CLOSED by default. Open this jumper to isolate the two voltages if you're supplying separate voltages for the analog and digital supplies.

The other eight jumpers control the ADS1219's I2C address and are grouped into labels A1 and A0. Each group has solder jumpers labeled G (Ground), V (3.3V), D (SDA) and C (SCL). By default, the board connects both A1 and A0 to Ground and sets the address to 0x40. The table below outlines all available configurations and the resulting addresses.

A1 A0 Address (Unshifted)
GND GND 0x40 (Default)
GND 3.3V 0x41
GND SDA 0x42
GND SCL 0x43
3.3V GND 0x44
3.3V 3.3V 0x45
3.3V SDA 0x46
3.3V SCL 0x47
SDA GND 0x48
SDA 3.3V 0x49
SDA SDA 0x4A
SDA SCL 0x4B
SCL GND 0x4C
SCL 3.3V 0x4D
SCL SDA 0x4E
SCL SCL 0x4F

Board Dimensions

The Qwiic ADC - ADS1219 is a standard 1"x1" Qwiic breakout with four mounting holes that fit a 4-40 screw.

Hardware Hookup

Qwiic Assembly

Since this is a Qwiic board, assembling it into a circuit is easy. Just connect the Qwiic ADC to a Qwiic-enabled development board using a Qwiic connector. From there, you'll obviously need some analog inputs to convert so for a quick demo we've set up a simple circuit to measure output from a flex sensor. Head back to the Quick Start Guide for instructions on how to set up the flex sensor demo circuit.

Photo showing completed flex sensor demo circuit.

Arduino Setup

Arduino

This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino IDE, library, or board add-on, please review the following tutorials.

Installing the SparkFun ADS1219 Arduino Library

SparkFun Toolkit

This library is built using the SparkFun Toolkit so you'll need to make sure that is installed before using this library. Install the SparkFun Toolkit with the Arduino Library manager by searching "SparkFun Toolkit" and installing the latest version. Users who prefer manually installing Arduino Libraries can download it from the GitHub Repository.

SparkFun ADS1219 Arduino Library

The SparkFun ADS1219 Arduino Library lets users easily get started with the ADS1219 with basic commands and six examples. Install the library using the Arduino Library Manager tool by searching for "SparkFun ADS1219" and install the latest version. If you'd prefer to manually install the library, you can download it from the GitHub Repository or you can download a ZIP of the repository here.

Arduino Examples

Let's take a look at a few of the examples included in the SparkFun ADS1219 Arduino Library.

Example 01 - Single Shot

The first example shows how to take single-shot measurements of a differential input on channels A0 and A1. Open the example by navigating to File > Examples > SparkFun ADS1219 Arduino Library > Example01_SingleShot. Select your Board and Port and click the Upload button. After the code finishes uploading, open the serial monitor with the baud set to 115200 and you should see some setup messages print out followed by readings in millivolts.

The example initializes the ADS1219 on the I2C bus with default settings and then attempts to take single-shot readings from the ADC.

Example 02 - Continuous

The second example shows how to take continuous measurements of a differential input on channels A0 and A1. This example is very similar to the previous one but instead of requesting for a single-shot synched readings, requests continuous readings every 10ms. Open the example from the SparkFun ADS1219 Arduino Library and upload it.

With the serial monitor open and set to 115200, you should see an initialization message print followed by differential voltage readings from A0 and A1 in millivolts.

Example 03 - Input Multiplexer

The third example shows how to configure the ADS1219's input multiplexer feature. This adjustable setting lets users set the ADS1219's input multiplexer to one of eight options using the myADC.setInputMultiplexer(); function. Available settings are:

  ADS1219_CONFIG_MUX_DIFF_P0_N1 //(Default)
  ADS1219_CONFIG_MUX_DIFF_P2_N3
  ADS1219_CONFIG_MUX_DIFF_P1_N2
  ADS1219_CONFIG_MUX_SINGLE_0
  ADS1219_CONFIG_MUX_SINGLE_1
  ADS1219_CONFIG_MUX_SINGLE_2
  ADS1219_CONFIG_MUX_SINGLE_3
  ADS1219_CONFIG_MUX_SHORTED

Example 04 - Data Ready Interrupt

The fourth example demonstrates how to use the ADS1219's data ready pin to trigger an interrupt on a connected microcontroller. For this example, you'll need to connect the Data Ready (DRDY) pin to an interrupt-capable I/O pin on your development board.

The code defaults to use D4 for the interrupt pin so if you need to switch to another pin, adjust this line:

const int interruptPin = 4;

The example's setup sets the I2C clock speed to 400kHz for better performance and initializes the ADS1219 to read the voltage between AIN0 and Ground, adjusts the gain to x4 and configure the data rate to 1000 samples per second. Lastly, it configures the interrupt to go LOW when data is ready. The main loop just checks to see if the interrupt is seen, clears the flag and then prints readings in millivolts.

Troubleshooting

General Troubleshooting

Note

Not working as expected and need help?

If you need technical assistance and more information on a product that is not working as you expected, we recommend heading on over to the SparkFun Technical Assistance page for some initial troubleshooting.

If you don't find what you need there, the SparkFun Forums are a great place to find and ask for help. If this is your first visit, you'll need to create a forum account to search product forums and post questions.

Resources

For more information on the SparkFun Qwiic 24 Bit ADC - 4 Channel (ADS1219), check out the following resources: