Help needed in calculating gain in Red Llama/Craig Anderton's Tube Overdrive

Started by bushidov, October 14, 2019, 07:31:41 AM

Previous topic - Next topic

bushidov

Hi Folks,

Got another question on how a circuit works. In the Craig Anderton's Tube Overdrive/Fuzz circuit,


which in turn became popular in the Way Huge Red Llama circuit,


the heart of the "overdrive" is found in the CD4049 (or even CD4069) IC. If I look at what makes up the CD4049, it appears to be a series of MOSFETs, N-Channel and P-Channel. I found a schematic called the "Discrete Llama" which appears to correctly dissect it into it's MOSFET components.



I have a couple of questions in regards to this circuit, mostly involving gain, though I do have a filter question as well.

1. Using the Discrete Llama schematic as a guide, do C1 or R2 create any kind of passive RC filter? I don't see R2 going to ground, VCC or bias, but it does go into a feedback line, so maybe?

2. Using the Discrete Llama schematic as a guide, how do R4, and the BOOST pot calculate gain for the first stage and or R6 on the second stage? I know how to calculate gain on an op-amp, but this doesn't appear to work the same way.

3. Using the Discrete Llama schematic as a guide, I am guessing C3 and C4 work as a passive low-pass filter which gets rid of the higher, harsher frequencies and harmonics. I know the function fc = 1 / (2*Pi*R*C) and I would guess I know all values for that except R, assuming that function applies here. If it does apply, where do I get the value of R from and if it doesn't, what function do I use to calculate cut-off?

Sorry for being the math nerd, but not understanding fundamental analog electronics.

Thanks for your time,
Erik
"A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away."

- Antoine de Saint-Exupéry


R.G.

National Semi at one time published an application note titled "Linear Applications of CMOS ICs" or something similar. It had a really useful chart of gain for (1) unbuffered CMOS gates (2) of that vintage. IIRC, it was about 30-36DB, a gain of a few hundred. This is much lower than the typical 100,000-ish of many opamps. But it's enough to get feedback to work, mostly.

Item 1: the gates must be the unbuffered kind. Buffered gates typically have three gates in series inside, so the gain is on the order of 90db, and this is far too much to use them in analog feedback applications. So the gates have to be unbuffered to be able to design and predict how it will work. Buffered gates ... might accidentally work, but there are at least three semi-identical time constants, one per series gate inside there, so feedback usually makes for a reliable oscillator. Only unbuffered.

Item 2: CMOS is "jellybean" logic, meaning that the profit margins are so low that manufacturers use whatever MOS processes exist in their N-generations better fabs. So the old datasheets are not reliable on what today's new-made CMOS does. It will for sure meet minimums, but may be way faster and way "better" in several ways that make it better logic,  but may well make the gates have higher or lower gain.

With that in mind, the gain of the second inverter is >about< Rf/Ri. Rf is 1M, but what is Ri? It's the output impedance of the first inverter. That's ... um, indeterminate. It's low. If we just guesstimate it at 0 because of the linear feedback on that first inverter lowering its output impedance, we might say that the second inverter is running open loop for the 1/3 of the power supply voltage where it's running in a linear mode, not banging against the rails internally. Call it 30db for the fraction of the swing where it even has a linear gain.

The first inverter will be approximately Rf/Ri, and we can actually calculate that. Rf is the resistor plus pot values. The Ri is that 100K plus whatever the driving impedance is. Let's assume that it's being driven from less than 10K, which is absolutely true if this is driven by a pedal, and true for low frequencies if a guitar drives it. The gain will be less than Rf/Ri, infinitesimally so for low gains near one, and increasingly less for higher gains, where it approaches, but does not equal the open loop gain for very high feedback resistors.

That's the story for the integrated gates. What about the discrete one? That "for the original process and manufacturing" applies double, triple, and quadruple. Discrete MOSFETs will little or no correlation to the original gates' gain. Worse, they will vary hugely with individual devices. The big kicker is that second inverter. It's running open loop, and with discrete MOSFETs, you have to go read the datasheets for the min/max transconductance and use that to figure the voltage gain. This will be only accidentally similar to the integrated gates. The same applies to a lesser extent to the first inverter, as it only needs enough gain to make the approximation to Rf/Ri be truer. And both inverters have a linear gain only where they are not starting to saturate at the top and bottom of the output swing.

If I had to come up with a gain for this, I'd simulate it, and force different values of transconductance on the models for the MOSFETs. If I had to make the real-world gains predictable, say for a space shot or some such, I'd force a load on the second inverter with a series R and C to ground to make the gain (transconductance times load resistance) at least semi-predictable.
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.

Fancy Lime

Hi Eric.

1. Yes, C1 and R2 form a high pass filter, just like any passive low pass, because R2 goes to the input of the first inverter. Inverter inputs act as "virtual ground points" if the inverter is pressed into linear operation, exactly like the inverting input of an opamp if the non-inverting goes to ground (in a dual supply scheme) or V1/2 (with single supply).

2. Gain1(f) = ( (R4 + BOOST) || r[C3] ) / (R2 || r[C1] )   ;   Gain2(f) = ( R6 || r[C4] ) / r[C2]
Meaning: Gain is calculated just like in a non-inverting opamp and is a function of frequency. All you need is the resistances at all frequencies of interest. Capacitors can be viewed as "frequency dependent resistors" for this purpose. The frequency dependent resistance is called reactance (which I called "r[C...]" here) and can be calculated:
https://en.wikipedia.org/wiki/Electrical_reactance

3. R4 + BOOST and C3 make the first low pass, R6 and C4 make a second low pass.

Hope that helps,
Andy

EDIT: I forgot so mention that all of these considerations are limited by the capabilities of the CMOS inverters and you need to consider the source impedances seen by each inverter (see R.G.'s post).
My dry, sweaty foot had become the source of one of the most disturbing cases of chemical-based crime within my home country.

A cider a day keeps the lobster away, bucko!

PRR

> National Semi at one time published an application note titled ___ or something similar.

CMOS Linear Applications, National Semiconductor Application Note 88
http://www.shrubbery.net/~heas/willem/PDF/NSC/AN/AN-88.pdf
  • SUPPORTER

PRR

> called the "Discrete Llama"

In addition to R.G.'s notes on Gm, when we run at 9V the "plate resistance" of MOSFETs is NOT "infinite". In plain CMOS logic chips the drain impedances have a strong effect on open-loop gain, which is why OLG is higher at 3V than at 15V.

The *FAT* BS170/etc are NOT micro-scopic chip devices. They are rated 50X higher current. The current we would like to run them at for g-amp is way down on the graphs, and parameters down here are not well controlled. Good Luck.
  • SUPPORTER

bushidov

Nice explanations, guys. It seems like the Discrete Llama, though a pretty cool idea, is not a good representation as to what the unbuffered CD4049 is doing in the Red Llama. So, using the Red Llama as a guide and using the rough maths from Andy (Fancy Lime):

Discrete Llama parts: Gain1(f) = ( (R4 + BOOST) || r[C3] ) / (R2 || r[C1] ) and Gain2(f) = ( R6 || r[C4] ) / r[C2]
So...
Red Llama parts: Gain1(f) = ( (R4 + VR1-GAIN) || r[C3] ) / (R2 || r[C2] ) and Gain2(f) = ( R5 || r[C5] ) / r[C4]

Red Llama parts: Gain1 = ( (100,000 + 1,000,000) || r[0.000000000051] ) / (100,000 || r[0.000000068] ) and Gain2 = ( 1,000,000 || r[0.000000000100] ) / r[0.000000033]
Red Llama parts: Gain1 = ( 1,100,000 || r[0.000000000051] ) / (100,000 || r[0.000000068] ) and Gain2 = ( 1,000,000 || r[0.000000000100] ) / r[0.000000033]

So, the problem becomes that as the frequency of a note changes from the guitar output, the gain calculations change, because the reactance of the capacitors on the inverter circuits change the resistance values. So, substitute r[C] with 1 / (2*pi*f*C)?

So, for the example of reactance on C3 of the Red Llama, assuming the note is a flat 1kHz, with a 51pF capacitor, the reactance would be 1 / (2 * pi * 1,000 * 0.000000000051) = 3.1M ohm? so at 100Hz, 31M ohm? and at 10kHz, 310K ohm?

If that is correct, that is some terrible math to go figure out because a range of 310K to 31M is pretty big, and that was just one reactance calculation.
"A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away."

- Antoine de Saint-Exupéry

PRR

> with a 51pF capacitor, the reactance would be ... = 3.1M ohm?

It is a low-pass. At max R it cuts above 3kHz, certainly most of the guitar. At 100K it is 30kHz, more.

Gain is essentially proportional to R, except at the highest gain where it shaves a wee bit of treble.

You need the practice to quickly rough-out R-C problems and decide if they matter. (If they are worth "terrible math".)
  • SUPPORTER

R.G.

A far worse problem is lurking under that math. You may have noticed that I mealy-mouthed the gain issues with "about" and "approximately" while pointing to device variation.

Historically, electronics pros back into the 1920s (!) turned to feedback to stabilize circuits against component variation. They were dealing with vacuum tubes that could be replicated in one of today's garages. Worse, they often had to deal with +/-20% tolerance parts, including resistors. Caps were worse. So they tried really hard to find circuits that depended only on the simplest of parts to determine gain and other properties.

JFETs are so variable that the industry largely doesn't use them much.

So the variations in the discrete MOSFETs are likely to undo a lot of what you're trying to poke at and guess at, even for the same part number from different lots.

Um... I avoided asking this at first, but you seem to be sticking with the issue. Why is it you need to know how to calculate the gains?
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.

bushidov

R. G. and PRR

The reason I am curious is to basically know that variables I can change in component values to effect the sound and tone. It appeared from looking at the "discrete" version that the CD4049 was nothing more than a use of MOSFETs for amplifiers/boosts, and figured it would work similarly to an op-amp, which has a pretty straight-forward method of effecting it's gain. I am aware of some methods of passive and active filters for manipulating tone, which I didn't figured fit in, in this case.

Basically, I wanted to make datasheets for some circuits, similar to how ElectroSmash does theirs.

What I am gathering is this circuit, as small in BOM as it may be, seems to be more complicated than your "typical op-amp overdrive", LOL
"A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away."

- Antoine de Saint-Exupéry

Sooner Boomer

Along the lines of this topic...

There are six inverters in the IC, three pairs of inverters for a non-inverted output (if that's important), so why not use eall of them?  Why not have a series of low/moderate gain stages, that would overload in sequence (from the output towards the input stages)?  Seems like this would give a smoother transition as overload occurs, and give increased harmonic content.
Dan of  ̶9̶  only 5 Toes
I'm not getting older, I'm getting "vintage"

Rob Strand

A different way to look at the HF roll-off is using the concept of gain-bandwidth.    Weird as it may seem the *100k* and the 47pF cap work together to give near unity gain at,

fgbw  = 1/ (2*pi*100k*47pF) = 33.8kHz

(The assumption here is the opamp gain is somewhat larger than 1 but it doesn't need to be infinite.)

So if you attempt to get an overall gain of 20dB (ie. x10) the low-pass cut-off will be,

f3 =  fgbw / gain = fgbw  / 10  = 3.4kHz.

The key point of this method is it doesn't care *how* you achieve the overall gain of x10.  If the opamp gain is high then for 20dB gain the feedback resistor needs to be 1M and you get f3 = 1/(2*pi*1M* 47p) = 3.4kHz.
However, if the "opamp" gain say 25dB  you will need to increase the 1M resistor to 1.4M to compensate for the low opamp gain in order to get a final x10 gain.  After you do that the low-pass cut-off is still 3.4kHz  not  1/(2*pi*1.4M * 47p)  since the 1/(2*pi*RC) formula is only valid *when* the opamp gain is high.

The other point is in a real pedal if the opamp gain is low you will naturally adjust the gain pot to a high value to get same overall gain/amount of overdrive.   And as it happens because of the gain bandwidth idea the low-pass cut off will automatically correct itself.  It all comes out even.

FWIW, the high-pass cut-off moves down in frequency when the opamp gain is low.  That doesn't fix itself by adjusting the gain pot.

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.