ADS1115 Multi-channel Analog-to-Digital Converter
The ADS1115 device is a 16-bit high-precision, low-power analog-to-digital converter (ADC) that is compatible with I2C communication. It comes in ultra-small leadless X2QFN-10 and VSSOP-10 packages. The ADS111x devices feature low-drift voltage references and oscillators. Both the ADS1114 and ADS1115 also include a programmable gain amplifier (PGA) and a digital comparator. These features, along with a wide operating voltage range, make the ADS1115 particularly well-suited for sensor measurements in power- and space-constrained applications.
The ADS111x can perform conversions at data rates of up to 860 samples per second (SPS). The PGA allows input ranges from ±256mV to ±6.144V, enabling precise measurement of small signals. The ADS1115 has an input multiplexer (MUX) that can support two differential input measurements or four single-ended input measurements. The ADS1115 also features a digital comparator for undervoltage and overvoltage detection. The device can operate in continuous conversion mode or in single-shot mode. In single-shot mode, the device automatically powers down after one conversion, significantly reducing power consumption during idle periods.
Module Source
Specifications
Operating Voltage: 2.0-5.5V
Operating Current: 150µA
Sampling Precision: 16-bit
Channels: 4 channels
Control Method: I2C
Number of Pins: 10 Pins (2.54mm pitch header)
Hardware Connection
Ensure that your ADS1115 module and development board are connected as follows:
- Connect the VDD of the ADS1115 to the 3.3V of the development board.
- Connect the GND of the ADS1115 to the GND of the development board.
- Connect the SDA (data line) of the ADS1115 to the A4 (SDA) pin of the development board.
- Connect the SCL (clock line) of the ADS1115 to the A5 (SCL) pin of the development board.
- Connect the A0 pin of the ADS1115 to the location where you need ADC measurements.
If necessary, you can connect the address pin of the ADS1115 to change its I2C address for using multiple devices on the same bus.
Usage Method
Install Library
You need to write a program in the Arduino IDE to initialize I2C communication, configure the ADS1115, and read data. You can use the ADS1X15 library provided by Adafruit to simplify the programming process.
- Install the Adafruit_ADS1X15 library in the Arduino IDE. Go to "Tools" > "Manage Libraries...", then search for and install the Adafruit_ADS1X15 library.
Enter the code:
/******************************************************************************
* Test Hardware: LCSC ColorEasyDuino Development Board
* Version Number: V1.0
* Modified By: www.lckfb.com
* Modification Date: April 8, 2024
* Function Overview:
*****************************************************************************
* Open-source development board hardware and software information and related projects hardware and software information on official website
* Development board official website: www.lckfb.com
* Technical support resident forum, any technical problems are welcome at any time to exchange learning
* LCSC Forum: club.szlcsc.com
* Follow our Bilibili account: [立创开发板], stay toned to our latest news!
* We focus on cultivating Chinese engineers rather than profiting from board sales.
******************************************************************************/
#include <Wire.h>
#include <Adafruit_ADS1X15.h>
Adafruit_ADS1115 ads; // 默认的I2C地址是0x48,可以通过调整引脚来改变
void setup(void)
{
Serial.begin(9600);
Serial.println("Hello!");
Wire.begin(); // 初始化I2C系统
ads.begin(); // 初始化ADS1115通信
// GAIN_TWOTHIRDS = 6_144V,
// GAIN_ONE = 4_096V,
// GAIN_TWO = 2_048V,
// GAIN_FOUR = 1_024V,
// GAIN_EIGHT = 0_512V,
// GAIN_SIXTEEN = 0_256V
ads.setGain(GAIN_ONE); // 设置增益为1, 量程±4.096V
}
void loop(void)
{
int16_t adc0, adc1, adc2, adc3;
float ret;
// 读取通道0的模数转换结果
adc0 = ads.readADC_SingleEnded(0);
// 如果需要,也可以读取其他通道
// adc1 = ads.readADC_SingleEnded(1);
// adc2 = ads.readADC_SingleEnded(2);
// adc3 = ads.readADC_SingleEnded(3);
//默认最大量程为4.096V
Serial.print("ADC0: "); Serial.println(adc0);
// 分辨率计算:测量电压范围/(2^AD位数-1)
// 分辨率= 4.096V/2^15=0.000125
// 电压= 采集到的ADC值 * 分辨率
ret=adc0*0.000125;
Serial.print("voltage: "); Serial.println(ret);
// 为了方便观察,延时一段时间
delay(1000);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Usage Testing
Test GND, 5V, and 3V3 respectively.