Sunday, May 25, 2008

Four MIDI Controlled Digital Pots via Arduino

This project allows one to control up to four 100K digital potentiometers using MIDI control data. The IC that has been used for this purpose is the MCP42100, a dual 100KΩ potentiometer. Two MCP42100's are required to have the four pots.

The MCP42100 uses the SPI protocol. I have implemented this link between the Arduino and the digital pot ICs using a manual bit-banging technique (see the code for more information).

In terms of how the MIDI CC is mapped to the pots, CC1 (modulation) on channels 1 and 2 are mapped to MCP42100 IC1 and CC1 (modulation) on channels 3 and 4 are mapped to MCP42100 IC2.

A potentially useful project for a wide range of applications.

Arduino Code:
Download here:

MCP42100 Pinout:
Some notes regarding the schematic:
• JP1 (PORTD) pins 1 - 8 refers to Arduino digital pins 0 - 7
• The two 5 pin DIN pins are the MIDI in points
• In reference to the MCP42100:
-- Pin 10 is Pot 1, Terminal B
-- Pin 9 is Pot 1, Wiper
-- Pin 8 is Pot 1, Terminal A
-- Pin 5 is Pot 2, Terminal B
-- Pin 6 is Pot 2, Wiper
-- Pin 7 is Pot 2, Terminal A



Bass said...

Looks interesting, I've been looking for something like this.

George J said...

Wow, your blog is amazing - its given me so many ideas for my arduino I am gonna be in the lab for months!

Your digital pot article has shown me how I can do a project I have been planning for ages; a completely midi controlled analogue mixer. I have a few questions if you don't mind :)

How many pots do you think the code could handle on one arduino?

Would it be possible with the code to use a demultiplexer to increase the outputs?


Steve said...

I implemented your idea as part of a Tesla coil modulator. I have a question regarding MIDI - it seems some devices don't send Note Off messages, but Note On messages with velocity = 0.

Also I heard that some devices can be "lazy" about transmitting the header byte, that is if one note on is followed quickly by another note on for the same channel, they skip the header byte. Only sending a new header when the data type changes.

Have you experienced anything like this?

I'm having no trouble responding to Note on messages with your schematic and code, but for some devices Note off's don't work.


Ben said...

i have been looking into arduino and would love it if you could tell me if i can use this to create a digi to analog conversion for the midi control of pots on a analog guitar pedal? ive heard of the "pot32" @ and im currently reading @
please help me because my dream is to automate an analog delay/trem/lowpass and (someday when im making good cash) moogerfroogers...
I dont think my mind can rest until i figure this one out.
email me @
if you have the time that is.. cheers

Potentiometers said...

I think today as my luckiest day. I was really worried about my project but thanks to your brilliant mind and you post it to your blog. You really help me a lot man!

digital potentiometer said...

Arduino has limits on how much current can be sourced or sunk by its I/O pins.

Anonymous said...

Sensors are transforming the way engineers think about position sensing
Distance Sensor

Anonymous said...

Spectra Symbol designs and manufactures custom linear potentiometers and position sensors for medical, distance measurement, automotive, and electrical companies
Linear Potentiometer