Digital potentiometer

On 1st January, the digital potentiometer finally started working. As mentioned in previous posts, the idea is to use some sort of mixer to mix together two FX loops. The DRY/WET settings of this mixer should be controlled by the left hand setup. The mixer layout chosen for the project uses two analog potentiometers to mix the two guitar signals coming thru the FX loops. The issue is that analog potentiometers cannot be digitally controlled so a different solution had to be found. This solution is a digital potentiometer of the type MCP4251. This digipot has two digital potentiometers built in whose wipers can be set digitally by commands of a microcontroller. Getting this digipot to work however, was not that trivial. It works via SPI which is quite complicated, and no suitable library could be found at first. Additionally, it was not initially clear how to connect the MCP4251 with a microcontroller. After a lot of digging on the Internet, a project using this exact digipot was found. The author wrote a custom library that could be used, and he also explained how to wire up the MCP4252 to an Arduino UNO. Apparently, the Arduino UNO has specific SPI pins that need to be used for the SPI communication with the digipot. Following the instructions of the author’s blog post, the digipot could finally be used to control the brightness of two LEDs.

Next, a code was made to simulate the following mixing function that the MCP4251 will perform in the future:

  • Normal rhythm guitar mode (= fretting hand position < 5th fret)
    • FX loop 1 -> always 100% wet
    • FX loop 2 (containing delay etc.)  -> 20% wet
  • If Solo Mode active (= fretting hand position >= 5th fret)
    • FX loop 1 -> stays 100% wet
    • FX loop 2 (containing delay etc.) -> turned up to 50% wet

The WET/DRY status was simulated by changing the brightness of the two LEDs. This worked as well with the one LED’s brightness remaining unchanged while the other changed according to which fret was played on the guitar.

So far, the digipot was used in conjuncture with an Arduino UNO since this microcontroller was used in the tutorial. In the next step, it was tried to transfer the code to work on an ESP32. It was simpler than expected: the SPI pins of the ESP32 were determined and then everything worked as expected. Getting the digipot to work marked the achievement of another small milestone in the project as the digipot will serve as the main switching hardware controlling the WET/DRY ratio of the two FX loops via the input of the left hand setup and acting as an expression pedal via the input of the right hand setup.

.

Leave a Reply

Your email address will not be published. Required fields are marked *