How Does a Digital Potentiometer Work? Pairing with Arduino

Published By

Potentiometers are an essential component in many analog and digital circuits. By varying voltage levels, these devices can indicate user inputs to a microcontroller via an analog-to-digital converter. We can also use them to control voltage more directly in audio or other applications, or as a variation known as a rheostat, where resistance to current flow is varied directly.

It’s sometimes possible to emulate this type of functionality in the digital world by using pulse-width modulation (PWM), where an output rapidly turns on and off to simulate an analog signal. To truly modify voltage levels, however, we’ll need another solution. For this purpose, you can implement a digital potentiometer like the MCP41XXX/42XXX from Microchip.

How Does a Digital Potentiometer Work?

Digital potentiometers are available in three variations:

1. 10kΩ

2. 50 kΩ

3. 100kΩ

Each variation comes in either single or dual potentiometer packages. An SPI interface specifies resistance levels from 0-256, which we express in hexadecimal 0x00 to 0xFF. We can calculate resolution in ohms by dividing the total resistance by 256.

Therefore, a value of 0x80 (128) corresponds to half of the device’s total resistance– 5kΩ for the 10kΩ device, and so on.

How to Use a Digital Potentiometer

You’ll use these potentiometers in rheostat mode by connecting the chips wiper (PW0) pin to pin PA0 or PB0 (in a single potentiometer package, 0 dropped further in article). We’ll change the internal resistor as needed, increasing resistance between PA and PB as a rheostat. We can also reverse polarity in this mode without affecting operation.

As you’ve probably guessed, these devices can also act as potentiometers in two quick steps:

1. First, connect PA to one voltage level.

2. Connect PB to another voltage level, which may be ground in many applications.

We can express the resistance between PW and PA (RWA) as:

RAB(256-Dn)/256 +RW

We can express the resistance between PW and PB (RWB) as:

(Dn)/256 +RW

In this equation, Rw is the resistance of the wiper and Dn represents the 8-bit value passed to the pot from the digital controller. For further information and definitions relating to these terms, check out the digital potentiometer datasheet, available from Arrow.

Assuming PB is pulled to ground and voltage is on the wiper, PW will be equal to:

RWB / (RWB + RWA) x Vin

Digital Potentiometer with Arduino