The ADS1115 is one of the most widely used analog-to-digital converters (ADC) by makers and electronics enthusiasts due to its versatility and precision. This 16-bit device easily connects to platforms such as Arduino or Raspberry Pi thanks to its I2C interface. The ADS1115 has the ability to measure up to 4 analog or 2 differential inputs, offering a resolution superior to that integrated in many microcontrollers.
Thanks to its programmable gain and its ability to measure both positive and negative signals, it has become an essential tool for those projects that require greater precision than what internal ADCs can offer, such as high-precision sensors or low voltage measurements.
What is ADS1115?
The ADS1115 is an analog-to-digital converter (ADC) that transforms analog signals into digital data processable by platforms such as Arduino o ESP8266. This device stands out for its 16-bit resolution, which makes it much more precise than the internal ADCs of microcontrollers such as the Arduino Uno, which only offers 10 bits.
One of the most useful features of the ADS1115 is its ability to perform measurements of both single-ended and differential signalsIn single-ended mode, you can connect up to four independent signals, while in differential mode, you can connect two pairs of signals, allowing measurement of negative signals.
Technical characteristics of the ADS1115
The ADS1115 incorporates several advanced features that make it an excellent choice for projects where high resolution is required in analog measurements:
- 16-bit resolution: This means that it can measure up to 65,536 different signal levels. This makes it a much more accurate option than the 10-bit ADCs built into most microcontrollers.
- I2C interface: It allows the device to easily communicate with microcontrollers. In addition, it is possible to connect up to four ADS1115s on a single bus thanks to its configurable address pin ADDR.
- Measurement modes: The device offers both single-ended (4 independent channels) and differential (2 channels) measurements. In differential mode, noise is reduced and negative signals can be measured.
- Programmable PGA: El programmable gain amplifier (PGA) The gain is adjusted in ranges from ±6.144V to ±0.256V, allowing for greater accuracy when measuring low voltages. It should be noted that although the PGA can handle up to ±6.144V, it is not possible to measure more than the device's supply voltage (5V in most cases).
- Voltage comparator: The ADS1115 includes a programmable comparator that can generate an alert via the ALERT pin when a signal exceeds a software-defined threshold value.
Operating modes
The ADS1115 has two main modes of operation that can be tailored to the needs of the project:
- Continuous conversion: In this mode, the device continues to take data constantly, ideal for continuous monitoring applications.
- Single-shot mode: The device takes a reading and then goes into low power mode until it is prompted for another reading. This is useful when you want to minimize power consumption on battery powered projects.
Programmable Gain Mode (PGA)
The ADS1115 has a programmable gain amplifier (PGA), allowing you to adjust its measurement range. This is especially useful when working with low voltage signals, as you can amplify the signal to take full advantage of the ADC's resolution. Supported ranges are from ±6.144V to ±0.256V, offering flexibility in a wide variety of applications. However, It is essential not to exceed the supply voltage of the device, which is usually 5V, as you could damage the converter.
ADS1115 Applications
- Sensor measurement: When you need to read accurate data from analog sensors, such as temperature, light or pH sensors, the ADS1115 becomes a key tool.
- Research projects: For some projects where you need to measure subtle changes in small voltages, the ADS16's 1115-bit resolution provides the accuracy needed.
- Battery Monitoring: Thanks to its ability to measure differential signals and its internal comparator, the ADS1115 can also be used to create battery monitoring systems, where an alert can be generated when the voltage falls below a critical level.
Connection with Arduino
Connecting the ADS1115 to an Arduino board is very easy thanks to its I2C interface. You only need to connect the SDA and SCL pins of the ADC to the corresponding ones on the Arduino, and power the device with 5V.
Below is the basic connection diagram:
VCC (ADS1115) -> 5V (Arduino)
GND (ADS1115) -> GND (Arduino)
SCL (ADS1115) -> SCL (Arduino)
SDA (ADS1115) -> SDA (Arduino)
To select the I2C address of the ADC, you need to connect the ADDR pin to GND, VDD, SDA or SCL, getting the addresses 0x48, 0x49, 0x4A or 0x4B, respectively. Depending on how many ADS1115s you want to use in your project, this option becomes very useful.
Using the Adafruit library for ADS1115
To simplify the use of the ADS1115 with Arduino, you can install the Adafruit library. This library provides very clear examples to help you get started. Below is a basic example for reading all four channels in single-ended mode:
#include <Wire.h>
#include <Adafruit_ADS1015.h>
Adafruit_ADS1115 ads;
void setup(void) {
Serial.begin(9600);
ads.begin();
}
void loop(void) {
int16_t adc0, adc1, adc2, adc3;
adc0 = ads.readADC_SingleEnded(0);
adc1 = ads.readADC_SingleEnded(1);
adc2 = ads.readADC_SingleEnded(2);
adc3 = ads.readADC_SingleEnded(3);
Serial.print("AIN0: "); Serial.println(adc0 * 0.1875);
Serial.print("AIN1: "); Serial.println(adc1 * 0.1875);
Serial.print("AIN2: "); Serial.println(adc2 * 0.1875);
Serial.print("AIN3: "); Serial.println(adc3 * 0.1875);
delay(1000);
}
This code reads the four analog channels and converts them to voltage, using the corresponding multiplier according to the gain we set in the ADC.
Differential mode
The ADS1115's differential mode is very useful for measuring negative voltages or for minimizing noise. Here is a basic example to make a differential reading between pins A0 and A1:
#include <Wire.h>
#include <Adafruit_ADS1015.h>
Adafruit_ADS1115 ads;
void setup(void) {
Serial.begin(9600);
ads.begin();
}
void loop(void) {
int16_t results;
results = ads.readADC_Differential_0_1();
Serial.print("Diferencial: "); Serial.println(results * 0.1875);
delay(1000);
}
With this alternative reading mode, you can measure the voltage difference between two inputs, ideal for applications where noise may be a problem.
Closing remarks
The ADS1115 not only provides outstanding accuracy for an ADC of this type, but it is also extremely easy to use. Its I2C interface and ability to measure both simplex and differential signals make it a valuable component for any electronics project, whether you are measuring sensors with low voltages or need more accuracy than a typical microcontroller provides. Plus, its built-in comparator adds an extra layer of utility by allowing the creation of alarms when certain thresholds are exceeded, making it perfect for monitoring applications. If you are looking for accuracy and functionality in your analog measurements, the ADS1115 is a highly recommended choice.