Control the MCP42010 dual 10kΩ digital potentiometer with an Arduino and hardware SPI.
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
- Programmable gain circuits
- Programmable differential input amplifier
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:
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.
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:
I have the MCP42010 in a 14-Lead SOIC package, so I loaded it on an adapter for breadboard tests..