Verified by our editorial teamSimulated in Proteus 9.0 SP2

MCP41100 an Arduino Controlled Potentiometer

MCP41100 an Arduino Controlled Potentiometer | the analog potentiometer three-terminal resistor with a sliding and an adjustable voltage divider

Tags mcp41100
Avatar of Ibrar Ayyub
By Ibrar Ayyub
Published April 25, 2016
At a glance
CategoryInterfacing(USB – RS232 – I2c -ISP) Projects
DifficultyIntermediate
IncludesCode, Diagrams, Datasheets
UpdatedDecember 1, 2026
Reading timeabout 10 min
On this page

Summary of MCP41100 an Arduino Controlled Potentiometer


Summary: This guide shows how to control an MCP41100 digital potentiometer with an Arduino via SPI to replace analog pots. It covers required materials, MCP41100 characteristics and resistance calculation, Arduino example code to sweep the wiper across 256 taps, and simple applications like LED dimming and DC motor speed control using the pot with a 555 PWM circuit.

Parts used in the MCP41100 Arduino Controlled Potentiometer:

  • Arduino Board
  • Digital Potentiometer MCP41100
  • Resistor 100 Ohm
  • LED
  • Breadboard
  • Jumper Wires
11 min read

A normal potentiometer needs a hand to turn it. The MCP41100 digital potentiometer is a chip that does the same job, a 100 kilohm adjustable resistor, but the Arduino sets the value over three wires. This page explains how it works, how to wire it, how to calculate the resistance for any setting, and a sketch that sweeps it and measures the result. It also covers the limits the datasheet puts on it, which the usual quick tutorials skip.

HOW THIS PAGE WAS CHECKED

Datasheet verified by us. The command byte, the 256 taps, the wiper resistance and the current limits were checked against the Microchip MCP41XXX/42XXX datasheet (DS11195C). Page numbers are quoted where each figure is used, and the datasheets are linked in the resources box below.

Simulated in Proteus 9.0 SP2, run by us. We built the circuit and ran the sketch ourselves in Proteus 9.0 SP2 Professional (Build 40482). The screenshots and the files we used are on this page. The sketch was run on a simulated ATmega328P at 16 MHz with an SPI analyser on CS, SCK and SI. Each write appeared as one frame, the command byte 0x11 followed by the code (0x20, 0x40, 0x60, 0xA0, 0xC0, 0xE0 and so on), at the pace the sketch sets. The simulator has no MCP41100 model, so the resistance and voltage values on this page come from the datasheet formulas, not from the simulation. See the screenshots and download the files.

IN SHORT
  • The MCP41100 has 256 wiper positions and talks SPI, so it needs only CS, SCK and SI from the Arduino.
  • Resistance from the wiper to terminal A is about 100 k times (256 minus the code) over 256, plus about 125 ohms of wiper resistance.
  • The wiper can carry only 1 mA, so it is made to set voltages and timing, not to drive an LED or a motor directly.
  • The 100 k value is only accurate to plus or minus 30 percent from chip to chip, so measure if you need precision.
256
wiper positions
100 kΩ
nominal (70 to 130 kΩ)
2.7 to 5.5 V
supply
SPI
up to 10 MHz

Our Proteus simulation: schematic, screenshots and files

We ran the sketch from this page in Proteus 9.0 SP2 Professional with an SPI analyser on the chip-select, clock and data lines. These are our own screenshots. Click any screenshot to enlarge it. Proteus has no MCP41100 digital potentiometer model, so only the SPI side was simulated.

Proteus 9.0 SP2 schematic with the SPI debugger and virtual terminal open
Our Proteus schematic with the SPI debugger and the virtual terminal.
SPI debugger showing frames 11 A0, 11 C0 and 11 E0
Each write is one frame: command byte 0x11 (write pot 0) followed by the code, here 0xA0, 0xC0 and 0xE0.
Virtual terminal showing the code, resistance and expected voltage columns
Serial output: codes, calculated wiper resistance and expected voltage. The measured column reads 0.00 because no digital pot is in the simulation.
💾 Download our simulation files (mcp41100-digital-pot-proteus-files.zip)
Zip with the compiled .hex, the Arduino sketch, the Proteus project (.pdsprj) and a README. Open the .pdsprj in Proteus 9.0 SP2 or newer, check the Program File path points to the .hex, and press Play.

What this proves: the sketch sends the right SPI bytes at the right pace. What it does not: the resistance and voltage values on this page come from the datasheet formulas, not from the simulation.

Why use a digital potentiometer?

An ordinary potentiometer is a resistor with a sliding contact, the wiper. Turning the knob moves the wiper and sets a voltage divider. It is used for volume controls, amplifier gain and offset, and position sensors. A microcontroller has no easy way to turn a knob, so when you want a program to change a resistance, you need a digital potentiometer: the same three terminals (A, B and the wiper W), but the wiper position is a number you send to the chip.

Typical uses are the ones listed for analog pots: volume control, setting the gain or offset of an amplifier, and measuring position. Because the setting is a number, a program can also store it, recall it, or sweep it.

The chip and its pins

Pin Name Function
1 CS Chip select (low to talk to it)
2 SCK Serial clock
3 SI Serial data in
4 VSS Ground
5 PA0 Terminal A
6 PW0 Wiper
7 PB0 Terminal B
8 VDD Supply, 2.7 to 5.5 V

The MCP41100 is the 100 kilohm single-channel member of the MCP41XXX family. The 10 k and 50 k versions are the MCP41010 and MCP41050, and the MCP42XXX parts have two channels. On power-up the wiper goes to the middle position (code 128) (datasheet p. 1). The chip uses the SPI bus, which the Arduino SPI library handles for you.

What you need

Arduino Uno
MCP41100 (8-pin DIP)
100 ohm resistor and an LED
Breadboard and jumper wires

Wiring

Arduino Uno D10 (CS)D13 (SCK)D11 (MOSI)5VGNDA0 (to measure) MCP41100 1 CS2 SCK3 SI4 VSS 5 PA06 PW0 (wiper)7 PB08 VDD Pin 4 (VSS) and pin 7 (PB0) to GND, pin 8 (VDD) to 5V Wiper (pin 6) to A0 for our test sketch. For the LED demo, wiper to LED through 100 ohm.

MCP41100 pin Connects to
1 CS Arduino D10
2 SCK Arduino D13
3 SI Arduino D11 (MOSI)
4 VSS, 7 PB0 GND
5 PA0, 8 VDD 5V
6 PW0 (wiper) Your load, or A0 to measure it

Three details that matter

The wiper can only carry 1 mA. The datasheet limits the wiper current to plus or minus 1 mA (datasheet p. 4). The LED demo works as a demonstration, because it just dims, but it runs the chip outside that limit. To drive an LED, a motor or a speaker, use the wiper as a control signal and add a transistor or an op-amp buffer.
Do not leave CS floating. The chip only listens while CS is low. Set CS as an output, and drive it high when you are not sending, so noise on the SPI lines cannot change the wiper.
Keep terminal voltages between 0 V and VDD. The A, B and W terminals must stay inside the supply range, so this chip cannot pass a signal that swings negative.

Calculating the resistance

The chip has 256 steps. With D the code you send (0 to 255), RAB the end-to-end resistance (100 k nominal) and RW the wiper resistance (typically 125 ohms):

  • Wiper to A: RWA = RAB x (256 minus D) / 256 + RW
  • Wiper to B: RWB = RAB x D / 256 + RW

Example: for D = 222, RWA = 100,000 x 34 / 256 + 125 = 13,281 + 125 = about 13.41 kΩ.

Code D RWA (wiper to A) RWB (wiper to B) Divider output at 5 V
0 100.1 kΩ 125 Ω 0 V
64 75.1 kΩ 25.1 kΩ 1.25 V
128 (power-up) 50.1 kΩ 50.1 kΩ 2.50 V
192 25.1 kΩ 75.1 kΩ 3.75 V
222 13.4 kΩ 86.8 kΩ 4.34 V
255 516 Ω 99.7 kΩ 4.98 V

The last column is the unloaded voltage with A at 5 V and B at ground: VDD x D / 256. The table uses the nominal 100 k. The datasheet allows 70 to 130 k from chip to chip (datasheet p. 4), so the real resistance can differ by up to 30 percent. The ratio (and so the divider voltage) is far more accurate than the absolute resistance, which is why the chip is best used as a divider.

The code

Each update is two bytes. The first is the command byte: 0x11 means “write data to potentiometer 0” (the command bits C1 C0 are 0 1, and the potentiometer select bit is 1). The second byte is the code, 0 to 255. Pull CS low, send the two bytes, and pull CS high to make the chip act on them. Sending 0x21 instead puts the pot into shutdown, which opens terminal A and ties the wiper to B.

This is our own sketch. It steps through nine codes, and for each one it prints the calculated resistance and the expected and measured voltage on the wiper, read on A0. That lets you check your build against the table above.

// duino4projects.com
#include <SPI.h>

const int CS_PIN = 10;               // chip select, pin 1 of the MCP41100
const byte CMD_WRITE_POT0 = 0x11;    // write data to potentiometer 0
const float R_AB = 100000.0;         // nominal 100 k (really 70 to 130 k)
const float R_W  = 125.0;            // typical wiper resistance

const byte codes[] = {0, 32, 64, 96, 128, 160, 192, 224, 255};

void potWrite(byte value) {
  digitalWrite(CS_PIN, LOW);
  SPI.transfer(CMD_WRITE_POT0);
  SPI.transfer(value);
  digitalWrite(CS_PIN, HIGH);
}

void setup() {
  pinMode(CS_PIN, OUTPUT);
  digitalWrite(CS_PIN, HIGH);        // idle high
  SPI.begin();
  Serial.begin(9600);
  Serial.println("code  Rwa(kohm)  expected V  measured V");
}

void loop() {
  for (byte i = 0; i < sizeof(codes); i++) {
    byte d = codes[i];
    potWrite(d);
    delay(50);
    float rwa = (R_AB * (256 - d) / 256.0 + R_W) / 1000.0;
    float expectedV = 5.0 * d / 256.0;
    float measuredV = analogRead(A0) * 5.0 / 1023.0;
    Serial.print(d);            Serial.print("     ");
    Serial.print(rwa, 1);       Serial.print("       ");
    Serial.print(expectedV, 2); Serial.print("        ");
    Serial.println(measuredV, 2);
    delay(500);
  }
  Serial.println();
  delay(2000);
}

Open the Serial Monitor at 9600 baud. If PA0 is at 5 V and PB0 at ground, the measured voltage should follow the expected voltage to within a few hundredths of a volt. A simple LED test does the same thing: write codes 0, 128 and 255 for a second each, then sweep the code up and down in a loop. In the motor sketch the sweep pauses for a second at the top and steps faster on the way down.

Seeing it work

Sweeping the code while watching the wiper on an oscilloscope is a good test. A repeating up and down sweep shows on the screen as a triangle wave.

A use: motor speed with a 555 timer

A second example controls the speed of a DC motor. A 555 timer makes a PWM signal, the digital potentiometer takes the place of the timing resistor, and so the Arduino can change the duty cycle, and with it the motor speed, by changing the wiper code. A transistor switches the motor, so the 555, not the potentiometer, carries the motor current. This is also the right way to use any digital pot: as a setting for another circuit, not as the power path.

If it does not work

What you see Likely cause What to do
Measured voltage never changes (about 2.5 V) Chip not receiving data, so it stays at the power-up value (code 128) Check CS on D10, SCK on D13, SI on D11 and that VDD is powered
Voltage is 0 V or 5 V at every code PA0 and PB0 not wired to 5 V and ground Connect PA0 to 5V and PB0 to GND as in the table
LED barely changes brightness Wiper current limit of 1 mA Buffer the wiper with a transistor or op-amp
Resistance differs a lot from the table The 100 k value has a 70 to 130 k tolerance Measure RAB with a multimeter and use that in the formula
Sketch does not compile Older listing with a missing brace Use the sketch on this page

Which digital potentiometer?

Part Interface Steps and channels Good for
MCP41100 (this page) SPI 256 steps, 1 channel The simplest start: one chip, three wires
MCP4131 SPI 128 steps, 1 channel When 128 steps are enough and a library is handy (different command format, so the sketch above will not work)
AD5206 SPI 6 channels in one chip Several pots at once, and the part used in the official Arduino example
X9C103 3-wire up/down control About 100 steps, 10 k A simple step-up and step-down interface, not SPI

Our view: the MCP41100 is a good first digital pot. It has more steps than most and a simple command, and it teaches the SPI pattern you will use for many other chips. Choose it for volume controls, gain, and divider-style settings. For heavy loads or precise absolute resistance, add a buffer or pick a part specified for the job.

Related projects: potentiometers and Arduino

Project resources and downloads

Datasheets and documents for the parts in this build. Page numbers quoted on this page refer to these files.

  • 💾 Schematic and simulation files (zip)
    Zip. Our circuit schematic as a Proteus project (.pdsprj), the program that ran in it and a README, from our run in Proteus 9.0 SP2.
  • 📄 MCP41XXX/42XXX datasheet (Microchip, DS11195C)
    PDF, 32 pages, about 0.9 MB, revision C. Electrical limits (page 4), resistance formula (page 16), command byte (page 17), SPI modes (page 22).
  • 📚 Arduino: SPI library
    Web page. How the Arduino SPI bus is used in the sketch.
  • 💾 Arduino code and ready-to-upload program (zip)
    Zip, a few KB. The Arduino program from this page, the compiled file ready to upload, and a README. Sweeps nine wiper codes over SPI and prints the calculated resistance and voltage next to the measured voltage. Open it in the Arduino IDE, pick your board and upload.

Quick answers

How many positions does the MCP41100 have?
256, set by an 8-bit code from 0 to 255.
What value does it start at?
The middle, code 128 (80h), every time it powers up.
Can I use it to dim an LED or run a motor?
Not directly. The wiper is limited to 1 mA. Use it to set a voltage or timing, and let a transistor or op-amp carry the current.
Can I use it on a 3.3 V board?
Yes. The supply range is 2.7 to 5.5 V.

Check your own build

Run the sketch and compare the “expected V” and “measured V” columns. They should agree closely at every step. To check the resistance itself, power the circuit down, disconnect the wiper from everything else, and measure between PA0 and PB0 with a multimeter. That is the chip’s real RAB, and it should be inside the 70 to 130 k tolerance. Use that number in the formulas for more accurate results.

Share this project
X
LinkedIn
Reddit
WhatsApp

Quick Solutions to Questions related to MCP41100 Arduino Controlled Potentiometer:

  • What is the MCP41100 used for?
    The MCP41100 is a digital potentiometer used to adjust resistance digitally for applications like volume control, amplifier gain/offset, and displacement transducers.
  • How does the Arduino communicate with the MCP41100?
    The Arduino communicates with the MCP41100 using the SPI protocol.
  • Which Arduino pins are used to connect to the MCP41100 in the example?
    CS to D10, SCLK to D13, and DI to D11.
  • How many steps or taps does the MCP41100 have?
    The MCP41100 has 8-bit resolution with 256 taps.
  • What is the nominal resistance of the MCP41100 in the article?
    The nominal resistance Rab is 100 K ohm.
  • What is the typical wiper resistance value mentioned?
    The typical wiper resistance is 125 ohm.
  • How do you calculate the wiper resistance for a given code example?
    The article gives an example: for code 222, Rwa = (100*10^3)*(256-222)/256 - 125 = 13.41 K ohm.
  • Can the MCP41100 be used to control LED brightness and motor speed?
    Yes, the article shows simple applications controlling LED and DC motor speed using the MCP41100 with Arduino and a 555 PWM circuit.
  • What initial wiper positions are set in the example setup?
    The example sets highest resistance (0x00), midpoint (0x80), and lowest resistance (0xFF) with delays between each.
Scroll to Top