Another Circuit with a "Logarithmic" Characteristic

Introduction

Electronics is my profession and my hobby (along with mathematics). For a hobbyist project of mine, I need an amplifier circuit with a programmable gain that varies exponentially with the setting on a potentiometer. When I design a circuit, I usually begin my design effort with a web search. I do not like reinventing the wheel. I found an old EDN article that has an interesting circuit, but the figures are not visible. I will reconstruct the circuit here based on the text description and make a small modification that makes it a bit more appropriate for my application.

Note that this problem is closely related to an early post of mine on potentiometers. I could use a log potentiometer, which really have an exponential resistance characteristic, but I have not been satisfied with the accuracy and repeatability of these components. So I have looked for an alternative approach and this one seems reasonable.

Requirements

I need a circuit with a gain that varies exponentially according to the setting of a potentiometer. Equation 1 shows the functional form that I am looking for.

Eq. 1 y=A\cdot {{e}^{-k\cdot x}}

where

  • x is the potentiometer setting as a percentage of full-scale.
  • k is an arbitrary constant.
  • A is an arbitrary constant.

I often end up plotting my results on a semi-log plot. Equation 1 represents a straight line on a semi-log plot, which I prove in Equation 2.

Eq. 2 \ln \left( y \right)=-k\cdot x+b\Rightarrow y={{e}^{-k\cdot x+b}}
y={{e}^{-k\cdot x+b}}\Rightarrow y=A\cdot {{e}^{-k\cdot x}}\text{, where }A={{e}^{b}}

Knowing that Equation 1 will plot as a straight line will allow us to graph the circuit response and determine how well it conforms to Equation 1.

Original Circuit

Because the schematic is no longer present in the article, I need to regenerate it. Figure 1 shows my guess for the schematic.

Figure 1: Schematic for a Circuit with Logarithmic Voltage Output.

Figure 1: Schematic for a Circuit with Logarithmic Voltage Output.

This circuit reminded me of some of the circuits my graduate school advisor, Arum Budak, used to come up with. A number of his circuits made clever use of op-amps driving potentiometer wipers. As he always did, I made sure sure that my opamps are "happy" -- which to Dr. Budak meant that the plus and minus inputs are at the same voltage (i.e. the virtual ground assumption holds). Another good aspect of the circuit is that both opamps are inverting. This follows the admonition of the great analog designer Jim Williams, who said "always invert (except when you can't)." Inversion is superior because the virtual ground eliminates common-mode errors.

Figure 2 shows that the gain of the circuit can be expressed as a function of the wiper setting as a percentage of the potentiometer's full scale setting.

Figure 2: Original Circuit Analysis.

Figure 2: Original Circuit Analysis.

Figure 3 shows the gain versus potentiometer setting (% of full scale) for the circuit of Figure 1. Note that the middle region of the curve is a straight-line, which indicates that Equation 1 holds in that region.

Figure 3: Voltage Gain Versus Potentiometer Setting for Circuit of Figure 1.

Figure 3: Voltage Gain Versus Potentiometer Setting for Circuit of Figure 1.

We see that this circuit has a linear gain characteristic on a semi-log plot in a range of x from 0.2 to 0.8. This is the circuit behavior is close to what I need and is good enough for me to proceed with.

While this circuit does generate an exponential gain curve, it is not very flexible. I only have one parameter that I can adjust, ß = R1/R3. This means that I can only adjust one aspect of the gain curve, say its slope or its value it a point. Ideally, I would like to adjust the gain curve's slope and set its value at a point. Let's see if we can make the circuit of Figure 1 just a bit more flexible.

Slightly Modified Circuit

The circuit of Figure 1 has a few shortcomings when it comes to implementing a specific exponential function:

  • There is only one parameter, the resistor ratio R1/R3.
  • The simplest thing for me to do would be to set the slope and value of my potentiometer circuit gain equal to the slope and value of my desired function at a point (e.g. mid-point of the range of x)
  • adjusting the slope and value of my potentiometer independently means that I need two independent parameters in my potentiometer circuit.

As I think about it, adding some fixed resistance on both sides of the potentiometer may be the answer. These resistors will give me another parameter to "tweak." Let's analyze the performance of the circuit of Figure 4.

Figure 4: Slightly Modified Circuit for Generation Ln(1/x).

Figure 4: Slightly Modified Circuit for Generation Ln(1/x).

Figure 5 shows my analysis of this circuit.

Figure 5: Analysis of My Modified Circuit.

Figure 5: Analysis of My Modified Circuit.

The circuit now has two parameters that will allow me to adjust the slope and circuit gain at a specific point. Let's work an example to illustrate the procedure.

Worked Example

Let's assume that we need a circuit with a gain described by the function G(x)=3\cdot {{e}^{-2\cdot x}}. My approach will be simple: (1) setup two equations in two unknowns, and (2) solve the resistor ratio ß = R1/R2 and the value of α = R0/RP.

  • create an equation for the slope of the potentiometer circuit at x=1/2 equal to slope of G(x)=3\cdot {{e}^{-2\cdot x}} at x = 1/2.
  • set the gain of the potentiometer circuit at x = 1/2 equal to the value of G(x)=3\cdot {{e}^{-2\cdot x}} at x = 1/2.
  • solve these two equations simultaneously using the nonlinear solver in Mathcad.

Figure 6 illustrates how I used Mathcad's nonlinear solver to set my potentiometer circuit's parameters.

Figure 6: Nonlinear Solution for the Modified Potentiometer Circuit.

Figure 6: Nonlinear Solution for the Modified Potentiometer Circuit.

Figure 7 shows the level of agreement between my ideal equation and the potentiometer circuit output.

Figure 7: Gain versus Potentiometer Setting for the Modified Circuit.

Figure 7: Gain versus Potentiometer Setting for the Modified Circuit.

In my opinion, the result is pretty close. Good enough for the project I have going here.

Conclusion

This is a simple circuit that does what I need, which is to accurately render the exponential function over a limited range. I like the fact that I can obtain a dual opamp and linear potentiometer more readily than I can obtain an accurate and repeatable "logarithmic" potentiometer. See the Appendix for empirical Data.

Appendix

Figure 8 shows the circuit that I constructed in LT Spice.

Figure 8: Circuit in Spice.

Figure 8: Circuit in Spice.

Figure 9 shows a plot of the data from a quick test.

Figure 9: Circuit Test Results.

Figure 9: Circuit Test Results.

Save

Save

This entry was posted in Electronics and tagged . Bookmark the permalink.

7 Responses to Another Circuit with a "Logarithmic" Characteristic

  1. Michael Dunn says:

    I know what you mean about log or audio pots not being accurate enough.

    I recently used some slide pots (Panasonic?? from Digikey) that might be more accurate (well, repeatable), as they're constructed with 4 or 5 breakpoints – resistors deposited on the substrate, paralleling the main element – to generate the log curve.

    And I don't know why so many EDN articles are missing their images. I've mentioned it. Perhaps it'll improve as the new site comes online.

  2. mathscinotes says:

    I did not know that more accurate pots might be out there. I will investigate. Thanks for the info.

    I think the images are still on their site, but the links are broken. I found images for one article that were in a folder different than the link was pointing at. However, I could not find the images for this article.

    Mathscinotes

    • Michael Dunn says:

      If price is no object, you could also search out makers of instrumentation-grade pots. Linear is the most common of course, but I believe other laws are available (including real curves – not piecewise). Maybe these have disappeared into the mists of time though. Professional mixing desk pots might be another source...

      Speaking of failed websites, I once encountered a page where no graphics at all were showing up. Looking at the source, all the image URLs were written with "" instead of "/"! Doubtless another Microsoft innovation. See the 4th paragraph here:
      http://www.scopejunction.com/author.asp?section_id=1835&doc_id=243897

  3. Pingback: Some Empirical Potentiometer Results | Math Encounters Blog

  4. You can simulate simple exp amplifier on
    http://www.cirvirlab.com/simulation/op_amp_exp_amplifier_online.php
    Instead of fixed resistor, you can use potentiometer.

  5. Boyan Petrov says:

    This circuit is used in IBANEZ GTA15R guitar amplifier.
    Thanks for explanation.
    🙂

Comments are closed.