Components · 11 min read

ADS1115 Arduino: 16-Bit ADC Wiring, Gain Settings and Code

ADS1115 Arduino guide: I2C addresses, 4 single-ended or 2 differential channels, a gain table, divider and shunt current measurement, ESP32 and Pico code.

The ADS1115 is a 16-bit analog-to-digital converter that connects over I2C and takes over where the Arduino's own 10-bit ADC falls short. An Arduino Uno splits 0–5 V into 1024 steps, so one step is about 4.9 mV; with the right gain the ADS1115 can tell apart differences as small as 7.8 microvolts. In short, the answer to the ads1115 arduino question is: a precise four-channel voltmeter chip with its own reference that needs only two wires.

In this guide you'll see how the ADS1115 works, how to choose its I2C address, how the gain (PGA) setting changes the measuring range and resolution, and the difference between single-ended and differential measurement. Then you'll read four channels with an Arduino Uno, measure a battery voltage with a voltage divider and a current with a small shunt resistor, learn how the ADS1115 gets around the ESP32's non-linear ADC, and write library-free MicroPython code for the Raspberry Pi Pico. If ADCs are new to you, take a look at the what is an ADC article first.

What is the ADS1115 and how does it work?

Made by Texas Instruments, the ADS1115 is a delta-sigma ADC: it samples the input many times coarsely, averages the result with a digital filter and returns it as a signed 16-bit number. This method is slow but very resistant to noise. Inside the chip there's a four-input multiplexer (MUX), a programmable gain amplifier (PGA), a stable internal reference and its own oscillator, so the measurement isn't affected by ripple on the Arduino's 5 V rail. Because the result is signed, the codes run from −32768 to +32767; in single-ended mode the voltage can't go below GND, so in practice only the positive half, that is 15 bits, is used.

FeatureValue
Resolution16 bits (effectively 15 bits single-ended)
Channels4 single-ended or 2 differential
Supply2.0–5.5 V
CurrentAbout 150 µA (continuous), under 1 µA in power-down
Data rate8, 16, 32, 64, 128 (default), 250, 475, 860 SPS
Gain (PGA)6 ranges from ±6.144 V to ±0.256 V
InterfaceI2C, 4 addresses (0x48–0x4B), fast mode up to 400 kHz
Extra pinALERT/RDY: threshold comparator or "conversion ready" signal

ADS1115 or the board's built-in ADC?

The boards' own ADCs are fast but limited in precision. The Uno's reference is usually the 5 V from USB, which can vary between 4.7 and 5.2 V from one computer to the next, and every reading carries that error. The ESP32's 12-bit ADC is noticeably non-linear at the ends: it often reads 0 below about 0.1 V and saturates early at the top. The Pico's ADC is also 12-bit, but noise and known step errors bring its effective resolution down to roughly 9 bits. The ADS1115 solves all three problems; in exchange it manages at most 860 readings per second, so it's not suitable for sampling audio or other fast signals.

FeatureArduino UnoESP32Raspberry Pi PicoADS1115
Bits101212 (effective ~9)16
Smallest step4.9 mV~0.8 mV (on paper)~0.8 mV7.8–187.5 µV
Reference5 V supply or internal 1.1 VInternal + attenuation3.3 V supplyInternal, stable
Differential inputNoNoNoYes (2 pairs)
Speed~9,000 readings/sVery fast500,000 readings/sUp to 860 readings/s

ADS1115 wiring: Arduino Uno, ESP32 and Pico

ADS1115 pinArduino UnoESP32Raspberry Pi Pico
VDD5V3V33V3(OUT), pin 36
GNDGNDGNDGND
SCLA5GPIO 22GP5
SDAA4GPIO 21GP4
ADDRGND (0x48)GND (0x48)GND (0x48)
ALERT/RDYUnused (optional D2)UnusedUnused
A0–A3Voltages to measureVoltages to measureVoltages to measure

Most ready-made ADS1115 modules have 10 kΩ pull-up resistors on SDA and SCL, tied to VDD. When you use the module with an ESP32 or Pico, connect VDD to 3.3 V; then the bus lines also stay at 3.3 V and the board's pins are safe. The ADDR pin sets the address; on most modules it's pulled to GND through a resistor, so leaving it open gives 0x48, but wiring it to GND is the most reliable choice. Whenever you add a new device to the I2C bus, you can check its address with the scanner sketch in the what is I2C article.

ADDR pin connected toI2C address
GND0x48
VDD0x49
SDA0x4A
SCL0x4B
The ±6.144 V range in the gain table does not mean you can feed 6 V into the ADS1115. No input pin may go above VDD + 0.3 V or below GND − 0.3 V; putting 5 V on a module powered from 3.3 V can permanently damage the input. Always bring higher voltages down with a voltage divider.

Gain (PGA) setting: measuring range and resolution

The ADS1115's 16 bits always span the same number of codes; the gain only narrows or widens the voltage range they cover. The narrower the range, the smaller one step becomes, so the measurement gets finer. The formula is simple: 1 step = full scale / 32768. For example, in the ±4.096 V range that's 4.096 / 32768 = 0.000125 V, or 125 µV. To turn a raw reading into volts, multiply it by this value: a raw value of 20000 means 20000 × 125 µV = 2.5 V. The library's computeVolts() function does this for you based on the gain you selected.

Library settingGainFull scale (FSR)1 step (LSB)Good for
GAIN_TWOTHIRDS2/3±6.144 V187.5 µV0–5 V sensors on a 5 V supply
GAIN_ONE1±4.096 V125 µV3.3 V signals, divider outputs
GAIN_TWO2 (default)±2.048 V62.5 µV0–2 V sensors
GAIN_FOUR4±1.024 V31.25 µVPhotodiodes, small signals
GAIN_EIGHT8±0.512 V15.625 µVShunts, thermocouple-like signals
GAIN_SIXTEEN16±0.256 V7.8125 µVShunt current, bridges (strain gauges)
When choosing the gain, look at the highest voltage you'll measure and pick the narrowest range that comfortably covers it. For a 0–3.3 V signal GAIN_ONE is the right choice; with GAIN_TWO everything above 2.048 V reads 32767 and the measurement "sticks to the ceiling". If your channels have different ranges, you can call setGain() before each reading.

Single-ended vs differential measurement

In single-ended mode each channel is read relative to GND, which is ideal for four independent voltages. In differential mode the difference between two inputs is read: A0−A1, A0−A3, A1−A3 or A2−A3. This lets you measure a signal where neither end sits at GND, and it largely cancels interference picked up equally by both wires. The difference can also be negative, so differential mode uses the full 16 bits. The two middle taps of a bridge sensor (a load cell or pressure sensor) or the two ends of a shunt resistor are typical differential applications.

Data rate and noise

The data rate sets how long the ADS1115 averages for one reading. At the default 128 SPS one conversion takes about 7.8 ms; at 860 SPS it drops to 1.2 ms, but the last digits jump around more because the digital filter averages less. At 8 SPS one conversion takes 125 ms and the result is very calm. When you read four channels in turn, the times add up: at 128 SPS four channels take about 32 ms. For slowly changing quantities such as temperature, battery voltage or light, choose 8–64 SPS; if you need to follow fast current changes, choose 475–860 SPS.

Step by step: reading 4 channels from the ADS1115 with Arduino

  1. Wire the module as in the table: VDD to 5V, GND to GND, SCL to A5, SDA to A4, ADDR to GND.
  2. For a test, connect the outer legs of a potentiometer to 5V and GND and its middle leg to A0; on the other channels you can add an LDR divider or a 1.5 V battery if you like.
  3. In the Arduino IDE, open the Library Manager, search for Adafruit ADS1X15 and install it with its dependency (Adafruit BusIO).
  4. Upload the code below, open the Serial Monitor at 115200 baud and turn the potentiometer to watch A0 rise from 0 to about 5 V.
  5. Compare the result with a multimeter; the two readings shouldn't differ by more than a few millivolts.
C++ (Arduino IDE)
1#include <Wire.h>
2#include <Adafruit_ADS1X15.h>
3
4Adafruit_ADS1115 ads;                      // 16 bit ADS1115 nesnesi / 16-bit ADS1115 object
5
6void setup() {
7  Serial.begin(115200);
8  if (!ads.begin(0x48)) {                  // ADDR -> GND ise adres 0x48 / address 0x48 when ADDR is tied to GND
9    Serial.println(F("ADS1115 bulunamadi / ADS1115 not found"));
10    while (1);
11  }
12  ads.setGain(GAIN_TWOTHIRDS);             // +/-6.144 V aralık, 1 bit = 187.5 uV (giriş yine de VDD'yi geçemez) / range, 1 LSB = 187.5 uV (inputs still must stay below VDD)
13  ads.setDataRate(RATE_ADS1115_128SPS);    // varsayılan hız / default rate
14}
15
16void loop() {
17  for (uint8_t ch = 0; ch < 4; ch++) {
18    int16_t raw = ads.readADC_SingleEnded(ch);   // 0..32767 (tekli uç / single-ended)
19    float volts = ads.computeVolts(raw);         // kazanca göre volta çevir / convert using the gain
20    Serial.print(F("A"));
21    Serial.print(ch);
22    Serial.print(F(": "));
23    Serial.print(raw);
24    Serial.print(F(" -> "));
25    Serial.print(volts, 4);
26    Serial.print(F(" V   "));
27  }
28  Serial.println();
29  delay(500);
30}

The code first looks for the chip at address 0x48 and stops with a warning if it can't find it. Because the module runs from 5 V and the potentiometer sweeps 0–5 V, GAIN_TWOTHIRDS (±6.144 V) is selected; one step is 187.5 µV, about 26 times finer than the Uno's 4.9 mV step. If you know your signal won't go above 4 V, switch to GAIN_ONE and get 125 µV steps. readADC_SingleEnded() starts a conversion, waits for it to finish and returns the raw number; computeVolts() converts it to volts using the selected gain. It's normal for an unconnected channel to show random values, because a floating high-impedance input picks up interference from the air.

Measuring battery voltage with a voltage divider

You can't feed a 12 V battery or a 3S lithium pack (12.6 V) straight into the ADS1115; first bring it down with two resistors. Example: with 100 kΩ on top and 15 kΩ at the bottom the ratio is 15 / 115 = 0.130, so even 20 V drops to 2.61 V at the ADS1115 input. With GAIN_ONE one step is 125 µV, so the resolution on the battery side is 125 µV / 0.130 ≈ 0.96 mV; with the Uno's own ADC and the same divider it would be around 37 mV. Keep the resistors in the 10–100 kΩ range: too small and you waste battery current, too large and the ADS1115's input impedance of a few MΩ skews the result by a few percent. Resistor tolerance can shift the calculation by a few tenths of a percent, so measure once with a multimeter and correct the ratio in the code. To work out the ratio quickly, use the voltage divider calculator.

Measuring current with a shunt resistor (differential)

Current is calculated from the voltage across a small resistor placed in its path (the shunt): I = V / R. If 1 A flows through a 0.1 Ω shunt, 100 mV appears across it. For such a small voltage GAIN_SIXTEEN (±0.256 V) is ideal: one step is 7.8125 µV, so with a 0.1 Ω shunt the current resolution is about 78 µA and the largest measurable current is 2.56 A. Connect the two ends of the shunt to A2 and A3 and read them differentially. Don't forget the power the shunt dissipates: at 2.5 A it's P = I² × R = 0.625 W, so choose a resistor rated at least 1 W. If you'd like a ready-made solution, the INA219 current sensor does the same job in a single chip.

Even in differential mode, both inputs must stay between GND and VDD. So in a 12 V circuit, if you put the shunt in the positive line (high-side), both ends sit at 12 V and the ADS1115 is destroyed. Place the shunt between the load and GND (low-side) so both ends stay close to GND. Don't forget the common ground either: the battery's GND and the Arduino's GND must be connected.

ADS1115 with ESP32: a fix for the non-linear ADC

On paper the ESP32's ADC is 12-bit, but its real curve isn't a straight line: it doesn't see the bottom 0.1 V or so at all, saturates early at the top, and boards can differ by a few hundred millivolts. analogReadMilliVolts() improves things with the factory calibration, but it doesn't remove the dead zones at the ends. On top of that, the ADC2 pins can't be used while Wi-Fi is on. The ADS1115 removes these problems completely: the reading arrives over I2C, isn't affected by Wi-Fi and stays linear down to 0 V. The code below reads a battery voltage (A0, through a divider) and a shunt current (A2−A3) with a module powered from 3.3 V and calculates the power.

C++ (Arduino IDE)
1#include <Wire.h>
2#include <Adafruit_ADS1X15.h>
3
4Adafruit_ADS1115 ads;
5
6const float R1 = 100000.0;          // bölücü üst direnç (akü +) / divider top resistor (battery +)
7const float R2 = 15000.0;           // bölücü alt direnç (GND) / divider bottom resistor (GND)
8const float SHUNT_OHM = 0.1;        // şönt direnci / shunt resistor
9
10void setup() {
11  Serial.begin(115200);
12  Wire.begin(21, 22);               // ESP32: SDA = GPIO 21, SCL = GPIO 22
13  if (!ads.begin(0x48, &Wire)) {
14    Serial.println("ADS1115 bulunamadi / ADS1115 not found");
15    while (true) delay(1000);
16  }
17  ads.setDataRate(RATE_ADS1115_64SPS);   // daha yavaş = daha az gürültü / slower = less noise
18}
19
20void loop() {
21  // 1) Akü gerilimi: AIN0 tekli uç / battery voltage: AIN0 single-ended
22  ads.setGain(GAIN_ONE);                               // +/-4.096 V
23  float vPin = ads.computeVolts(ads.readADC_SingleEnded(0));
24  float vBattery = vPin * (R1 + R2) / R2;              // bölücüyü geri hesapla / undo the divider
25
26  // 2) Akım: AIN2-AIN3 diferansiyel, şönt üzerindeki gerilim / current: AIN2-AIN3 differential across the shunt
27  ads.setGain(GAIN_SIXTEEN);                           // +/-0.256 V, 1 bit = 7.8125 uV
28  float vShunt = ads.computeVolts(ads.readADC_Differential_2_3());
29  float current = vShunt / SHUNT_OHM;                  // I = V / R
30
31  Serial.printf("Aku / Battery: %.3f V   Akim / Current: %.4f A   Guc / Power: %.3f W\n",
32                vBattery, current, vBattery * current);
33  delay(1000);
34}

The key point in the code is changing the gain between the two readings: GAIN_ONE for the battery voltage, GAIN_SIXTEEN for the shunt. This is safe because the library rewrites the configuration on every read. Choosing 64 SPS lowers the noise; the two readings take about 32 ms in total. If current flows the other way, the differential value comes out negative, which lets you tell charging from discharging. For battery projects where you want the ESP32 to sleep and measure only now and then, see the ESP32 deep sleep article.

ADS1115 with Raspberry Pi Pico and MicroPython (no library)

The best way to understand the ADS1115 is to talk to it without a library. The chip has two important registers: 0x01 configuration and 0x00 conversion result. The 16-bit number you write to the configuration register tells it which channel (MUX, bits 14–12), which range (PGA, bits 11–9) and which rate (DR, bits 7–5) to use; the top bit (OS) starts a single conversion. For example, the value for A0, ±4.096 V and 128 SPS is 0xC383. When the conversion is done, you read two bytes from the result register and turn them into a signed number. The code below reads all four channels on the Pico through GP4 (SDA) and GP5 (SCL); if you're new to MicroPython, start with the MicroPython basics article.

MicroPython
1# Raspberry Pi Pico: ADS1115'i kütüphanesiz okumak / reading the ADS1115 without a library
2from machine import Pin, I2C
3import time
4
5i2c = I2C(0, sda=Pin(4), scl=Pin(5), freq=400000)   # GP4 = SDA, GP5 = SCL
6ADDR = 0x48
7
8PGA = {6.144: 0, 4.096: 1, 2.048: 2, 1.024: 3, 0.512: 4, 0.256: 5}   # kazanç bitleri / gain bits
9
10def read_volts(channel, fsr=4.096):
11    mux = 4 + channel                     # 100..111 = AIN0..AIN3 / GND'ye göre (single-ended)
12    config = (0x8000                      # OS: tek ölçüm başlat / start a single conversion
13              | (mux << 12)
14              | (PGA[fsr] << 9)
15              | 0x0100                    # MODE: tek seferlik / single-shot
16              | (4 << 5)                  # DR: 128 SPS
17              | 0x0003)                   # karşılaştırıcı kapalı / comparator disabled
18    i2c.writeto_mem(ADDR, 0x01, bytes([config >> 8, config & 0xFF]))
19    time.sleep_ms(9)                      # 128 SPS'de bir ölçüm ~7,8 ms / one conversion ~7.8 ms
20    hi, lo = i2c.readfrom_mem(ADDR, 0x00, 2)
21    raw = (hi << 8) | lo
22    if raw > 32767:                       # işaretli 16 bit / signed 16-bit
23        raw -= 65536
24    return raw * fsr / 32768
25
26print("I2C:", [hex(a) for a in i2c.scan()])
27while True:
28    values = [read_volts(ch) for ch in range(4)]
29    print("  ".join("A%d: %.4f V" % (i, v) for i, v in enumerate(values)))
30    time.sleep(0.5)

ADS1115 project ideas

  • Precision digital voltmeter: an instrument with ADS1115 + divider + LCD that shows 0–20 V to the millivolt; for the basic idea see the Arduino voltmeter article.
  • Solar panel monitor: measure panel voltage and shunt current and calculate the energy produced per day (Wh).
  • Battery capacity tester: keep adding up the discharge current through a fixed load resistor to find the real mAh of an 18650 cell.
  • Soil moisture and LDR station: bring four analog sensors onto one module and escape the ESP32's ADC quirks; the capacitive soil moisture sensor article helps with the sensors.
  • Mini scale: read a load cell's bridge output on A0−A1 differentially with GAIN_SIXTEEN (if you need 24 bits, the HX711 is the better fit).

Common mistakes and how to fix them

SymptomLikely causeFix
"ADS1115 not found"Wrong address or SDA/SCL swappedFind the address with an I2C scanner, check the ADDR wiring
Value stuck at 32767Voltage above the selected rangePick a wider gain or use a divider
Empty channel shows random valuesInput floatingTie unused channels to GND
Reading off by a few percent from the multimeterDivider resistors too large or out of toleranceUse 10–100 kΩ and calibrate the ratio with a multimeter
Last digits jump a lotData rate too high, long wiresChoose 8–64 SPS, average several readings, shorten the wires
Current reading makes no sense or the chip gets hotShunt on the positive line, input above VDDMove the shunt to the low side, connect a common GND
To calm the readings down further, you can use a simple moving average or an exponential filter in software; for short examples see the sensor data filtering article. By connecting four ADS1115 boards with four different addresses to the same I2C bus, you can even build a 16-channel measuring system.

If you'd like to try the ADS1115 with analog sensors, take a look at the LDR light level, LCD digital voltmeter and NTC temperature projects in the BlueGrays app; each comes with a step-by-step circuit diagram and ready-to-use code, and you can easily swap the measuring part for the ADS1115 code from this article.

Frequently asked questions

What's the difference between the ADS1115 and the ADS1015?

Both chips have the same pinout and gain options. The ADS1115 offers 16-bit resolution and up to 860 readings per second, while the ADS1015 is 12-bit but goes up to 3300 readings per second. Choose the ADS1115 when precision matters and the ADS1015 when speed matters; the Adafruit library supports both.

Can the ADS1115 measure voltages above 5 V?

Not directly; no input may exceed VDD + 0.3 V. To measure 12 V or 24 V, bring the voltage into your chosen range with a two-resistor voltage divider, then multiply back by the ratio in your code. For example, with 100 kΩ and 15 kΩ, 20 V becomes 2.61 V.

Can the ADS1115 measure negative voltages?

In differential mode the difference between two inputs can be negative, and the chip returns it as a signed value; for example, if A0 is lower than A1, the result is negative. However, no pin may go more than 0.3 V below GND. To measure true negative voltages, you need to shift the signal into the positive region with a resistor offset circuit.

How do I change the ADS1115's I2C address?

The address depends on where the ADDR pin is connected: GND gives 0x48, VDD 0x49, SDA 0x4A and SCL 0x4B. In your code, just pass the same address, for example ads.begin(0x49). That way you can use four modules on the same bus.

Why is the ADS1115 so slow?

At the default 128 SPS each conversion takes about 7.8 ms, and reading four channels adds up to 32 ms. With setDataRate(RATE_ADS1115_860SPS) you can cut it to 1.2 ms, at the cost of a little more noise. If you need much faster sampling, the board's own ADC or a faster external ADC is a better fit.

Does the ADS1115 work with an ESP32 at 3.3 V?

Yes, the chip runs from 2.0 to 5.5 V and keeps all its features at 3.3 V. Power the module from the ESP32's 3V3 pin; then the I2C lines also stay at 3.3 V and no level shifter is needed. In that case, don't apply more than 3.3 V to the inputs either.

See all projects
Measuring Light Intensity with an LDR
AR-11Beginner

Measuring Light Intensity with an LDR

Want to see how bright your room is as a number? The LDR, a small part that reacts to light, measures the light around it, and the Arduino writes the value to your computer screen every half second.

4.5(86)
154
Reading Light Intensity with the ESP32 LDR Module
ES-11Beginner

Reading Light Intensity with the ESP32 LDR Module

Real-time monitoring of the LDR module's raw ADC value and relative light percentage calculated from dark and light reference values in the Serial Monitor. This percentage is not a lux measurement. Teaches the module’s calibration logic. It is ideal to complete this before Project 10, as it is used to determine the threshold value.

4.6(36)
56
Digital Voltmeter with LCD Display
AR-56Intermediate
Premium

Digital Voltmeter with LCD Display

Find out how much voltage a battery or power adapter gives with a meter you built yourself.

4.5(27)
36
Temperature Measurement with NTC and 2x16 Lcd Display
AR-44Beginner
Premium

Temperature Measurement with NTC and 2x16 Lcd Display

Measure the temperature around you with a sensor that looks like a tiny bead. This part, called an NTC, lets electricity through more easily as it warms up; the Arduino reads that change, turns it…

4.5(33)
44
ESP32 LED Brightness Control with a Potentiometer (Analog → PWM)
ES-13Intermediate
Premium

ESP32 LED Brightness Control with a Potentiometer (Analog → PWM)

In this project, we control the brightness of an LED analogically using a potentiometer. The ESP32's ADC pin reads the 0-3.3V voltage from the potentiometer, and this value is then converted into a PWM (Pulse Width Modulation) signal and sent to the LED. As a result, as you turn the potentiometer, the LED gradually brightens and dims. With Arduino Core 3.0+, analogWrite() can be used directly; on the ESP32-S2/S3, the ADC resolution is fixed at 12-bit.

4.4(20)
32
Servo Motor Operation with Potentiometer
AR-36Beginner
Premium

Servo Motor Operation with Potentiometer

As you turn the potentiometer knob, the servo motor's arm turns right along with it: one end of the knob means zero degrees, the other end means half a turn.

4.6(37)
54
Using LCD Screen with I2C
AR-32Beginner
Premium

Using LCD Screen with I2C

Give your Arduino its own screen and make it write its first message. The two-line LCD screen hooks up with just a few wires; a greeting appears on the top line, then a second message on the bottom…

4.8(53)
71
ESP32 Temperature Data Logger (DHT22 + DS1307 RTC + microSD + OLED)
ES-40Advanced
Premium

ESP32 Temperature Data Logger (DHT22 + DS1307 RTC + microSD + OLED)

Build a timed temperature and humidity logger with the ESP32! A DHT22 sensor reads temperature and humidity once a minute, and each reading is saved to a microSD card in CSV format with a real-time stamp from the DS1307 RTC module. The OLED display shows the latest temperature, humidity, timestamp and total number of records live, in large text.

4.7(7)
12