12
\$\begingroup\$

The potentiometer on the left of the circuit below is actually the output of a digital potentiometer designed for audio volume control, so its outputs are internally configured to offer 64 logarithmic steps, from 0dB to -64db. I can't change that. Now as it turns out, I need to use the output to control an audio amplifier that has an internal DSP processor, which accepts 0-3.2VDC to control its audio volume. That amplifier currently gets that voltage from a linear potentiometer, so it is internally doing its own linear to log conversion. So using the circuit shown without the diodes, with just R11 and R12 used as a simple voltage divider to convert my 0-12V to a 3.2V range, it works but the response is less than ideal. Since the output of my digital pot is advancing the voltage in 1 dB steps, the "steps" become audibly noticeable in that amplifier's output level, especially as the higher volumes are reached. So what I need to do is convert the logarithmic steps to some approximation of linear, meaning I need an anti-log function.

So I'm thinking of approximating an anti-log curve with a couple of diode networks as shown. Basically, the output voltage will initially follow the input voltage, but then rise progressively slower as D2, and then later the D3-D4 pair begin to conduct. It seems to work well enough to make the volume control sound more responsive, but somehow the circuit just seems to be a "hack" to me. Can anyone suggest a more eloquent solution that doesn't involve a huge amount of additional parts? enter image description here

Addendum... After playing trial and error with the above circuit all day, feeding it with a linear ramp and comparing input to output, I decided it was too difficult to optimize. Should the max reference voltage (12 V in the above) change at all, too many resistors have to change to duplicate the desired response. But on a whim I came up with this. I honestly have no idea if I'm really approximating an anti log (or log) response with this configuration, but I found it very easy to "tune" to a desired response, as long as the max input reference voltage was at least 2 or 3X the desired final output max. The gist is, as the input POT was adjusted higher, the output would gradually diverge from the input, so that input changes had progressively less affect on the output. The final test of course was to actual try it with an audio signal through the voltage controlled amplifier, and I thankfully found the digital POT control to be much more natural.

I'd still welcome comments on why this seems to be working so well, whether I am indeed approximating the non inverting log curve I'm after, and whether it could be done simpler. But bottom line, if anyone else runs into a similar problem, this does seem to work VERY nicely... at least to my ears!

enter image description here

Another addendum: For the benefit of anyone following this in need of a similar circuit, I need to point out the the LM324, despite being a common choice for single supply OP-AMP circuits, turned out to be a poor choice for this otherwise good circuit. The reason being, this OP amp is based on internal BJT transistors, and so it really can't "drive" any output below 0.6 volts. In my case, even though I didn't need the LOG response curve to start below that point, the circuit still needed to output 0-3 volts into an existing circuit that had a small positive bias current, and so I was not able to adjust the output down to zero, even if I grounded the final OP amp used as a buffer). So I will likely replace the quad OP amp with something like the Texas Instruments TLC274, because being FET based, its output Voltage Range actually does Include the Negative Rail

\$\endgroup\$
  • \$\begingroup\$ I was at the point of editing your question to say "elegant" in place of your "eloquent", but I'd like to see someone rise to the challenge of making their solution truly eloquent. ;-) \$\endgroup\$ – Asmyldof Nov 17 '15 at 18:43
  • \$\begingroup\$ LOL!!! Well, most good engineers are lousy at spelling, so hopefully I'm in good company! \$\endgroup\$ – Randy Nov 17 '15 at 18:48
  • \$\begingroup\$ I'm too lazy to calculate through your specific problem, but for all the maths on log/exponential amplifiers using the exponential properties of a transistor, you could look at this: electronics.dit.ie/staff/ypanarin/Lecture%20Notes/DT021-4/… \$\endgroup\$ – Asmyldof Nov 17 '15 at 18:55
  • 2
    \$\begingroup\$ A string of diodes with ressitors sprinkled between them like you have there is a pretty standard approach, don't call it a hack. Simple, cheap, easy to define a non-linear law by ressitor choice, what's not to like? (blamed keyboard won't spell ressitor!) \$\endgroup\$ – Neil_UK Nov 17 '15 at 19:02
  • 1
    \$\begingroup\$ Thanks @PeterSmit. I see that the reason i was confused was because the data sheet for the digital pot, which is my source, gave the impression it had a "LOG" response, because each 'step" was 1DB. I needed to revere that, so I thought I was crafting an anti-log circuit. But now that i think of it, it is the pot that really has the anti-log response, and my "log" amplifier is basically needed to convert it to linear. Its too bad I go that wrong in the title, because the information in my OP is less useful due to my inaccurate title. \$\endgroup\$ – Randy Nov 18 '15 at 15:24
2
\$\begingroup\$

Your 2nd circuits (with the NPN and R divider) is a good approximation of a log circuit. This is because when the input opamp generates a voltage substantially above 0.6 V, the current in the 4.7k is proportional to the voltage, and so the V across the NPN is proportional to the log of that current. The 100k & 10k give a multiplier effect, so in fact, your transfer function is closer to VOUT = K*26mVln(Iin/Is), where Iin = (VIN-0.7)/4.7k. 'Is' is hard to find directly, but if you measure (guess) VBE at 1 mA (say 0.6 V), the equation can be rewritten as VOUT = K[26mV*ln(In) + 0.6], where 'In' is in mA.

K is the gain from your R divider -- with 'Contour' =0, it's 1; with 'contour' = 20k, it's 3.

Note that this circuit will change over temperature --if the NPN heats up by (say) 30 deg. C, that's equivalent to about a 10 dB reduction in volume (when you go through math).

\$\endgroup\$
  • \$\begingroup\$ Thanks. Thats a good confirmation that the idea is sound. And as I've switched to a TLV274 OP amp, which is FET based and has a much stronger pull down capability, the circuit works much more predictably down at sub-volt levels. \$\endgroup\$ – Randy Dec 8 '15 at 3:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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