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

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

Project Source on GitHub Return to the LEAP Catalog
About LEAP

LEAP is my personal collection of electronics projects - 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.

Projects are often inspired by things found wild on the net, or ideas from the many great electronics podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know or send a pull-request.

NOTE: For a while I included various scale modelling projects here too, but I've now split them off into a new repository: check out LittleModelArt if you are looking for these projects.

Project Gallery view the projects as an image gallery Notebook reference materials and other notes Follow the Blog follow projects and notes as they are published in your favourite feed reader