Introduction

DFRobot I2C ADS1115 16-bit ADC module can accurately collect and convert analog signals. Through this ADC module, Raspberry Pi can easily use a wide range of Gravity series analog sensors to measure various signals, and perceive this world.

Raspberry Pi is a common master control board which is powerful in its functions, but the I/O pins of Raspberry Pi can read digital signals only, what's more, only through an external analog-to-digital conversion (ADC) module can it read signals of analog sensor or device, it is not convenient to use.

DFRobot I2C ADS1115 16-bit ADC module is specially designed for Raspberry Pi and Gravity series analog sensors, which greatly reduces the difficulty of using the Gravity series analog sensors, plug and play, no welding, very convenient. The number of Gravity series sensors is large and its wide variety can meet the needs of various sensors of the Raspberry Pi.

This module uses 16-bit ADC chip ADS1115, supports 3.3 ~ 5V wide voltage power supply. The chip has a precision reference voltage and programmable gain adjustment (PGA), therefore, accurate acquisition and conversion can be performed for both weak and highly variable signals. So it is also applicable to all types of applications that the main control board needs to accurately collect the analog signals.

One ADC module can read analog signals of 4 channels. Because of the on-board I2C address selection switch, it supports the cascade of two ADC modules and can read analog signals of 8 channels, it can satisfy the needs of various applications.

Specification

Board Overview

Num Label Description
\ VCC Power VCC( 3.3~5.0V)
- GND Power GND(0V)
C SCL I2C Bus Clock Line
D SDA I2C Bus Data Line
A Analog In Analog Input Channels: A0, A1, A2, A3
ADDR I2C Address I2C address selection switch,I2C address: 0x48, 0x49

Tutorial

The voltage on analog input pins must be less than VCC 0.3V! That is, Analog Signal ≤ VCC 0.3V

Arduino Tutorial

This tutorial will demonstrate how to use the ADC module to read 4 channels analog signals with the Arduino board. Please switch the I2C address to 0x48.

Requirements

Connection Diagram

Sample Code

Please down the DFRobot_ADS1115 Library and install it. How to install Libraries in Arduino IDE

Description of the I2C Address in this Library:

/*
 * file ADS1115_ReadVoltage.ino
 *
 * @ https://github.com/DFRobot/DFRobot_ADS1115
 *
 * connect ADS1115 I2C interface with your board (please reference board compatibility)
 *
 * The voltage value read by A0 A1 A2 A3 is printed through the serial port.
 *
 * Copyright   [DFRobot](http://www.dfrobot.com), 2016
 * Copyright   GNU Lesser General Public License
 *
 * version  V1.0
 * date  2018-01-21
 */
#include <Wire.h>
#include <DFRobot_ADS1115.h>

DFRobot_ADS1115 ads;

void setup(void)
{
    Serial.begin(115200);
    ads.setAddr_ADS1115(ADS1115_IIC_ADDRESS0);   // 0x48
    ads.setGain(eGAIN_TWOTHIRDS);   // 2/3x gain
    ads.setMode(eMODE_SINGLE);       // single-shot mode
    ads.setRate(eRATE_128);          // 128SPS (default)
    ads.setOSMode(eOSMODE_SINGLE);   // Set to start a single-conversion
    ads.init();
}

void loop(void)
{
    if (ads.checkADS1115())
    {
        int16_t adc0, adc1, adc2, adc3;
        adc0 = ads.readVoltage(0);
        Serial.print("A0:");
        Serial.print(adc0);
        Serial.print("mV,  ");
        adc1 = ads.readVoltage(1);
        Serial.print("A1:");
        Serial.print(adc1);
        Serial.print("mV,  ");
        adc2 = ads.readVoltage(2);
        Serial.print("A2:");
        Serial.print(adc2);
        Serial.print("mV,  ");
        adc3 = ads.readVoltage(3);
        Serial.print("A3:");
        Serial.print(adc3);
        Serial.println("mV");
    }
    else
    {
        Serial.println("ADS1115 Disconnected!");
    }

    delay(1000);
}

Expected Results

ADS1115_result_Arduino.png

Raspberry Pi Tutorial

This tutorial will demonstrate how to use the ADC module to read 4 channels analog signals with Raspberry Pi. Please switch the I2C address to 0x48.

Requirements

Connection Diagram

Install Driver

Open Terminal, type the following command, and press Enter:

sudo raspi-config

Then use the up and down keys to select “5 Interfacing Options”, press Enter, select “P5 I2C” and press Enter to confirm “YES”. Restart the Raspberry Pi.

In the terminal, type in the following commands in order, and press Enter:

sudo apt-get update
sudo apt-get install build-essential python-dev python-smbus git
git clone <https://github.com/DFRobot/DFRobot_ADS1115.git>
cd DFRobot_ADS1115/RaspberryPi/Python
sudo python DFRobot_ADS1115.py

Run the Sample Code

cd ~/DFRobot_ADS1115/RaspberryPi/Python/ADS1115_ReadVoltage
sudo python ADS1115_ReadVoltage.py

Expected Results

ADS1115_rasp.jpg

FAQ

Q1. How do these two ADC modules cascade? Any sample code?
A1. If cascade is needed, you need to set the I2C address of one ADC module to 0x48 and the I2C address of another ADC module to 0x49. Connect the two ADC modules to the I2C bus interface of the main control board.

We provide cascade sample code with two platforms:

Cascade Sample Code of Arduino
Cascade Sample Code of Raspberry Pi

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get Gravity: I2C ADS1115 16-Bit ADC Module (Arduino & Raspberry Pi Compatible) from DFRobot Store or DFRobot Distributor.

Turn to the Top