Fork me on GitHub

Project Notes

#261 DigitalPots/MCP4017

Control the MCP4017 single 7-Bit I²C digital potentiometer with an Arduino.



I’m trying out some digital potentiometers for an application. This is a test of the MCP4017T-104E/LT (100kΩ rheostat version).

The MCP4017 acts as a rheostat - it sets the resistance between the Wiper and B pins, independent of VDD/VSS (i.e. the potentioneter is not grounded or tied to power).

Conclusion? Probably not the chip I’d choose for the job in mind. Key observations:

  • does not support hardware I²C address bits (and so far I think there’s no way set the address over I²C)
  • the 2.5mA current rating means it can probably only be used connected to a high impedance load, else it requires some form of buffer circuit.
  • SC70 - dang that’s a small package! Managed to hand solder to a 2.54mm DIP adapter without too much trouble (with the aid of a magnifying glass)

I²C Protocol Support

The MCP4017/18/19 come with a fixed bus address 0b0101111. So only one can be controlled on the same bus at the same time.

It has a very basic read/write I²C implementation, with no commands defined. Just read and write the wiper value.

Wiper Setting Properties
07Fh Full Scale (W = A)
07Eh - 040h W = N
03Fh W = N (Mid Scale)
03Eh - 001h W = N
000h Zero Scale (W = B)

Test Script and Performance

Measuring the actual resistance I see a full scale of 0Ω - 81.3kΩ (for the ‘100kΩ’’ chip). That is within spec - note the resistance rating of the chip is ±20%.

The MCP4017.ino sketch is a simple exercise of the chip. It steps from 0Ω to full scale with a 2µs delay between steps.

Note the trace looks logarithmic, but this is expected for a linear change in resistance, as I am measuring the resistance in a voltage divider - x/(x+10kΩ). The voltage divider is in the test circuit to avoid pumping more than the rated ±2.5 mA through the chip.






Credits and References

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.