Virtual, variable resistors, with saved presets recallable by MIDI

Hello,

I've an idea I am trying to implement, and hoping the Arduino platform is capable of solving this problem.

I have a device (guitar effect pedal) which uses analog potentiometers to set parameter values, and I want to add the capability to store and recall presets for resistance values on the pins to which the analog potentiometers are connected.

The POTS are measuring 80k across the sweep. The pedal has 6 POTs, but I only need preset control over 2 of them.

Here is what I'm working with ...

... and I want to enable preset recall on the LEVEL and the DRIVE parameters.

The pedal operates on 9v power, either battery or external DC power supply. I typically run it off the external power supply.

Here is a rough list of requirements I drafted up to help me define scope of what I am trying to do:

My Requirements:

  • Add ability to turn knobs and set desired parameters, then save current settings to memory for future recall through MIDI Program Change messages.

  • Control over DRIVE and LEVEL parameters as a minimum. DRIVE, LEVEL, MID, and CHARACTER as a stretch goal

  • Retain ability to manually turn knobs and use the pedal without MIDI connected

  • Need to retain 9v DC power to the pedal.

  • Using an external control box for MIDI preset storage and control is a suitable solution, so long as the pedal can still be manually used without the external controller connected.

  • Pedal must retain last known state of parameter values when powered up, even without external MIDI controller connected. Last known values can be physical position of the knobs if MIDI controller is not connected.

  • Would prefer to retain the original enclosure, but will transplant to a new enclosure if needed.

My 1st thought was to replace the two POTs with rotary encoders, and determine a way to enable those encoders to control a resistance circuit connected to the PCB inside the pedal. Then have an external box for MIDI interface, and have it send preset values to the resistance circuit.

But looking at all the Arduino projects and capability, I'm wondering if I can leave the existing POTs in place, and just re-reoute their signal into a Nano's analog inputs. Then have code inside the Nano to enable the POTs values to be passed when no external MIDI controller is connected (therefore retaining normal use of the pedal), and also allow POT override when the MIDI controller sends a Program Change message; thus recalling preset values for the two circuits to which those POTS are connected.

There is enough room inside the pedal enclosure, on top of the POTs, to fit an Arduino Nano. I'm thinking this could be for controlling the two resistance circuits. Then have an external enclosure with some sort of MIDI interface, connected by an interface cable, for receiving PC messages and, in turn, sending messages to the Nano inside the pedal, overriding the POT values and setting specific values for the two resistance circuits. The presets would be stored in the external MIDI controller in this type of scenario. But if the NAno can do that as well, great!

I know Arduino also has a MIDI device, and I'm hoping this can be used for the external controller.

I hope what I typed makes sense, and appreciate any advice you guys can offer.

A nano is nowhere near powerful enough to do the a/d and d/a to sufficient resolution and speed to handle the audio signals directly. You can buy electronically controlled potentiometers that can do the job, There are MIDI libraries available for the arduino, and it could easily drive the electronic pots.

Allan.

Hmm, I wasn't thinking I needed to do d/a and a/d conversion with this, but it brings up a good point as to if the audio signal is passing through the POTs directly, or if the POTs are just controlling other circuitry on board which in turn modify the audio signal. I was assuming the latter, but need to find out.

I actually have a message into Tech21 asking for some details, and they've been pleasantly helpful thus far. I'll ask them this question and see what they have to say.

allanhurst:
You can buy electronically controlled potentiometers that can do the job, There are MIDI libraries available for the arduino, and it could easily drive the electronic pots.

By "electronically controlled POT", do you mean motorized POTs?

I had thought about this too, but wasn't sure if the motorized POTs could feed the location signal back to the MIDI device for preset storage. I had also read in another thread that determining initial position upon power up can be tricky. Is this why I se "dual channel" motorized POTs in my searches? One channel for the signal, and the 2nd channel to feed location info back to a controller?

Any suggestions on ones which might be good for this? I dug into the pedal a little further, and the POTs being used are 100k. They're marked "4B100K" under the chassis.

So 1st step would be to get the POTs replaced with motorized ones, and then send them a basic signal to see how the pedal reacts to them moving under motor power. Want to make sure I'm not injecting audio noise into the guitar's signal by placing little motors inside the pedal.

By “electronically controlled POT”, do you mean motorized POTs?

No.
https://www.arduino.cc/en/Tutorial/DigitalPotControl

Is this why I se “dual channel” motorized POTs in my searches? One channel for the signal, and the 2nd channel to feed location info back to a controller?

Yes

Want to make sure I’m not injecting audio noise into the guitar’s signal by placing little motors inside the pedal.

You will not fit one inside the box they are about 7" long.

Looking at the circuit board photo you posted, I'm almost certain that the pots handle the audio directly. It's by far the simplest way.

Hence my earlier comments apply.

Allan

Funny, I searched on motorized POTs and quickly realized they are way too large for this.

Then I was just reading https://www.arduino.cc/en/Tutorial/DigitalPotControl, and when I finished, came back here to post again ... and there you are, pointing me in the right direction :slight_smile: Thanks!

So essentially, I can use 2 channels of an AD5204 as 2 digital potentiometers, with the Ax, Bx, and Wx pins of channels 1 & 2, connected to the A, B, and W pins on the pedal's PCB, which currently have the existing analog potentiometers connected.

Then connect the AD5204 to a Nano, as well as redirect the connection of the existing analog pots to the Nano.

Then have two modes within the Nano's programming:

  1. Manual mode, where the analog POTs are used to set the values of the digital POTs
  2. Preset mode, where saved values are recalled and used to set the values of the digital POTs

Is this the right way to read an analog POT for this purpose: https://www.arduino.cc/en/Tutorial/Potentiometer

I understand I need to pickup the parts and start with small experiments to get comfortable with the coding, but want to be sure I pickup the right parts for the job.

After successfully getting something like the above working, I would then move on to the MIDI interface ... using MIDI Program Change messages as a trigger to recall presets for the digital POTs.

Thanks for the help ...

allanhurst:
Looking at the circuit board photo you posted, I’m almost certain that the pots handle the audio directly. It’s by far the simplest way.

Hence my earlier comments apply.

Allan

Gotcha. If they do handle the audio directly, would sending the audio signal through an AD5204 cause an issue?

Here’s a pic of the other side of the board, removed from the enclosure:

Nope.

That'll be fine.

But building your multi - AD5204 circuit and interfacing it neatly will be a nice little project.
A small PCB would be a good way.

Or find out what the box actually does, and build a complete midi-controlled one of your own... might even be a market. Looks like it can't be much more than simple filtering.

Allan

The thing is that the AD5204 is a liner pot and things like volume need a log law pot. Can you see what pots the unit has, or measure them to see the law?

Their also tends to be a bit of a click when the pot changes value.

I was thinking the same thing, in that I should get a small rectangular PCB to mount the Nano and the AD5204 onto.

One question about linking the Nano to the future MIDI interface: Will I be able to use the USB port on the Nano to do bi-directional communication with this separate I/O device? Or is the USB port limited to programming the Nano?

For the MIDI interface box, I was thinking another Arduino with a 5-pin DIN jack for receiving commands from the MIDI network, some way to store around 50 presets, ability to send preset information to the pedal's Nano, ability to receive information from the Nano inside the pedal for creating new presets, a mechanism for manually selecting preset numbers and storing current parameters, and some sort of visual indicator of selected preset number (small LCD I presume). I'm not so concerned about designing this piece yet, I just want to plan ahead with respect to how I'll interface it to the Nano inside the pedal.

I'm hoping the two could transfer data to each other VIA the integrated USB ports and not require direct connection to the pins on the Arduino. If I can do this, mounting it will be easier, as I can just notch the pedal's enclose to expose the USB port on the side. If it has to be attached to pins on the board, it'll add complication to the pedal's enclosure.

So for a shopping list, I've got:

Then I'll need someway to tap 5v off of the pedal's incoming 9v power supply. I haven't thought through this yet though. I'll need to step it down from 9v to 5v somehow, but considering the current is so low, I assume it'll be fairly simple? Unless there's an Arduino board that'll accept 9vdc and be small enough to fit ...

Thanks again for your input, it's been a great help!

Grumpy_Mike:
The thing is that the AD5204 is a liner pot and things like volume need a log law pot. Can you see what pots the unit has, or measure them to see the law?

Their also tends to be a bit of a click when the pot changes value.

The only indication of the POT details is the marking "4B100K". Not sure if they are linear or audio taper though. If I'm using the existing analog POTs to drive the value though, will it matter? The values would be set, and then left until the next preset was recalled, so no real sweeping of the value while in use. The preset values would be based on the values the existing POTs are putting out.

I understand the taper will be different between the two, but thought if the analog POT was used to capture the value, and then that value was sent to the digital POT, that the value would be the same between the two. Or does the conversion work based on % of sweep instead of a set resistance value?

So if the analog POT was placed where the H side has 75k, and the L side has 25k, would the Nano code be able to set the digital POT to be 75k and 25k as well? Or, if due to the taper, these values translated into 85% sweep on the analog POT, would the 85% value be used to determine the digital resistance values, and since it's linear, would result in 85k on the H and 15k on the L?

ou can get aidio taper digital pots - see eg https://www.maximintegrated.com/en/app-notes/index.mvp/id/1828.

But.

You much experience do you have?

This is not quite a trivial project - it needs a pcb.

Allan

The other thing you must check is that there is no voltage greater than 5V on those pot pins otherwise you need optical isolators on the controls.

Thanks for the input guys.

allanhurst:
ou can get aidio taper digital pots - see eg https://www.maximintegrated.com/en/app-notes/index.mvp/id/1828.

Does the taper of the digital POTs make a difference here, since they're just being used to set a static value at a given time? And that static value is determined by the analog POT? Even the preset values would be determined by the analog POT's position when the preset is created.

allanhurst:
You much experience do you have? This is not quite a trivial project - it needs a pcb.

I don't have experience with Arduino, but do have experience building other DIY type devices. From building a programming interface for OBD-II automotive application, to building a 4 channel IR receiver to 12v trigger output device for home theater, to creating electric powered ride on vehicles for my kids using PWM controls for variable speed, electrostatic braking, lighting controls, etc ...

I did learn programming, although it was a few decades ago in languages no longer used. I was a comp sci major back in the early 90's.

I've been reading the instructables, and am starting to get an understanding of the Arduino code and how it logically flows. I also have a brother who is a programmer by trade, and he has experience with the Arduino platform as well as PCB circuit building. I'll be tapping into his knowledge here as well.

I'm typically the kind of guy who will dig in deep and learn what I need to for the goal I am trying to achieve.

Grumpy_Mike:
The other thing you must check is that there is no voltage greater than 5V on those pot pins otherwise you need optical isolators on the controls.

Good point. Considering the pedal uses a 9vdc power supply, it could be possible the voltage through the existing POTs exceeds 5v, but I doubt it does considering it's a guitar's audio signal passing through them.

It looks like there are two TLC2264 amplifier IC's on the pedal's PCB, not sure if they're pre or post the 2 POTs I am looking to control though. I'll have to hook up the pedal and check voltages while sending a clipped audio signal through it to check the max possible voltage that could be seen.

I see from the AD5204 datasheet, the A, B and W pins max voltage is the Vdd, which in normal case should be 5v. The datasheet says the Vdd absolute maximum ratings are -0.3v to +7v ... so it appears there is some tolerance there though.

From a circuit design perspective, would it be the "right thing to do" to add optoisolators between the existing PCB POT pins and the AD5204 digital POT's A, B, W pins? They seem like fairly small chips, so space shouldn't be a concern ... but how they will impact the audio signal would be. The last thing I want to do is ruin the great tone this pedal gives my guitar's audio signal.

EDIT: I just put a meter on the POTs, and am seeing 4.3v across the "LEVEL" POT pins and ground, and 5.5v across the DRIVE POT pins and ground. Considering this, do I need optoisolators, or could I use 5.5v as Vdd on the Arduino and AD5204, considering it is within the max specs?

And on another note: Is there a good circuit design website/app which has the typical components available in the Arduino world for designing the Circuit and laying it out? I've used these in the past, but having the available components in the tool's library is always a plus.

The TLC2264s are quad rail-rail opamps. Naturally their ouputs can't go below the -ve supply, so 1 of the 8 opamps is probably used to generate an artificial '0v' at about 1/2 the supply . so everything swings about this - roughly +/- 4.5 v . That's how I'd do it. And that's where the dc of the pots will live.

Identify this 0v, and see if one end of the pots is connected to it - I bet most are.

Since the supply is floating ( a battery) there's no reason why you can't attach the arduino's 0v to this artificial 0v.

Since there are only plain opamps in the design, it's unlikely that it uses anything which is dc critical - just connect your digipots where the existing ones are . If worried, connect them with mediumish capacitors - with 100k impedance 10uF's would be fine. I wouldn't bother with optos. But ferrite beads on all the wires between the arduino and the audio stuff would be a good safety measure - ie making seperate analog and digital earths . And if you want to power the arduino with the board's '0v' and it's +4.5 ( quite feasable) add a ceramic cap on either side of the bead to digital and analog earths respectively.

I'd use a 8MHz pro mini for this, and remove the power LED to reduce power consumption - see Nick Gammon's exellent write-up on reducing power.

Good luck.

Allan

Great info, thanks so much!

Related to your comment about the floating power supply (ie: the 9v battery): Sometimes I power this with a battery, but 90% of the time I use a 9v wired power supply instead. The pedal has a 9vdc jack on the side, which I connect an isolated lead from a TrueTone 1SPOT Pro into.

Does that cause complication in using the pedal's artificial 0v and 4.5v to power the Arduino?

Nope. Unless the -ve of the supply is earthed, which is unlikely - check with a DMM.

If it is it means that you'll have to programme the in-circuit arduino with an isolated computer - eg a laptop - to avoid shorting out the audio's virtual earth. And since you're using a mains psu you needn't worry about power consumption, so ignore my comments on the pro-mini ( which, would, nevertheless, be a good solution.)

Allan

allanhurst:
I’d use a 8MHz pro mini for this, and remove the power LED to reduce power consumption - see Nick Gammon’s exellent write-up on reducing power.

I took a look at the Pro Mini specs, and saw this:

The Arduino Pro Mini can be powered with an FTDI cable or breakout board connected to its six pin header, or with a regulated 3.3V or 5V supply (depending on the model) on the Vcc pin. There is a voltage regulator on board so it can accept voltage up to 12VDC. If you’re supplying unregulated power to the board, be sure to connect to the “RAW” pin on not VCC.

The power pins are as follows:

RAW For supplying a raw voltage to the board.
VCC The regulated 3.3 or 5 volt supply.
GND Ground pins.

So considering the bold statement, could I just connect the Mini directly to the incoming 9vdc jack on the side of the pedal and the integrated regulator will take care of stepping it down to 5v?

Yes.... but....

If you do you MUST isolate the digipots running from the arduinos's +5 from the audio stuff with capacitors - 3 per pot - since their 0v will be 4.5 volts or so lower than the audio's '0v'.

And if any of those audio pots ARE handling dc, they won't work. Check with a DMM.

Allan.