Schematic for controlling volume (gain) with a digital interface

Started by kineticfx, February 11, 2022, 12:03:44 PM

Previous topic - Next topic

kineticfx

Hi there!

I am looking to build myself a preset volume/pan pedal. (not using a rocker style pedal, but being able to select 100%, pan left, pan right etc.)

Basically instead of my foot I want to be able to use an arduino.

I've successfully been able to control a digipot, but there is too much static/noise.  I'm not really skilled enough in analog electronics to be able to fix that.

Curious to know if there are any circuits for this already.  I know EHX has a volume pedal based on an accelerometer rather than an analog pot.

Thanks!

composition4

Take a look at optocouplers, I like this one: https://www.digikey.com.au/en/products/detail/advanced-photonix/NSL-32SR3/5039793


Use it as a series or shunt control between a couple of buffers from a dual op amp. Control the optocoupler with the Arduino's PWM.

Series should get you -60db minimum to -0.5db (almost unity) maximum volume range based on a 1k shunt resistor: this is assuming you control the optocoupler from 60 ohms (minimum resistance on datasheet) to 1 Megohm. Depending on how good the PWM control is (you'll have to experiment with how the Arduino controls it) the bottom end of the range may be able to be extended if you really need it. Something like this:


I'd prefer a shunt arrangement but it probably gives a little less range in this instance. Assuming again you control the optocoupler from 60 ohms to 1 Megohm, you should get about -50db to almost unity range. You can increase the series resistor for lower minimum range, but -50db is not far from muted. Like this:


Another way is to put the opto in the feedback loop of the second op amp in an inverting configuration, then control the opto from its minimum resistance 60ohms to 100k ohms. This might allow for easier control as you wouldn't have to reduce the PWM duty cycle down as low.  Will give around -50db to -1.5db range with the following values:


Anyway that's just some starting points to muck about with, plenty more ways to skin your cat though and I'm sure others will come up with good solutions. All of the above ideas are based on 9v single supply by the way.

Jonathan

PRR

Welcome.

Quote from: kineticfx on February 11, 2022, 12:03:44 PM...digipot, but there is too much static/noise.

Show your circuit. Digipots are not universal solutions but can be useful.
  • SUPPORTER

iainpunk

i was looking in to PWM compressors yesterday evening, and came across this thread about a cool and simple PWM compressor.
look at the first post circuit, its simple and elegant way to control volume level.
https://www.diystompboxes.com/smfforum/index.php?topic=103833.0
instead of having the envelope control the PWM, you could use the Arduino.

cheers
friendly reminder: all holes are positive and have negative weight, despite not being there.

cheers

Processaurus

Show your circuit and physical layout.  Elaborate on "static/noise".  Like distortion? zipper noise?  Robot noises from the processor? Whine?  White noise?


teemuk

Do note that optocoupler volume control is conceptually simple but in practice it  needs some sort of feedback to track what the resistance really is.

ElectricDruid

Do you need to be able to change the volume level dynamically and rapidly? (which is more demanding than just set-and-forget for a new level).

What resolution do you need for the volume control? Digipots are usually 7 or 8-bit linear (although there are a few log taper ones too) so do you need something like that, or something better?

Off the top of my head, I can think of the following possibilities, several of which have already been mentioned:

1) DAC + OTA or VCA
This is a serious solution, but gives probably the greatest flexibility and performance
2) Multiplying DAC
Slightly simpler. Needs a DAC that can cope with bipolar Vref input, ideally.
3) Digipot
Almost a variation on the above, really.
4) Optos/vactrols
These are easily driven from PWM outputs, which makes it a nice simple fit for the Arduino.
5) PWM volume control
Can be made to work, but chopping the audio up at high frequency and then reconstructing it again is always going to be fraught with problems. The Arduino's default PWM outputs won't be fast enough for this, so you'll need to alter the PWM frequency to something much higher.
6) Specialised chips
There are plenty of SPI/I2C volume control chips out there. They're probably digipots internally, but they often include neat features like only doing the transition at a zero crossing in the audio to eliminate zipper noise.

HTH



PRR

Don't forget ordinary pots and some servo-motors. Works for somebody.
  • SUPPORTER

ElectricDruid

How about something like this?

http://www.princeton.com.tw/Portals/0/Product/PT2259-s.pdf

I've never heard of it or seen it, of course, but I bet it's out there somewhere! The PT2399 is the only Princeton chip that anyone seems to know about.

iainpunk

Quote5) PWM volume control
Can be made to work, but chopping the audio up at high frequency and then reconstructing it again is always going to be fraught with problems. The Arduino's default PWM outputs won't be fast enough for this, so you'll need to alter the PWM frequency to something much higher.

if you take arduino's 490Hz pwm and filter that to DC, then use that DC to generate a corresponding PWM using opamps, at a way way way higher frequency.

https://www.electroboom.com/?tag=pwm

if you replace the POT1 10k with the output of a higher order low frequency filter, (i suggest passive 2nd order 5Hz, which filters the 490Hz with 80dB) and replace the motor mosfet with the Jfet driving circuit part of the chematic i posted earlier

cheers
friendly reminder: all holes are positive and have negative weight, despite not being there.

cheers

FiveseveN

Quote from: ElectricDruid on February 14, 2022, 06:53:37 AM
How about something like this?
http://www.princeton.com.tw/Portals/0/Product/PT2259-s.pdf

Similar volume control chips are LC75344MD (2 ch), BD3464FV and BD34700FV (4 ch) that run on 9V (with digital interfaces compatible with 3V3 and 5V).
Quote from: R.G. on July 31, 2018, 10:34:30 PMDoes the circuit sound better when oriented to magnetic north under a pyramid?

ElectricDruid

Quote from: iainpunk on February 15, 2022, 10:04:57 AM
Quote5) PWM volume control
Can be made to work, but chopping the audio up at high frequency and then reconstructing it again is always going to be fraught with problems. The Arduino's default PWM outputs won't be fast enough for this, so you'll need to alter the PWM frequency to something much higher.

if you take arduino's 490Hz pwm and filter that to DC, then use that DC to generate a corresponding PWM using opamps, at a way way way higher frequency.

https://www.electroboom.com/?tag=pwm

if you replace the POT1 10k with the output of a higher order low frequency filter, (i suggest passive 2nd order 5Hz, which filters the 490Hz with 80dB) and replace the motor mosfet with the Jfet driving circuit part of the chematic i posted earlier

cheers

Isn't that far too complicated? Can't you just get the Arduino to do PWM at a higher frequency? We need maybe 50KHz or so, and perhaps less would do. You'll lose resolution running the PWM at a higher frequency, but the human ear isn't that sensitive to volume anyway - it's not like pitch where we have quite fine discrimination. 1dB is often reckoned as the minimum perceptible difference, so a 100dB range isn't even a 7-bit variable. That's a lot less than pitch where you'd need at least 11 bits to get to a place where you could hope to cover the pitch range in imperceptible steps.

kineticfx

Quote from: ElectricDruid on February 13, 2022, 02:20:06 PM
Do you need to be able to change the volume level dynamically and rapidly? (which is more demanding than just set-and-forget for a new level).

On the simple end, I'd like to be able to just recall presets.  But dynamic control would also be awesome since it opens up the possibility of doing trem effects.

I haven't had a lot of time to read through this thread, but I'll take a look soon.