How to Add a Raspberry Pi Potentiometer

It's time to crank your project up to 11.
Ash Ash (362)
30 minutes

The Raspberry Pi is an incredibly capable pocket sized machine. It’s compatible with a variety of external hardware that can be programmed for specific uses. It’s common to find Pi projects that require buttons, switches, and even servo motors!

But today we’re kicking things up a notch! In this guide, we’ll be setting up a potentiometer to work with the Raspberry Pi.

Pi potentiometer uses

These devices are very useful and one of the most versatile components for Pi projects. They can be used to adjust volume, the brightness of a light source, or even dial in a radio frequency.

I’ll be using a Raspberry Pi with the latest version of Raspberry Pi OS (formerly Raspbian) installed. Before you begin, it’s best to visit our guide on how to update Raspberry Pi OS.

Raspberry PiRaspberry Pi ×1
Adafruit ADS1015 ADC chip ×1
Panel mount 10K potentiometer ×1

Howchoo is reader-supported. As an Amazon Associate, we may earn a small affiliate commission at no cost to you when you buy through our links.

Prepare the ADC adapter chip

The Raspberry Pi connects to external devices using GPIO pins. In order for the Pi to make sense of the new input, we will need to use an analog-to-digital converter, or “ADC”, chip to convert the analog input into a readable digital format. The chip serves as a kind of translator, letting us call the potentiometer input in our own custom code.

In this guide, I’m using an Adafruit 1015 ADC chip. The chip arrives with an assortment of pins that need to be soldered into place. Carefully solder the pins to the ADC chip.

Enable I2C on the Raspberry Pi

In order for the Raspberry Pi to talk to the chip, we need to enable I2C. Connect to the Pi using a terminal and run the following two commands. This will install the I2C tool we need to proceed.

sudo apt-get install -y python-smbus
sudo apt-get install -y i2c-tools

Open the Raspberry Pi configuration menu using the following string.

sudo raspi-config

Newer versions of the Pi will have an option called Interfacing Options. Older editions use the Advanced Options selection to reach the I2C settings. Using the appropriate menu screen, enable I2C on the Raspberry Pi.

Wire the ADC chip to the Pi

Now it's time to wire up our freshly soldered ADC chip. Be sure to power off your Raspberry Pi with the following command.

sudo poweroff

To help showcase the connections we're making, I'm using a breadboard with a Raspberry Pi GPIO breakout board attachment. This makes it much easier to highlight individual connections. This step contains instructions for the ADS1015 chip. If you’re using a different ADC chip, you will need to search for proper wiring steps from the manufacturer.

The following points on the ADC chip are listed with their respective Pi connection points. We only need 4 male to male jumper wires for this step.

ADS1015 Raspberry Pi
VDD 3.3V
GND GND
SCL SCL
SDA SDA
Install an appropriate Python library

The ADC chip I'm using for this guide requires a specific Python library from Adafruit. This step contains installation instructions for ADS1015 and ADS1115 chips. If you're using a different ADC chip, you will need instructions specific to your device. Check with the manufacturer and research online to find the library you need.

Power on the Pi and run the appropriate script for your ADC chip library. If you’re using an ADS1015 or ADS1115, run the following commands.

sudo apt-get update
sudo apt-get install build-essential python-dev python-smbus git
cd ~
git clone https://github.com/adafruit/Adafruit_Python_ADS1x15.git
cd Adafruit_Python_ADS1x15
sudo python setup.py install
Raspberry Pi potentiometer wiring diagram

Power off the Raspberry Pi using the following command.

sudo poweroff

The potentiometer I’m using in the example has three prongs. The center prong will be connected to the ADC chip. The outer prongs are for +/- power. Using three female to male jumper wires, connect the potentiometer to the Raspberry Pi. The following table highlights the appropriate connection for the ADS1015 chip.

Potentiometer ADC Pi
Left Prong 3.3V
Center Prong A0
Right Prong GND
Test the connection

In order to test our setup, we'll be using the example files provided by Adafruit. Navigate to the examples folder using the following command.

cd ~/Adafruit_Python_ADS1x15/examples

This step includes information for the ADS1115 chip. The Adafruit website contains additional information about modifying the test file for the ADS1015 chip.

Run the following script to initiate the test file.

sudo python simpletest.py

Rotating the potentiometer knob should generate a visible change in the readout from the Pi. Congratulations! Your Pi projects can be customized like never before. Not sure where to start? Check out our awesome Raspberry Pi guides for inspiration!

Getting started with the Raspberry Pi OS installation program.
Ash Ash (362)
10 minutes

Update: This article refers to older editions of applications that are no longer relevant to the Raspberry Pi ecosystem. The NOOBS application has been replaced by Raspberry Pi Imager.