Electronics Design AU
Raspberry Pi

How Do You Add Analog Input (ADC) to a Raspberry Pi With an MCP3008 or ADS1115?

Last updated 22 July 2026 · 15 min read

Direct Answer

Every GPIO pin on a Raspberry Pi is digital-only; the Pi's BCM SoC has no analog-to-digital converter, unlike an Arduino or most microcontrollers. To read an analog voltage, add an external ADC chip. The MCP3008 is an 8-channel, 10-bit SAR ADC that connects over SPI and is the common default for simple sensor reading. The ADS1115 is a 4-channel, 16-bit ADC with a programmable gain amplifier that connects over I2C and suits lower-level or higher-precision signals. Both are read from Python using dedicated libraries (spidev for the MCP3008, smbus2 or Adafruit's CircuitPython driver for the ADS1115) rather than a single analogRead()-style call.

Detailed Explanation

Engineers coming from Arduino or a general-purpose microcontroller expect analogRead(pin) to work on any board with the word "Pi" in its name. On a Raspberry Pi it does not, because the board has no analog input at all. This trips up a lot of first-time Pi sensor projects, and it's worth understanding why before working out how to fix it.

Why the Raspberry Pi Has No Built-In ADC

The Raspberry Pi 4, 5, Zero 2 W, and the Compute Modules are built around a Broadcom BCM SoC (BCM2711 on the Pi 4/CM4, BCM2712 on the Pi 5/CM5) designed as an application processor for a Linux-based single-board computer, not as a microcontroller. Every one of its 40-pin header's GPIO pins is a digital pin: it can be driven or read as a logic high or low, and configured for digital peripheral functions such as I2C, SPI, UART, and PWM, but none of them can measure a continuous analog voltage. This is a design choice consistent with how the SoC is built, not a limitation of a particular board revision; there is no Raspberry Pi model in the 4, 5, Zero 2 W, or CM4/CM5 line that has a native ADC peripheral.

This is a genuine architectural difference from most microcontrollers. An STM32, an ESP32, or an Arduino's AVR or SAMD chip integrates a SAR ADC directly on the die, so reading an analog voltage is a single register configuration and one function call. See how the STM32 ADC is configured or how the ESP32's ADC and timers work for what that built-in equivalent looks like. On the Raspberry Pi, the only way to measure an analog voltage is to add an external ADC chip and read it over a digital bus such as SPI or I2C.

The Raspberry Pi Pico and Pico 2 are a separate product line built around the RP2040 and RP2350 microcontrollers, and those chips do include a built-in ADC. If a project is confusing "a Raspberry Pi" with "a Pico" while researching analog input, that distinction is worth resolving first, since it changes the entire approach. This page covers adding analog input to the SBC-class Raspberry Pi boards (4, 5, Zero 2 W, CM4/CM5), which have no ADC of their own.

Two Ways to Add an External ADC: SPI or I2C

Two chips cover the large majority of Raspberry Pi analog-sensing projects, and they represent the two practical interface choices:

  • MCP3008 (Microchip): an 8-channel, 10-bit successive-approximation register (SAR) ADC that connects over SPI, per the manufacturer's datasheet. It's inexpensive, widely documented, and simple to wire, making it the default choice for straightforward sensor reading such as potentiometers, photoresistors, and basic analog outputs from other sensors.
  • ADS1115 (Texas Instruments): a 4-channel (single-ended) or 2-channel (differential) 16-bit ADC with an on-chip programmable gain amplifier (PGA), connecting over I2C, per the manufacturer's datasheet. Its higher resolution and PGA make it a better fit for low-amplitude or differential signals, such as a load cell bridge or a sensor with a small output swing that needs amplification before conversion.

Both chips run on 3.3 V, matching the Pi's logic level directly, so neither needs level shifting when powered from the Pi's own 3.3 V rail.

Wiring and Reading the MCP3008 (SPI, 10-Bit)

The MCP3008 has 16 pins: eight analog input channels (CH0–CH7), a VDD and a VREF pin, an AGND and a DGND pin, and the four SPI signals (CLK, DOUT, DIN, and CS/SHDN). On a Raspberry Pi, wire it to the SPI0 bus on the 40-pin header:

MCP3008 pinRaspberry Pi connection
VDD, VREF3.3 V (physical pin 1 or 17)
AGND, DGNDGND
CLKSPI0 SCLK (GPIO 11, physical pin 23)
DOUTSPI0 MISO (GPIO 9, physical pin 21)
DINSPI0 MOSI (GPIO 10, physical pin 19)
CS/SHDNSPI0 CE0 (GPIO 8, physical pin 24)

Enable SPI first (see how to interface sensors and peripherals with Raspberry Pi GPIO for the general SPI and I2C enabling steps), then read a channel with the spidev library:

import spidev

spi = spidev.SpiDev()
spi.open(0, 0)                 # SPI bus 0, chip select 0
spi.max_speed_hz = 1_000_000

def read_channel(channel):
    # Start bit, single-ended mode + channel select, then 2 don't-care bytes
    cmd = [1, (8 + channel) << 4, 0]
    reply = spi.xfer2(cmd)
    result = ((reply[1] & 3) << 8) + reply[2]  # 10-bit result
    return result

raw = read_channel(0)          # 0-1023
voltage = raw * 3.3 / 1023

The MCP3008 datasheet specifies a maximum sample throughput of 200 ksps at a 5 V supply and 75 ksps at 2.7 V; running it from the Pi's 3.3 V rail gives a datasheet-specified maximum somewhere between those two figures, well above what a Python loop calling spi.xfer2() a few hundred times a second will ever approach. In practice, Linux SPI transaction overhead from userspace, not the chip's own conversion time, is what limits achievable sample rate in a typical Python-based project.

Wiring and Reading the ADS1115 (I2C, 16-Bit)

The ADS1115 uses I2C, so it shares the same bus as any other I2C sensor on the board:

ADS1115 pinRaspberry Pi connection
VDD3.3 V
GNDGND
SCLI2C-1 SCL (GPIO 3, physical pin 5)
SDAI2C-1 SDA (GPIO 2, physical pin 3)
ADDRGND, VDD, SDA, or SCL (sets the I2C address)

The ADDR pin is what lets more than one ADS1115 share the same I2C bus: tying it to GND, VDD, SDA, or SCL sets the device address to 0x48, 0x49, 0x4A, or 0x4B respectively, per the datasheet, so up to four boards can coexist on I2C-1 without an address conflict.

The most direct approach in Python uses Adafruit's CircuitPython driver over Blinka, which handles the register-level configuration:

import board
import busio
from adafruit_ads1x15.ads1115 import ADS1115
from adafruit_ads1x15.analog_in import AnalogIn

i2c = busio.I2C(board.SCL, board.SDA)
ads = ADS1115(i2c)
chan = AnalogIn(ads, 0)        # single-ended channel 0

print(chan.value, chan.voltage)

The same read is possible directly over smbus2 by writing the configuration register and polling the conversion-ready bit, which avoids the extra dependency but requires implementing the register map from the datasheet by hand. The CircuitPython driver is the more practical starting point for most projects; drop to raw smbus2 register access when a project needs to minimise dependencies or match an existing register-level I2C codebase, as described for other I2C sensors in the Raspberry Pi GPIO interfacing guide.

The datasheet specifies configurable data rates from 8 SPS to 860 SPS. As with the MCP3008, the ADS1115's own conversion speed is rarely the bottleneck in a Python project; I2C bus speed (typically 100 kHz or 400 kHz on the Pi) and the overhead of each Python-level read call matter more in practice, especially if the same bus is shared with other I2C devices.

Choosing Between the MCP3008 and ADS1115

The two chips solve overlapping but distinct problems, and picking between them comes down to a handful of practical questions:

  • Resolution needed. The MCP3008's 10-bit resolution (1024 steps) is enough for most everyday sensing: potentiometers, light-dependent resistors, basic thermistor voltage dividers. The ADS1115's 16-bit resolution (65,536 steps, or effectively 15 bits of usable range for a single-ended reading, since half the code range is reserved for negative values in differential mode) resolves much smaller voltage changes, which matters for low-output sensors such as strain gauges or thermocouples.
  • Channel count. The MCP3008 gives eight channels on a single chip; the ADS1115 gives four single-ended channels (or two differential pairs). A project needing many analog inputs on one bus generally reaches for the MCP3008 or for multiple ADS1115 boards at different I2C addresses.
  • Bus sharing. SPI is effectively point-to-point per chip select line, so an MCP3008 doesn't contend with other SPI peripherals in the same way I2C devices share a single bus. If the design already has several I2C sensors and no free SPI chip-select lines, that constraint alone can decide the choice.
  • Differential and low-level signals. The ADS1115's PGA can amplify a small differential signal (down to a ±0.256 V full-scale range) before conversion, which the MCP3008 cannot do at all: it only accepts single-ended inputs referenced to ground, up to VREF. For a bridge sensor or a thermocouple with a small output, the ADS1115's PGA is usually the more practical starting point instead of adding a separate external amplifier stage ahead of the MCP3008.
  • Sampling rate. For applications that need to sample many channels quickly, the MCP3008's SPI interface and its higher datasheet throughput make it the faster option in most designs; the ADS1115's higher resolution comes at the cost of a lower maximum data rate.

Reference Voltage and Its Effect on Resolution and Accuracy

Both chips convert relative to a reference voltage, and the choice of reference has a direct, calculable effect on measurement resolution.

For the MCP3008, VREF is a separate pin, commonly tied to the same 3.3 V supply as VDD in most Raspberry Pi projects. With VREF = 3.3 V and 10-bit resolution, each LSB represents 3.3 V / 1024 ≈ 3.22 mV. Tying VREF to a lower, more stable reference (such as a dedicated 2.048 V or 2.5 V part, as covered in what is a voltage reference IC?) narrows the measurable input range but improves resolution within that range, since the same 1024 steps now span a smaller voltage window.

For the ADS1115, the reference is set indirectly through the PGA gain setting rather than a dedicated VREF pin, and it determines the full-scale input range: a ±4.096 V gain setting gives an LSB of roughly 0.125 mV, while the most sensitive ±0.256 V gain setting gives an LSB of about 7.8 µV. Selecting a gain setting that doesn't clip the expected input, and no wider than necessary, is the main tuning step for getting useful resolution out of the ADS1115 in a given project. On a 3.3 V-powered Pi system, the ±4.096 V or ±2.048 V ranges usually make the most sense, since a wider range wastes resolution on voltages the sensor will never actually reach.

In both cases, the reference itself needs to be stable and low-noise, because any noise or drift on the reference directly translates into measurement error, exactly as covered in general terms in what is an ADC and how does it work?

Noise and Grounding for Analog Readings Near a Pi

A Raspberry Pi is a considerably noisier neighbour for a low-level analog signal than a typical microcontroller eval board. The BCM SoC, USB 3.0 controller, HDMI transmitter, and (on the Zero 2 W and other wireless-equipped boards) the Wi-Fi and Bluetooth radio all switch at high frequencies close to the GPIO header, and that switching activity can couple into nearby analog wiring more readily than it would on a quieter single-purpose MCU board.

Practical steps that matter for a Pi-based analog front end:

  • Keep sensor and ADC wiring physically separated from USB, HDMI, and Ethernet cabling and traces where practical, and keep analog lead lengths as short as the application allows.
  • Give the ADC's ground a short, direct connection back to the Pi's ground rather than routing it through a long shared return path with digital peripherals.
  • Add local decoupling (a 100 nF ceramic capacitor close to the ADC's VDD pin, per common analog IC layout practice) even on a breadboard or prototype build, since the Pi's own 3.3 V rail carries switching noise from the rest of the board.
  • For sensitive or long-lead signals, twisted-pair or shielded cable between the sensor and the ADC input reduces coupled noise significantly compared to a single unshielded wire.
  • Where the source impedance is high or the reading is noisy, oversampling (averaging repeated conversions in software) trades sample rate for reduced noise, the same technique covered generally for any ADC.

None of this differs in principle from good analog practice on any board; it matters more on a Raspberry Pi specifically because the digital neighbourhood is busier than on a dedicated low-noise sensor board.

Practical Examples

Reading a potentiometer or light sensor with the MCP3008. A simple voltage divider (a potentiometer, or a photoresistor paired with a fixed resistor) connects directly to one MCP3008 channel, with the divider's output wired to CH0 and its ends to 3.3 V and GND. The Python read_channel() example above returns a 0–1023 value that scales linearly with the divider's output voltage. This is the most common first Raspberry Pi ADC project and needs no PGA or differential input, making the MCP3008 the natural choice.

Reading a small differential signal with the ADS1115. A load cell wired to an HX711-style bridge output, or any sensor producing a small differential voltage, connects across two ADS1115 input pins configured for differential reading (AnalogIn(ads, ADS1115.P0, ADS1115.P1) in the CircuitPython driver) with an appropriately narrow PGA gain setting. The 16-bit resolution and PGA amplification resolve millivolt-level signals that would be lost in the MCP3008's 10-bit, unamplified single-ended input.

Combining channel counts. A monitoring project needing more analog inputs than either chip offers alone can run an MCP3008 on SPI0 for eight lower-precision channels (temperature via thermistor, light level, several potentiometers) alongside an ADS1115 on I2C-1 for one or two channels that need higher resolution (a precision reference measurement, a small-signal sensor), since the two buses operate independently and don't contend for the same pins. For a project that needs many more channels than either chip provides on its own, an analog multiplexer ahead of a single ADC channel is another way to expand channel count, at the cost of a small per-channel settling delay.

Design Considerations

  • Decide resolution and channel-count needs before choosing a chip, not after wiring one up. Retrofitting a design from the MCP3008 to the ADS1115 (or vice versa) means rewiring from SPI to I2C or back, not just a software change, so working out the actual resolution and channel requirements early avoids a hardware respin.
  • Reserve SPI0's chip-select line if a HAT-style board might be added later. A custom board that needs to reserve SPI0 CE0 for an MCP3008 should account for that when planning any other SPI peripheral, since only two chip selects are available on SPI0 by default (dtoverlay=spi0-2cs for both).
  • Treat the ADS1115's ALERT/RDY pin as optional but useful for higher-rate polling. Configuring the ADS1115's ALERT/RDY pin to pulse on conversion-ready, and wiring it to a Pi GPIO input with an edge-triggered read, avoids polling the I2C bus faster than a conversion actually completes, which wastes bus bandwidth on a shared I2C-1 bus with other sensors.
  • Match reference or gain range to the actual signal, not the widest available setting. Leaving the ADS1115 at its widest ±6.144 V gain range when the signal only spans 0–3.3 V wastes most of the chip's usable resolution; narrowing the gain to bracket the expected signal range is the single most effective step for getting useful precision out of either chip.
  • A custom carrier board or HAT integrating an MCP3008 or ADS1115 needs the same analog layout care as any mixed-signal PCB: separated analog and digital ground pours, short reference and input traces, and local decoupling right at the ADC pins. Zeus Design's embedded and firmware team handles this kind of sensor front-end interfacing and firmware for Raspberry Pi-based products end to end.

Common Mistakes

  • Expecting a Pi GPIO pin to behave like an Arduino analog pin. Every Raspberry Pi GPIO pin is digital-only; connecting an analog sensor's output directly to a GPIO pin and reading it with a digital library returns nothing meaningful, because the pin can only register a high or low logic level, not a voltage level.
  • Confusing the Raspberry Pi Pico's built-in ADC with the Raspberry Pi SBC line. The Pico and Pico 2 have a native ADC because they are microcontroller boards; the Pi 4, Pi 5, Zero 2 W, and Compute Modules do not, because they are SoC-based single-board computers. Searching Pico-specific analog code and applying it to a full Raspberry Pi project will not work.
  • Leaving VREF (MCP3008) or the PGA gain (ADS1115) at a default that doesn't match the actual signal range. This either clips the reading (gain too high, reference too low for the signal) or wastes most of the ADC's resolution on a range the signal never uses (gain too low, reference too high).
  • Underestimating Linux SPI/I2C call overhead when a project needs a high effective sample rate. The datasheet throughput figures for both chips (200 ksps for the MCP3008, up to 860 SPS for the ADS1115) describe the chip's own conversion speed, not the achievable rate from a Python loop issuing individual bus transactions; a tight timing budget usually needs batched transfers, a compiled language, or a co-processor MCU instead of a straightforward Python polling loop.
  • Ignoring ground routing between the sensor, the ADC, and the Pi. A long or shared ground return path between a sensor and the ADC picks up noise from the Pi's own digital switching activity, showing up as jitter or offset in otherwise correctly wired analog readings.

Frequently Asked Questions

Can a Raspberry Pi Pico read analog input directly, unlike a regular Raspberry Pi?
Yes, and this is a common source of confusion because both boards share the Raspberry Pi name. The Pico and Pico 2 are microcontroller boards built around the RP2040 or RP2350, and those chips include a built-in SAR ADC (three usable 12-bit input channels on the Pico), so a simple onboard reading works without an external chip. The Raspberry Pi 4, 5, Zero 2 W, and the Compute Modules are single-board computers built around a BCM SoC that has no ADC peripheral at all, so they always need an external ADC like the MCP3008 or ADS1115 for analog input. If a design already uses a Pico or a co-processor MCU alongside a full Raspberry Pi (a common pattern for real-time or analog-heavy tasks), routing analog sensors to the MCU's own ADC and passing the digitised result to the Pi over UART or SPI is often simpler than adding a separate external ADC chip. See the co-processor pattern in real-time control on Raspberry Pi for how that split typically works.
Can I use an MCP3008 and an ADS1115 on the same Raspberry Pi at once?
Yes. The MCP3008 sits on the SPI bus and the ADS1115 sits on the I2C bus, and the Raspberry Pi exposes both simultaneously with no conflict between them, since they use entirely separate pins and kernel interfaces. This is a reasonable way to combine a design's channel counts, for example using the MCP3008 for several lower-precision potentiometer or sensor inputs and the ADS1115 for one or two channels that need higher resolution.
What is the difference between the ADS1115 and the cheaper ADS1015?
The ADS1015 is the same family's lower-resolution, higher-speed sibling: 12-bit resolution instead of 16-bit, with a maximum data rate of 3300 SPS instead of the ADS1115's 860 SPS, per Texas Instruments' datasheets for both parts. The ADS1015 is the better fit when the application needs faster sampling and 12-bit resolution is enough (for example, reading a potentiometer or a fast-moving sensor); the ADS1115 is the better fit when resolution matters more than speed, such as resolving small voltage differences from a low-output sensor. Both share the same pinout, I2C address scheme, and programmable gain amplifier, so many designs can swap between them without other changes.

References

Related Questions

Related Forum Discussions