Fork me on GitHub

Project Notes

#264 DigitalPots/MCP42010

Control the MCP42010 dual 10kΩ digital potentiometer with an Arduino and hardware SPI.

Build

Notes

I’m trying out some digital potentiometers for an application. This is a test of the MCP42010 - the dual 10kΩ version of the MCP41XXX/MCP42XXX.

This is a pretty nice chip:

  • independant control of the two wipers via standard SPI
  • can be daisy-chained
  • 8-bit resolution for the wiper setting
  • polarity of the A/B pot connections does not matter
  • reset pin (sets wiper to middle position)
  • hardware/software shutdown control

Typical Applications:

  • Programmable gain circuits
  • Programmable differential input amplifier

SPI

It is possible to operate the device in SPI_MODE0 and SPI_MODE3

  • SPI_MODE0: Clock Polarity=0, Clock Phase=0
  • SPI_MODE3: Clock Polarity=1, Clock Phase=1

It supports a basic command + data byte structure, per the timing diagram from the datasheet:

spi_timing

Unfortunately it appears the MCP42010 cannot handle two commands in a single SPI transaction, hence if A and B wiper settings are different they need to be sent separately. If A and B wiper settings are the same, they can be sent in one command.

Test Program

The MCP42010.ino sketch is a simple test that drives the two wiper outputs with complementary triangle waves. This is what it looks like on a scope:

scope

Construction

I have the MCP42010 in a 14-Lead SOIC package, so I loaded it on an adapter for breadboard tests..

Build

Breadboard

Schematic

MCP42010_breadboard

Credits and References

About LEAP#264 ArduinoDigital PotMCP42010
Project Source on GitHub Project Gallery Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is just my personal collection of projects. Two main themes have emerged in recent years, sometimes combined:

  • electronics - usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting
  • scale modelling - I caught the bug after deciding to build a Harrier during covid to demonstrate an electronic jet engine simulation. Let the fun begin..
To be honest, I haven't quite figured out if these two interests belong in the same GitHub repo or not. But for now - they are all here!

Projects are often inspired by things found wild on the net, or ideas from the many great electronics and scale modelling podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know (or send a PR!). See the individual projects for credits where due.