Input devices

ADS1115 ADC with ESP32

Parallel RGB display boards rarely have analog pins left, and the ESP32 ADC is noisy and not linear. An ADS1115 solves both over two I2C wires: four single-ended inputs at 16 bits. If the connector on your board offers I2C and nothing else, this is how you read a pressure transducer or a thermistor.

Gain confuses people. The range settings run from ±6.144 V down to ±0.256 V, but gain changes only the scaling, not what the pins can take. On a 3.3 V supply, any input must stay below about VDD + 0.3 V, so the ±6.144 V range does not let you connect 5 V. A 0 to 5 V sensor still needs a divider. Pick the smallest range that covers your signal, because a wider one wastes resolution. For 0 to 3.3 V, ±4.096 V is the usual choice, giving 125 µV per step.

The ADDR pin sets the address: GND is 0x48, VDD 0x49, SDA 0x4A and SCL 0x4B. Up to four can share a bus, which gives 16 inputs. Run a scan first, and remember that 0x48 can collide with other parts. It is not fast, and the code below uses 128 samples per second. So it suits slow signals and not audio. Single-ended readings go from 0 upwards, and the sign bit is used only for differential ones. Differential inputs help when a small signal sits on a noisy ground. The sources here are guides, so check TI's datasheet for exact limits.

ADS1115 ADC wiring diagram for ESP32
Wiring diagram drawn by LCD Ultra Pro.

Specifications

Resolution16-bit
Inputs4 single-ended or 2 differential
Ranges±6.144 V to ±0.256 V
Input limitAbout VDD + 0.3 V
I2C address0x48 to 0x4B by ADDR pin

Power and logic levels

3.3 V: safe to connect directly

Supply2–5.5 V, use 3V3
Signal levelI2C and inputs follow the supply
On an ESP32Inputs must stay within the supply voltage. Run it from 3V3, so the I2C lines stay at 3.3 V.

ESP32 pins, including those on a display board's connectors, work at 3.3 V and are not 5 V tolerant. Modules differ, so if in doubt, measure the signal before you connect it.

Wiring

ADS1115 ADCConnect toNote
VIN / VCC3V3
GNDGND
SDAGPIO 8Any free pin, set in Wire.begin()
SCLGPIO 9Any free pin, set in Wire.begin()
ADDRGNDAddress 0x48
A0Sensor signalStay within the supply voltage

Arduino code

#include <Wire.h>

const int SDA_PIN = 8, SCL_PIN = 9;
const uint8_t ADDR = 0x48;

void setup() {
  Serial.begin(115200);
  Wire.begin(SDA_PIN, SCL_PIN);
}

void loop() {
  Wire.beginTransmission(ADDR);      // config: A0, +/-4.096 V, single shot, 128 SPS
  Wire.write(0x01); Wire.write(0xC3); Wire.write(0x83);
  Wire.endTransmission();
  delay(10);
  Wire.beginTransmission(ADDR);
  Wire.write(0x00);                  // conversion register
  Wire.endTransmission();
  Wire.requestFrom(ADDR, (uint8_t)2);
  int16_t raw = Wire.read() << 8;
  raw |= Wire.read();
  Serial.printf("A0 %.4f V\n", raw * 0.000125);
  delay(1000);
}

No extra library needed. Compiled for ESP32-S3 with arduino-esp32 3.x. Not yet tested by us on a physical sensor. Change the pins to match your board.

On a display

Read the value in your sketch and pass it to a label, or send it over MQTT and show it with an MQTT value in the editor.

Design a display for ADS1115 ADC

Boards with a ready connector

Only boards whose connectors we have surveyed. Others may still work on free GPIOs.

Elecrow CrowPanel ESP32 HMI 2.4"I2C port: SDA 22, SCL 21Not shared with the touch controller (it is on SPI) — free for sensors
Elecrow CrowPanel ESP32 HMI 2.8"I2C port: SDA 22, SCL 21Not shared with the touch controller (it is on SPI) — free for sensors
Elecrow CrowPanel ESP32 HMI 3.5"I2C port: SDA 22, SCL 21Not shared with the touch controller (it is on SPI) — free for sensors
Elecrow CrowPanel ESP32-S3 HMI 5.0"I2C port: SDA 19, SCL 20Same I2C bus as the GT911 touch (0x14 / 0x5D) and, on V3.0 boards, the PCA9557 touch-reset expander (0x18)
Elecrow CrowPanel ESP32-S3 HMI 7.0"I2C port: SDA 19, SCL 20Same I2C bus as the GT911 touch (0x14 / 0x5D) and, on V3.0 boards, the PCA9557 touch-reset expander (0x18)
LilyGO T-Display-S3-Pro 2.33"QWIIC RIGHT: SDA 5, SCL 6I2C only — same bus as the touch, the PMU (SY6970) and the light sensor
M5Stack AtomS3 0.85"Bottom I2C pins: SDA 38, SCL 39Same I2C bus as the built-in IMU (MPU6886, 0x68)
Makerfabs MaTouch ESP32-S3 Rotary IPS 2.1 RoundMabee I2C (J1): SDA 17, SCL 18Same I2C bus as the touch controller (CST826)
Makerfabs MaTouch ESP32-S3 Parallel TFT 4.3"Mabee I2C: SDA 17, SCL 18Same I2C bus as the touch controller (GT911)
Makerfabs MaTouch ESP32-S3 Parallel TFT with Touch 5.0"Mabee I2C: SDA 17, SCL 18Same I2C bus as the touch controller (GT911)
Makerfabs MaTouch ESP32-S3 Parallel TFT with Touch 7.0"Mabee I2C: SDA 17, SCL 18Same I2C bus as the touch controller (GT911)
Sunton ESP32-4827S043R/C 4.3"I2C header (P3): SDA 19, SCL 20Same I2C bus as the GT911 touch controller. P3 also carries GPIO 17 / 18.
Sunton ESP32-8048S043C 4.3"I2C header (P3): SDA 19, SCL 20Same I2C bus as the GT911 touch controller. P3 also carries GPIO 17 / 18.
Sunton ESP32-8048S050C 5.0"I2C header (P3): SDA 19, SCL 20Same I2C bus as the GT911 touch controller. P3 also carries GPIO 17 / 18.
Sunton ESP32-8048S070C 7.0"I2C header (P3): SDA 19, SCL 20Same I2C bus as the GT911 touch controller. P3 also carries GPIO 17 / 18.
Waveshare ESP32-S3 Touch LCD 2.1" roundI2C connector: SDA 15, SCL 7Same I2C bus as the touch controller, the IO expander, the RTC and the IMU (addresses 0x15/0x5D, 0x20, 0x51, 0x6B, 0x7E taken)
Waveshare ESP32-S3 Touch LCD 2.8"I2C connector: SDA 11, SCL 10Same I2C bus as the RTC and the IMU (0x51, 0x6B, 0x7E taken) — the touch has its own bus
Waveshare ESP32-S3 Touch LCD 2.8" Type BI2C connector: SDA 15, SCL 7Same I2C bus as the touch controller, the IO expander, the RTC and the IMU (addresses 0x15/0x5D, 0x20, 0x51, 0x6B, 0x7E taken)
Waveshare ESP32-S3-Touch-LCD-2.8CI2C connector: SDA 15, SCL 7Same I2C bus as the touch controller, the IO expander, the RTC and the IMU (addresses 0x15/0x5D, 0x20, 0x51, 0x6B, 0x7E taken)
Waveshare ESP32-S3-LCD-7BI2C connector (H1): SDA 8, SCL 9Same I2C bus as the touch controller (GT911) and the IO expander (CH422G)

Good to know

  • Gain does not raise the input limit.
  • Use a divider for 5 V signals on a 3.3 V supply.
  • It is too slow for audio.
  • Check for address clashes.

What it is good for

  • Boards with no free ADC pins
  • Pressure and thermistor readings
  • Better resolution than the ESP32 ADC

FAQ

Can the ADS1115 measure 5 V on a 3.3 V supply?

No. The input must stay within about VDD + 0.3 V. Use a divider.

How many can share one bus?

Up to four, set with the ADDR pin.

Why are my readings capped?

The range may be too small for the signal.

Sources

Related parts

Use this information at your own risk. It is for general guidance only: the example code compiles, but it has not been tested on every part, and modules differ between sellers. Check the manufacturer's data before you build. Product names belong to their owners, and LCD Ultra Pro is not affiliated with them. See our Terms.