Maker Pro
Maker Pro

Simple PWM volume controller. Could it work?

S

Stelian Ene

Jan 1, 1970
0
Hello
I have once read in a book (which of course I can't find anymore) about a
direct PWM volume controller.
The idea is that you simply take the audio and chop it with a high
frequency, variable duty cycle signal. Then you use some type of low pass
filter, to get rid of the high frequency component, and that's it: the
output signal equals the input signal (theoretically no distortions), scaled
by the PWM ratio.

The schematic could be something like this:

4066 analog switch C
/ ||
input *-----/ ------------||---+----* output
| || |
| \
| R /
200khz | \
---------------- |
| PWM generator| GND
----------------
| | |
| V |
--\/\/\/-- Volume potentiometer

The advantage is that you can add any number of channels on the same PWM
signal (I need 5), and they are completely synchronized.
I would like to implement such a volume controller, do you think it
could work? (if anyone knows a similar design, I would appreciate it, no
point in reinventing the wheel.)
I was thinking of using a 555 for the PWM generator, but I don't think
it's a good idea, because I don't have the full range 0-100%. Especially the
lower limit, there must be a setting on the potentiometer that gives 0 V on
the PWM output, no audio is getting through, silence.
Also, what do you think about the output filter? Choosing for the simple
RC filter values that give no more than 3dB drop at 20 KHz, gives a 22 dB
reduction of the 200 kHz signal. Strictly speaking, the 200 KHz signal would
be exactly 22 dB below the audio signal. If the 200 KHz signal gets into
amps and speakers, is there any danger? Because then I would have to use a
more complex filter, and i want a low cost solution.
Should I aply any bias on the 4066, to get low distortions?
Thank you.
 
T

Tim Wescott

Jan 1, 1970
0
Stelian said:
Hello
I have once read in a book (which of course I can't find anymore) about a
direct PWM volume controller.
The idea is that you simply take the audio and chop it with a high
frequency, variable duty cycle signal. Then you use some type of low pass
filter, to get rid of the high frequency component, and that's it: the
output signal equals the input signal (theoretically no distortions), scaled
by the PWM ratio.

The schematic could be something like this:

4066 analog switch C
/ ||
input *-----/ ------------||---+----* output
| || |
| \
| R /
200khz | \
---------------- |
| PWM generator| GND
----------------
| | |
| V |
--\/\/\/-- Volume potentiometer

The advantage is that you can add any number of channels on the same PWM
signal (I need 5), and they are completely synchronized.
I would like to implement such a volume controller, do you think it
could work? (if anyone knows a similar design, I would appreciate it, no
point in reinventing the wheel.)
I was thinking of using a 555 for the PWM generator, but I don't think
it's a good idea, because I don't have the full range 0-100%. Especially the
lower limit, there must be a setting on the potentiometer that gives 0 V on
the PWM output, no audio is getting through, silence.
Also, what do you think about the output filter? Choosing for the simple
RC filter values that give no more than 3dB drop at 20 KHz, gives a 22 dB
reduction of the 200 kHz signal. Strictly speaking, the 200 KHz signal would
be exactly 22 dB below the audio signal. If the 200 KHz signal gets into
amps and speakers, is there any danger? Because then I would have to use a
more complex filter, and i want a low cost solution.
Should I aply any bias on the 4066, to get low distortions?
Thank you.

You should either apply bias to the 4066 or you should use another
switch that can accept +/- supplies.

You should use more than an RC filter on the output -- I'd at least use
a pair of RC's, or better yet an active filter if I had the board space.
You should also think seriously about whether there's any
high-frequency noise on the signal going into the switch that may get
aliased down into your audio range, and whether you need to low-pass the
stuff going into the control.
 
B

Ben Bradley

Jan 1, 1970
0
In
sci.electronics.design,alt.engineering.electrical,sci.electronics.components,
Stelian Ene said:
Hello
I have once read in a book (which of course I can't find anymore) about a
direct PWM volume controller.
The idea is that you simply take the audio and chop it with a high
frequency, variable duty cycle signal.

I recall discussion of this technique in a Popular Electronics
article, circa late '70's to 1980 (when I was in college), in the
context of VCA's and VCF's for music synthesizers. Yes, this will
work, but there are problems. One I recall is the excessively narrow
pulse width you need for the lower end of the volume scale (hearing is
logarithmic, so just like a regular linear potentiometer used as a
volume control, most of your volume change will be over the low end of
the PWM control).
Then you use some type of low pass
filter, to get rid of the high frequency component,

That's a good idea, but your circuit shows a high-pass filter. Swap
the R and C and it should work much better as a low-pass filter. :)
and that's it: the
output signal equals the input signal (theoretically no distortions), scaled
by the PWM ratio.

The schematic could be something like this:

4066 analog switch C
/ ||
input *-----/ ------------||---+----* output
| || |
| \
| R /
200khz | \
---------------- |
| PWM generator| GND
----------------
| | |
| V |
--\/\/\/-- Volume potentiometer

The advantage is that you can add any number of channels on the same PWM
signal (I need 5), and they are completely synchronized.
I would like to implement such a volume controller, do you think it
could work? (if anyone knows a similar design, I would appreciate it, no
point in reinventing the wheel.)
I was thinking of using a 555 for the PWM generator, but I don't think
it's a good idea, because I don't have the full range 0-100%. Especially the
lower limit, there must be a setting on the potentiometer that gives 0 V on
the PWM output, no audio is getting through, silence.

I'd use an integrator and a comparator as a Schmitt trigger circuit
to generate a triangle wave, then run that and your "volume control"
voltage into the inputs of a comparator. This output would then be the
PWM for the 4066. There could be variations in the generated waveform,
but running it and a DC voltage into a comparater is a standard
technique to generate PWM.
Also, what do you think about the output filter? Choosing for the simple
RC filter values that give no more than 3dB drop at 20 KHz, gives a 22 dB
reduction of the 200 kHz signal. Strictly speaking, the 200 KHz signal would
be exactly 22 dB below the audio signal. If the 200 KHz signal gets into
amps and speakers, is there any danger?

Not if it's at a low enough level. Assuming the amp passes it, it
would heat up and posssibly burn out the tweeter voice coil. If it's a
ceramic tweeter, it will just make all the dogs in the area wail.
Because then I would have to use a
more complex filter, and i want a low cost solution.
Should I aply any bias on the 4066, to get low distortions?

Yes, you should insure that the audio signal stays within the power
and ground pins of the 4066, most preferably midway between. You can
run it from a dual-voltage +7.5V and -7.5V power supply, with the
ground going to the audio ground. Your PWM circuit could run on this
same supply, or you could use a voltage translater circuit (it would
take a transisor or two) to get the PWM to the +7.5 and =7.5V of the
4066 input.
There are better analog switches that run on +/-15V, and have other
features that would be advantageous in this application (faster
switching, less charge injection), but of course they cost more than
the 4066. Check out http://maxim-ic.com/ for one manufacturer.
 
J

John Larkin

Jan 1, 1970
0
Hello
I have once read in a book (which of course I can't find anymore) about a
direct PWM volume controller.
The idea is that you simply take the audio and chop it with a high
frequency, variable duty cycle signal. Then you use some type of low pass
filter, to get rid of the high frequency component, and that's it: the
output signal equals the input signal (theoretically no distortions), scaled
by the PWM ratio.

The schematic could be something like this:

4066 analog switch C
/ ||
input *-----/ ------------||---+----* output
| || |
| \
| R /
200khz | \
---------------- |
| PWM generator| GND
----------------
| | |
| V |
--\/\/\/-- Volume potentiometer

The advantage is that you can add any number of channels on the same PWM
signal (I need 5), and they are completely synchronized.
I would like to implement such a volume controller, do you think it
could work? (if anyone knows a similar design, I would appreciate it, no
point in reinventing the wheel.)
I was thinking of using a 555 for the PWM generator, but I don't think
it's a good idea, because I don't have the full range 0-100%. Especially the
lower limit, there must be a setting on the potentiometer that gives 0 V on
the PWM output, no audio is getting through, silence.
Also, what do you think about the output filter? Choosing for the simple
RC filter values that give no more than 3dB drop at 20 KHz, gives a 22 dB
reduction of the 200 kHz signal. Strictly speaking, the 200 KHz signal would
be exactly 22 dB below the audio signal. If the 200 KHz signal gets into
amps and speakers, is there any danger? Because then I would have to use a
more complex filter, and i want a low cost solution.
Should I aply any bias on the 4066, to get low distortions?
Thank you.

The idea is fine, but that circuit is tricky as drawn. Eliminate the
capacitor, and it's cleaner. Then of course add the lowpass filter
downstream.

Better, actually, would be a SPDT switch, switching the output between
the input signal and ground. A better switch than the ancient 4066
would be good, too. HC4053, or a higher-end Maxim mux maybe.

This of course gives output that's linear on duty cycle, and audio
prefers a log shape, which implies very low duty cycles on the low
end.

This trick has been used in precision analog multipliers and
square-root circuits for ages.


John
 
A

Adrian Jansen

Jan 1, 1970
0
There are much better switches, which inject far less charge into the audio
channel than a 4066. You could also consider an EPOT, which allows direct
digital control of a resistor/potentiometer.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
S

Stelian Ene

Jan 1, 1970
0
You should use more than an RC filter on the output -- I'd at least use
a pair of RC's, or better yet an active filter if I had the board space.

Ok, I did some simulations, and 2 sequential RC filters, matched on the same
cut-off frequency, give an attenuation of 43dB at 200Khz, and a phase
distortion of 60 deg at 20 kHz (a single cell gives 30 deg). What would the
effects of phase distortions (equal on all channels) at high frequencies
could be?
You should also think seriously about whether there's any
high-frequency noise on the signal going into the switch that may get
aliased down into your audio range,

Hmm... never thought about it :)
This is certainly an issue.
and whether you need to low-pass the
stuff going into the control.

Do you mean the control pin of each switch or the dc volume control of the
PWM generator?
I don't think the control pins are vulnerable to H.F. noises because they
have low impedance and short circuit lengths (unlike the audio input).
Instead I was thinking of adding an inverter series with each control pin,
to get a lower crosstalk between the channels via the common PWM signal.
 
S

Stelian Ene

Jan 1, 1970
0
Ben Bradley said:
work, but there are problems. One I recall is the excessively narrow
pulse width you need for the lower end of the volume scale (hearing is
logarithmic, so just like a regular linear potentiometer used as a
volume control, most of your volume change will be over the low end of
the PWM control).

I'm aware of this. I will try to design a stable linear PWM generator, and
simply use a logarithmic potentiometer to control it.
That's a good idea, but your circuit shows a high-pass filter. Swap
the R and C and it should work much better as a low-pass filter. :)

What the ...!? :)
I think I was to busy creating ascii art to actually look at the result !

Not if it's at a low enough level. Assuming the amp passes it, it
would heat up and posssibly burn out the tweeter voice coil. If it's a
ceramic tweeter, it will just make all the dogs in the area wail.

I think the limit of the dogs hearing is about 60KHz, while bats can reach
up to 100KHz.
 
T

Tim Wescott

Jan 1, 1970
0
Stelian said:
Ok, I did some simulations, and 2 sequential RC filters, matched on the same
cut-off frequency, give an attenuation of 43dB at 200Khz, and a phase
distortion of 60 deg at 20 kHz (a single cell gives 30 deg). What would the
effects of phase distortions (equal on all channels) at high frequencies
could be?
That really depends on the level of fidelity you're looking for.
Audiophiles insist that the phase response of a system is important up
to high frequency (sane ones say 20kHz or so, the nitrogen-dipped
0.99999% pure copper wire crowd says DC to light). If you're truly
going for "inexpensive" you probably won't notice it.
Hmm... never thought about it :)
This is certainly an issue.




Do you mean the control pin of each switch or the dc volume control of the
PWM generator?
I don't think the control pins are vulnerable to H.F. noises because they
have low impedance and short circuit lengths (unlike the audio input).
Instead I was thinking of adding an inverter series with each control pin,
to get a lower crosstalk between the channels via the common PWM signal.
I mean the audio input to the control, to block a presumed
high-frequency signal.
 
K

Kevin Aylward

Jan 1, 1970
0
John said:
The idea is fine, but that circuit is tricky as drawn. Eliminate the
capacitor, and it's cleaner. Then of course add the lowpass filter
downstream.

Better, actually, would be a SPDT switch, switching the output between
the input signal and ground. A better switch than the ancient 4066
would be good, too. HC4053, or a higher-end Maxim mux maybe.

This of course gives output that's linear on duty cycle, and audio
prefers a log shape, which implies very low duty cycles on the low
end.

This trick has been used in precision analog multipliers and
square-root circuits for ages.

And as an additional note, if the load is a cap, you have a switched
resister filter, i.e. a VCF.

Kevin Aylward
[email protected]
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
Z

Zak

Jan 1, 1970
0
Adrian said:
There are much better switches, which inject far less charge into the audio
channel than a 4066. You could also consider an EPOT, which allows direct
digital control of a resistor/potentiometer.

I built an amplifier with relay switched volume overan inverting op-amp.
2 switches in the feedback path and 6 on the input. Made a table in an
old EPROM, up-down cunter do drive it and a latch in between that limits
the number of state changes.

With CMOS switches this is obviously easier and you could change the
latch to act on audio zero crossings.


Thomas
 
A

Anthony C Smith

Jan 1, 1970
0
Stelian Ene said:
-snip-

Elektor electronics published a circuit for this in the 80's IIRC it was
one of their bumper summer issues-
I remember trying it and being singularly unimpressed- Try Googling for the
project cds they pressed.
 
S

Stelian Ene

Jan 1, 1970
0
Adrian Jansen said:
There are much better switches, which inject far less charge into the audio
channel than a 4066.

Any sugestions?
Why is the charge injection important in this aplication?
 
B

Ben Bradley

Jan 1, 1970
0
I built an amplifier with relay switched volume overan inverting op-amp.
2 switches in the feedback path and 6 on the input. Made a table in an
old EPROM, up-down cunter do drive it and a latch in between that limits
the number of state changes.

With CMOS switches this is obviously easier and you could change the
latch to act on audio zero crossings.

That's a neat idea. That would eliminate the "zipper noise" when
changing the volume over a range of steps. You can hear this in the
MSWindows volume control if you run the volume up and down while some
sound is playing. Not only does the sound increase and decrease in
steps, but a click is generated every time the level is switched at
something other than zero crossing. Even at zero crossing, the rate of
change of the waveform is changed when changing levels, and this might
be audible in some circumstances, but it's much less objectionable.
 
W

Walter Harley

Jan 1, 1970
0
Stelian Ene said:
I'm aware of this. I will try to design a stable linear PWM generator, and
simply use a logarithmic potentiometer to control it.


I'm not sure you understand the issue. To get 40dB of gain reduction (the
bare minimum you need from a volume control), you need a duty cycle of 1%.
Assume your basic switching frequency is something sufficiently supersonic
that it is easy to filter out of the audio, perhaps 100kHz. Then the total
cycle time is 10us. So, you're talking about an "on" pulse duration of
100ns. Have you looked at the turn-on and turn-off times of the 4066?

And, if you're controlling all this from a pot anyway, why bother? Why not
just pass the audio through the pot? Or, if you need the pot to be remote,
use a VCA.
 
U

user

Jan 1, 1970
0
In principle, this scheme can be made to work exceptionally well. For
example, Barry Blesser used it in the big EMT studio limiter many
years ago (can't recall the model number, sorry). It cost several
thousand dollars, and worked flawlessly. Its circuit was also quite
complex. IIRC, a much simpler incarnation of the same idea was used
in at least one of the old guitar effects boxes from the 1970's. It
was the Electro-Harmonix Black Finger, to the best of my memory. You
may be able to find the schematic for it on the web somewhere.

Brian Aase
 
G

GPG

Jan 1, 1970
0
Stelian Ene said:
I'm aware of this. I will try to design a stable linear PWM generator, and
simply use a logarithmic potentiometer to control it.
Could generate a log sawtooth. Perhaps something like






V+
V+
|
.-. |
| | .-.
| | R4 .------------------. | |
'-' | | | | R2
| | | '-'
| | |\| | |
| '-|-\ ___ | | |\|
| | >-o----|___|--o-----o----------------|-\
o----------+/ | R1 | | >-
| |/| | | .----|+/
| | | | |/|
| | --- |
| | --- |
o------->|-----o | |
| | |
.-. === Control V
| | GND
| | R3
'-'
|
===
GND
Make R1 << R2. Open collector comparator
 
W

Winfield Hill

Jan 1, 1970
0
GPG wrote...
Could generate a log sawtooth. Perhaps something like

V+
| V+
.-. |
| | .-.
| | R4 .------------------. | |
'-' | | | | R2
| | |\| | '-'
| '-|-\ ___ | | |\|
| | >-o----|___|--o-----o-------------|-\
o----------+/ | R1 | | >-
| |/| | | .----|+/
| | --- | |/|
| | --- |
o------->|-----o | |
| | |
.-. === Control V
| | GND
| | R3
'-'
|
===
GND

Make R1 << R2. Open collector comparator.

Yes, R1 can be very small, almost a short.

Thanks,
- Win

(email: use hill_at_rowland-dot-org for now)
 
A

Adrian Jansen

Jan 1, 1970
0
Stelian Ene said:
Any sugestions?
Why is the charge injection important in this aplication?

Look in any of the manufacturers datasheets, eg Maxim, Linear Technologies,
Analog Devices. They all make 'audio' CMOS switches, designed for low
charge injection. They also make zero crossing switches, which internally
sense the zeroes, and only switch there. But of course that wont work for a
PWM gain control.

I have no idea what the noise requirements were in the OP's application, but
in general if you want level control using PWM over a reasonable control
range, eg 60 dB or so, think about what happens at the low level end, where
switching the FETs injects several mV of effectively random noise into your
signal path. Its instructive to hook up something like a 4066 and switch
it, watching what happens on the signal lines with a 'scope. While you draw
them as simple switches, the reality is different.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
T

Tam/WB2TT

Jan 1, 1970
0
Adrian Jansen said:
Look in any of the manufacturers datasheets, eg Maxim, Linear Technologies,
Analog Devices. They all make 'audio' CMOS switches, designed for low
charge injection. They also make zero crossing switches, which internally
sense the zeroes, and only switch there. But of course that wont work for a
PWM gain control.

I have no idea what the noise requirements were in the OP's application, but
in general if you want level control using PWM over a reasonable control
range, eg 60 dB or so, think about what happens at the low level end, where
switching the FETs injects several mV of effectively random noise into your
signal path. Its instructive to hook up something like a 4066 and switch
it, watching what happens on the signal lines with a 'scope. While you draw
them as simple switches, the reality is different.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
I have never tried this, but don't finite rise and fall times cause
distortion?

Tam
 
K

Ken Smith

Jan 1, 1970
0
I have never tried this, but don't finite rise and fall times cause
distortion?

Yes but not, perhaps, as bad as you would think. The distortion happens
when the switch is partially on. The system gain in this case is less
that after the switching is finished so the distortion is deleveraged.

The CMOS switches are also non-linear with respect to any current flowing
in them and the voltage of the signal channel. To minimize these effects,
you want to not have any current flowing in the switch.
 
Top