Effective "taper" of PWM'd resistor?

Started by earthtonesaudio, November 23, 2009, 10:58:36 AM

Previous topic - Next topic

earthtonesaudio

Say you've got a resistor and a CMOS switch in series (like the MXR Envelope Follower), and you open and close the switch rapidly to vary the "effective" resistor value.  I know that if the switch is closed/on 10% of the time, the effective resistance is 10x the physical resistor value... but as you get closer and closer to 0% duty cycle, the effective resistance goes to nearly infinite.  So what sort of taper is that?  I would imagine some sort of log taper but I'm having a hard time picturing it.

Your thoughts?

R.G.

R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

puretube

#2
My thoughts included an "Rp" in the 1st link of this post, to withhold it from going to infinity,
but rather give it an Rmax...  :icon_wink:

(and hence a defined ratio of resistances between open switch & closed switch, where Rs helps defining the latter better...)

zyxwyvu

The taper is roughly a log shape, but reversed in duty cycle (higher duty cycle = lower R). Here's why:


For the following, here are our variables:

R1 = series resistor
R1 = parallel resistor (where it is paralleled with the switch, not R1, as in puretube's schematics)
Rs = switch resistance
Rt = effective resistance
s = duty cycle (0<=s<=1)


The log shape is simple to show for only a series resistor with the switch. We use Ohm's law, find the currents for on/off states, take a weighted average of the two, and find the effective resistance from that. This is the result:

Rt = (R1+Rs)/s     or     Rt = R1/s  for  R1 >> Rs

This equals R1 for s=1, and infinity for s=0, with a roughly logarithmic shape. This is what it looks like (for R1=1k):

(This is notably NOT linear)




When we add R2, it gets a bit more complicated. The equation (after quite a bit of algebra) becomes:

Rt = ((R1 + R2) (R2*Rs + R1*(R2 + Rs)))/(R1*(R2 + Rs) + R2 (Rs + R2*s))

If we assume R1,R2 >> Rs, then it gets a bit better:

Rt = (R1*(R1 + R2))/(R1 + R2*s)

This looks mostly the same, but flattens the area near s=0.



Rs is usually small enough that we can indeed ignore it. For the CD4066, typical Rs is around 120 Ohms for 10V supply, 270Ohms for 5V supply.

R.G.

Quote from: zyxwyvu on November 23, 2009, 05:00:37 PM
(This is notably NOT linear)
Dang. Now I gotta go do the math instead of remembering from home work assignments decades ago.  :icon_lol:

I think this may be pertinent (it's the first direct one I found in a quick search):
http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20000086231_2000118265.pdf
Under Section 2.Principle of Operation with reference to Figure 1,
Quote...if we think of the resistor R as defining the current (Ic=(Vin-Vout)/R) then the apparent resistance is increased by the inverse of the duty cycle.
Which is what came to my mind. I'll go get out the pencil and paper and start some analysis.

There's been a rash of switched-resistor patents lately. One even patented using switching techniques to modify the values of resistors, caps and inductors, kind of a one-fell-swoop of claiming the idea for every application. Funny, because duty-cycle switching was, as the paper says, noted as far back as 1968 (likely further if someone wanted to look) but not recently.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

PRR

It is not a "pot taper", because a single PWMed resistor is -not- a potentiometer, but a rheostat. We don't normally make the distinction between pot and rheostat since 2-pin rheostats are univerally made with 3-pin pots. But it is well to remember they are not the same thing. (puretube shows a potentiometer-like system, but I think that goes beyong Alex's question?)

The "taper" is Reciprocal of Linear.

Go back to pot/rheostat. 1K resistor varied 0% to 100%. The math is R*X where X is setting and R is resistance. The value varies zero ohms to 1K ohms.

Now PWM a 1K resistor. The math is R/X where X is PWM ratio and R is resistance. The value varies from 1K ohms to infinite ohms.

PWMing a resistor gives a plot that you can not get with a physical rheostat. Sure you can gimmick a pot to got to infinite ohms, but not smoothly. PWM can not get you to zero ohms, like any pot (almost) does.

The ability to go to infinity is useful in some things. A "VU" meter has a decay time. Using PWM on the decay resistor we can get short, long, or "infinite" display. Infinite can be useful, for instance, for finding the highest peak in a track (except leakage time is often comparable to the length of a song).

Sometimes infinity is bad. As the series resistor in a NFB amplifier, infinite resistance approaches infinite gain, or really the poorly controlled open-loop gain of the amplifier. Too hot and nasty. As puretube says, you can throw a shunt on to limit the total resistance if the PWM goes to 0%, or you can jam your PWM generator so it can never go to 0%. (Some circuits are "flawed" in that they can't make a zero % pulse. Here this is a Feature, although the exact minimum % may be uncertain.)

How are you making your PWM? You can "taper" that. Simple ramp-splitters can use a audio-taper pot for the split-voltage, so 0-5 on the knob gives 0%-10%, and 5-10 covers 10%-100%. If you do computers, you can map the knob against any simple function or any bizarre irrational nonmonotonic thing you can jam into RAM.
  • SUPPORTER

earthtonesaudio

Awesome info everyone! 

Quote from: PRR on November 23, 2009, 07:17:16 PM
It is not a "pot taper", because a single PWMed resistor is -not- a potentiometer, but a rheostat. We don't normally make the distinction between pot and rheostat since 2-pin rheostats are univerally made with 3-pin pots. But it is well to remember they are not the same thing. (puretube shows a potentiometer-like system, but I think that goes beyong Alex's question?)

Actually this leads right into the very next question I had in mind:

Suppose instead of the 2-terminal variable resistor you get with the SPST switch, you wire up a 3-terminal potentiometer with a SPDT switch (each "throw" corresponding to the outer lugs of the pot, the "pole" corresponding to the wiper).  Now what sort of taper(s) could you achieve? 

I was thinking, if you used series resistors with terminals "1" and "3" that you would get a U-shaped plot on zyxwyvu's graph, going to infinity at 0 and 1, with a minimum at 0.5s, 2000 ohms.

But there must be several other tapers you could get using a combination of series and parallel resistors... anyone wanna make some pretty graphs?  :)

potul

Well, if you do something like this (parallel only, no series resistor):



You will end up with quite a linear taper voltage divider. (I'm assuming some switch resistence, although it does not have an effect in the taper).



The issue is, the Total Resistence (the sum of the 2 legs) is not constant as in a normal pot, and it varies a lot (it can go from R to almost zero). If the idea of having near zero total resistance is not good, you can mitigate the issue by adding a couple of series resistors, but this will mean you will never have 0 voltage or 5 voltage, you will be near though.

(interesting topic.. opens up multiple ideas in my mind...)

Potul.

earthtonesaudio

Awesome!  Now how about if you used only series resistors; no parallel resistors?

potul

According to my excel simulation, you will also get a linear voltage divider, but the total "pot" resistance will vary from infinite to around 4xR.

The good thins is you can get fancy tapers (log style or antilog style) by having different values or R in both legs (when using series resistors). Do you want some graphs?


PRR

> if you do something like this (parallel only, no series resistor):

Then each leg's value is always ZERO. (50% of zero is zero.)

The resistors must be in series with the switch. (10K/50% is 20K.)

You should also define how you are going to smooth-out your pulses. Where is the C?

A SPDT switch between two resistors in "potentiometer" topology appear to give linear average voltage, but you need the cap to avoid apparent paradox.
  • SUPPORTER

potul

#11
yes, that is true. That's why I said I was assuming some internal resistance of the switch. So it is better to add a small R in series. Regarding the cap, I guess it is always needed in any PWM resistor setup, right?

Just to clarify, I was focusing this from the theorical perspective, not trying to provide a working schematic... so be careful with what I posted.