How to control PT2399 feedback level with a microcontroller?

Started by ihatemornings, April 06, 2021, 05:30:24 AM

Previous topic - Next topic

ihatemornings

I'm building a pedal that has a Teensy controlling the delay speed and feedback of a PT2399 chip (among other things). I chose the MCP42050 digital pot (based on https://www.electrosmash.com/pt2399-analysis), which is working well for the speed control (adjusting the resistance between pin 6 and ground) but not so well for the feedback.

First I tried just replacing the usual PT2399 feedback pot with the digital pot. It works, but there are high frequency clicks when the pot value changes. I read up on digital pots and realised that this was either the sound of the resistors being switched in and out or the result of putting an unbiased AC signal through the MCP42050, which only handles 0-5V.

To work around both of those possible problems I got hold of some NSL-32SR3 optocouplers and tried using the digital pot to supply a variable 0-5V voltage to the LED, with the photocell side acting as the resistor in the delay feedback line. Of course a single resistor isn't a drop-in replacement for a pot so I then looked into resistor-based attenuation circuits and tried a couple of versions (eg. https://www.electronics-tutorials.ws/attenuators/t-pad-attenuator.html). After experimenting with resistor values (1k) and the range of voltages I was supplying to the optocoupler I managed to get it sort of working (varying from very little feedback to lots) but I've lost the clear multi-tap delay sound I had before – I imagine I've inadvertently created a low-pass filter or something but at this point I've exhausted my amateur tinkering energy.

Am I (unsuccessfully) reinventing the wheel here? Is there a tried and true method of attenuating an audio signal based on microcontroller logic? Using a digital pot? Or driving an optocoupler directly from the microcontroller (I have one spare pin!)? Or something else?

potul

I have used in the past a simple passive optocoupler to ground setup, controlling it using the PWM output of an arduino. I was not able to achieve 100% attenuation due to the characteristics of the diy optocoupler, but it worked for my project.


potul

I realize my explanation was not very clear. By "passive" I mean, I just used the opto to provide a variable resistor to ground, paired with another resistor building a voltage divider.

When the opto is not conducting, volume is high. The more PWM duty cycle, the lower the opto resistor is and the signal is more attenuated.

Sweetalk

Maybe an OTA stage with the controller pin attached to the PWM of the Teensy. I don't know how much attenuation you'll achieve, but it's worth trying. I'm thinking in the Anderton's Volume pedal retrofit, it uses a CA3080 but can be easily changed to a LM13700. Or google OTA VCA and a whole bunch of circuits will appear.

ihatemornings

@potul Thanks! I'll try that first. I need to get the optocoupler in a voltage divider setup on a breadboard and get my head around how it behaves.

@Sweetalk Also thanks! Sometimes you just need to know what to google... https://electricdruid.net/design-a-eurorack-vintage-vca-with-the-lm13700/ has already taught me a lot.

ElectricDruid

Ihatemornings,

As you've discovered, the typical digital pot has some limitations - mainly that 0-5V supply. There are "high voltage" digital pots that use bigger supplies, so that's one way around the problem.
Otherwise, you need to work around the 5V supply. It's just a single supply like the 0-9V we usually use in stomp boxes, and you can deal with it the same way. E.g. we set up a "Vref" supply that gives us a midpoint voltage of around 2.5V, and that acts as our AC "ground" as far as our signal is concerned. The top, bottom, and wiper of the pot all have to stay within 0-5V, but they can be connected to any voltage you like within that range, so it's fine to connect the bottom of the pot to the 2.5V Vref. Then the pot has no DC bias across it which helps limit the clicking you heard.

When working with these 0-5V signals, it helps to use either 5V rail-to-rail op-amps (to maximise the headroom you can get) or to use op-amps running on 0-9V that can drive the output very close to ground. I used some MCP6002s when I played with it, which goes very close to the rails but isn't the greatest for audio (not what it was designed for). Many typical op-amps we would usually use can't drive the output very close to the rails, so if you run a 0-5V signal through an op-amp running on 0-9V, you finish up chopping off the bottom since the op-amp can't get the output lower than 1V or so.



niektb

I don't fully get though why the 0-5V supply would be a problem in this case. The feedback path doesn't contain opamps and the output of the PT2399 isn't even close to 5Vp-p

ElectricDruid

Quote from: niektb on April 15, 2021, 08:02:19 AM
I don't fully get though why the 0-5V supply would be a problem in this case. The feedback path doesn't contain opamps and the output of the PT2399 isn't even close to 5Vp-p

No, this is true. In many ways the signal from the PT2399 is ideal for using with a digipot since it's already been reduced to 0-5V.

But you still can't just feed it into the pot and connect the other end of the pot to ground. The bottom of that pot needs to be given the proper 2.5V Vref (Does the PT2399 provide one externally we could use? I can't remember). or you *will* get the nasty ticks that the OP mentioned.

niektb


ElectricDruid

Quote from: niektb on April 15, 2021, 11:58:12 AM
Pin 2 has a 2.5Vref that is also used internally.

Perfect! So we tie the bottom of the digipot to that, and we're good to go! :)

Sweetalk

Quote from: ElectricDruid on April 15, 2021, 11:13:33 AM
Quote from: niektb on April 15, 2021, 08:02:19 AM
I don't fully get though why the 0-5V supply would be a problem in this case. The feedback path doesn't contain opamps and the output of the PT2399 isn't even close to 5Vp-p

No, this is true. In many ways the signal from the PT2399 is ideal for using with a digipot since it's already been reduced to 0-5V.

But you still can't just feed it into the pot and connect the other end of the pot to ground. The bottom of that pot needs to be given the proper 2.5V Vref (Does the PT2399 provide one externally we could use? I can't remember). or you *will* get the nasty ticks that the OP mentioned.

I never worked with digital pots before but I was planing to do so and with a PT2399. You're saying that is better to not decouple the signal from the PT2399 and feed it to the digipot biased to 2.5V?.

ElectricDruid

Quote from: Sweetalk on April 24, 2021, 05:19:51 AM
I never worked with digital pots before but I was planing to do so and with a PT2399. You're saying that is better to not decouple the signal from the PT2399 and feed it to the digipot biased to 2.5V?.

Yes, you might as well. The Digipot needs the signal biased around 2.5V, and that's what the PT2399 provides already, so there's no need to decouple, lose the bias, and then have to put it back. Just feed the PT2399 straight to the digipot.

Sweetalk

Quote from: ElectricDruid on April 24, 2021, 12:48:14 PM
Quote from: Sweetalk on April 24, 2021, 05:19:51 AM
I never worked with digital pots before but I was planing to do so and with a PT2399. You're saying that is better to not decouple the signal from the PT2399 and feed it to the digipot biased to 2.5V?.

Yes, you might as well. The Digipot needs the signal biased around 2.5V, and that's what the PT2399 provides already, so there's no need to decouple, lose the bias, and then have to put it back. Just feed the PT2399 straight to the digipot.

Great!, thanks