I'm having some trouble working out the transfer function of the below circuit. It's coming from here. \$R_K\$ is changing in increments of 1k about 8 times. Supposedly if you plot this against an exponential function it approximates it fairly well (<1%). However, when I plot my values with that transfer function I get different results so I'm guessing my math is off.

Or I'm just misunderstanding how the complete circuit from Hackaday works and another element is having the "exponential effect". However, I don't think so due to this paragraph: "So, I found a way to combine two op amps and a few resistors in such a way that a linear increase in resistance from the keyboard turns into an almost exponential voltage that the oscillator can use. Technically the response is polynomial not exponential, but the polynomial is within a fraction of a percent of a true exponential."


simulate this circuit – Schematic created using CircuitLab

I couldn't figure out how to get current arrows into the schematic, sorry.

My basic assumptions are:

$$ i_1 = -i_2\\ i_1 = i_P - i_K\\ R_3 = 2*R_4\\ R_2 = 2*R_1\\ $$

and then my math goes like this:

\begin{equation} i_2 = \frac{(V_O - \frac{V_{in}}{3})}{R_2} \end{equation}

\begin{equation} V_P = V_{in} - \frac{V_{in}}{3} - V_{R1} = \frac{2*V_{in}}{3}-i_1*R_1 \end{equation}

\begin{eqnarray*} i_1 &=& \frac{V_P}{R_P} - \frac{(V_{in}-V_P)}{R_K} \\ &=& \frac{(\frac{2*V_{in}}{3}-i_1*R_1)}{R_P}-\frac{(V_{in}-\frac{2*V_{in}}{3}+i_1*R_1)}{R_K} \\ &=& V_{in} * \frac{(8*R_K-12*R_P)}{(12*R_P*R_K+6*R_2*R_K+2*R_2*R_P)} \\ \end{eqnarray*}

at which point I put everything into \$i_1 = -i_2\$:

\begin{equation} V_{in} * \frac{(8*R_K-12*R_P)}{(12*R_P*R_K+6*R_2*R_K+2*R_2*R_P)} = \frac{(\frac{V_{in}}{3} - V_O)}{R_2} \\ \ldots \\ \ldots \\ V_O = \frac{V_{in}}{3}*\frac{(2*R_P*R_K-3*R_2*R_K)}{(2*R_P*R_K+R_2*R_K+R_2*R_P)} \end{equation}

My guess is I mucked something up with the voltage around the op amp inputs since it's not GND, but despite a few approaches (the math above being the last one) I can't figure out where my mistake is. I skipped putting some steps in my math in the post so it stays somewhat compact.

Now, I'm not necessarily looking for a full worked example (although I'll also gladly take that), I'm more than happy if someone can give me a hint where I made a mistake and maybe even explain what that mistake is.

This is my first time asking a question so if I did something wrong (like formatting the formulas in a weird way) please tell me so I can do better next time.

  • \$\begingroup\$ That specific circuit has nothing non-linear in it, so it will have a linear response until the op-amp reaches its output voltage limit in either direction. Your last equation says it all, vo = vin/3*some_function_of_resistor_values, that function is of course constant. In the circuit you link to, it's the FETs that appear to be doing the non-linear work, as voltage-dependent resistors, which you don't have in your circuit. Great formula formatting for a first-timer BTW! \$\endgroup\$
    – Neil_UK
    Commented Oct 20, 2021 at 13:50
  • \$\begingroup\$ The issue is that this seems to be wrong since, well, it does not approximate an exponential function Which was my conclusion also after reading the title of your question and looking at the circuit. Assuming that the Opamp can work in proper feedback mode, there are no non linear elements in your circuit so it cannot behave in any exponential way. For an exponential / logarithmic circuit I would expect to see a diode for example. \$\endgroup\$ Commented Oct 20, 2021 at 13:51
  • \$\begingroup\$ Ah crap, of course I forgot the most important piece of information. The op amp itself is not specifically approximating the exponential, it's more that resistor R_K is changing depending on which key is pressed. Say there are 8 different keys/resistors. If you then plot the output voltages of the op amp against a true exponential the error is very low (< 1%) and my transfer function does not do that. I think I'll remove the "exponential" thing from the post since it just adds confusion. \$\endgroup\$ Commented Oct 20, 2021 at 14:10

1 Answer 1


Try to use a superposition principle to get the "low entropy" equation.

We have to analyze those two circuits:

Case one:


simulate this circuit – Schematic created using CircuitLab

$$Vo' = \frac{V_{IN}}{3} \left(1 + \frac{R_2}{R_1 + R_P||R_K}\right)$$

Case two:


simulate this circuit

$$Vo'' = -V_{IN} \left(\frac{R_K||R_1}{R_P + R_K||R_1} \times \frac{R_2}{R_1}\right)$$

And finally we have:

$$V_O = V_{IN}\left(\frac{1}{3}\left(1 + \frac{R_2}{R_1 + R_P||R_K}\right) - V_{IN}\frac{R_K||R_1}{R_P + R_K||R_1} \frac{R_2}{R_1}\right)$$

As you can see we have a differential amplifier.

  • \$\begingroup\$ Thank you! For some reason I did not think of that but your answer completely opened my eyes. Apparently I can't upvote yet, is there some other way I can leave reputation? \$\endgroup\$ Commented Oct 21, 2021 at 6:21
  • \$\begingroup\$ Thx, for your kind words. As for the reputaion, simply answer the people's questions or ask more yourself. \$\endgroup\$
    – G36
    Commented Oct 21, 2021 at 13:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.