Op amp production of y=ln(x)

Feb 11, 2011 43 Replies

Tim Wescott expounded in news:md-dncuBCcOZIcjQnZ2dnUVZ snipped-for-privacy@web-ster.com:

...

I think we are working at different objectives.

To make it clear, I want (ideally) a circuit where I can put in 3 volts, and get 1.0986 volts out. I.e. ln(3).

I really don't get/need the insistence on ln(1volt).

I don't need to operate near zero, or go into negative numbers. I simply plan to deviate near 3 volts and take whatever ln(x) will give me there and manipulate that result. My polynomials work comfortably with values near 3.

Remember, I am not using an analog computer technique to compute a numeric result in the sense of artilary aiming etc. I am interested in the polynomial response, however.

In order to work out some chosen polynomial f(x) in analog realtime, it happens to be convenient to work with logarithms, practical issues aside (as Phil has mentioned). Exponents can then be added/multiplied/divided using the usual op amp techniques.

So to compute f(3), I simply want to input the number 3, which just happens to map to 3 volts. The fact that the value is in volts is of no consequence to the polynomial that will be computed.

The inverse of ln(3) is simply 3. It doesn't bother me if that also maps to 3 volts.

I think you're too focused on the units in the result (see below).

I'm simply looking for the value of 9 volts, when vin = 3, when f(x) = x^2.

Remember, I'm not concerned about the physical units of the result as one might be in a true analog computer simulation.

I am simply inputing an instantaneous audio signal level and sculpting an amplified result, according to a chosen polynomial. Yes, this is non-linear.

Why? Because I want to apply a non-linear polynomial to determine the amplifier's response. For normal audio, this is foolishness. But for distorted electric guitar signals, the right polynomial might result in golden tone (tube-like or hopefully even better).

It's hard to put tone into units. ;-)

Warren

The reason I'm getting so wrapped up into the units is because in engineering teams, the people who say "oh, paying attention to the units is wasted effort" at the front end are the people who hold up the project at the back end because their circuits (or software, or mechanisms) don't work.

'nuff said.

Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html

whit3rd expounded in news: snipped-for-privacy@d17g2000vbn.googlegr oups.com:

If you read posts upstream, you'll notice that I'll be using a bias voltage of about 3 volts.

Warren

Jim Thompson expounded in news: snipped-for-privacy@4ax.com:

Tanh is an interesting idea, though I want to pursue a polynomial first. The idea is to allow for a certain amount of signal folding as you exceed some maximum.

Warren

George Herold expounded in news: snipped-for-privacy@r13g2000yqk.googlegr oups.com:

Yes- the idea is to offset it into the sweet spot of the polynomial, so that for small amplitudes, it behaves more or less linear. For higher amplitudes, you let it spill over into the grid conduction realm on the plus half of the cycle.

Warren

Bill Sloman expounded in news: snipped-for-privacy@x3g2000yqj.googlegro ups.com:

..

Thanks. Phil beat you to it. ;-)

Warren

00yqj.googlegro

Back-ordered? Cancel that and get a used copy from "Alibris.com" ~ $40.00 (Or some other used book place.)

I've used a log amp only once, a long time ago, and so I have nothing to reccomend. But building one sounds alot more fun to me... You learn a lot more that way.

Oh If you can't find the MAT014 search for transistor arrays on digikey... there are lots.

George H.

George Herold expounded in news: snipped-for-privacy@a28g2000prb.googlegr oups.com:

I tried that with abebooks.com. It came so close to the new price (with a discount promo) that I decided to order new.

I'll check digikey out then, thanks. I wish Mouser had more of that kind of stuff. I like the way mousers website works for storing parts lists and projects, until ready.

Warren

Look at Analog Devices' AD8307:

formatting link

(watch the wrap)

Available through Digikey.

Cheers, John

John - KD5YI expounded in news:ijcj32$hc$ snipped-for-privacy@news.eternal-september.org:

..

What concerns me about this chip is that it uses a piece meal approach (in 6 stages) to produce the result. See Figure 23 in the datasheet. This kind of discontinuity might result in unwanted some noise products in my audio application.

The 2nd concern is that I need to undo the log function later on and turn it back into a signal (i.e. antilog or exponentiation). If there is an antilog chip for this, it might be worth a try, assuming the piece meal isn't an issue.

Warren

This is a general approach which can be used (given some restrictions on f(x) - it should be monotonic increasing). Not sure if that particular chip is suitable though- haven't looked it.

+------------------------------------ + | | | | | .-----------. | | | | | | | | |\| | +--- |x Y=f(x)+----------|-\ | | | | >- ----+------ Output '-----------' -----|+/ | |/| = f^-1(Input) | | Input ------------------|

m:

Oh, it's important, all right. The logarithm conversion circuits all do a logarithm on the ratio of Vinput and kT, which is the device temperature. It's just as much a thermometer as a logarithm that you end up with.

Ah, it's a possible task, then. Logarithm converters only work for voltages larger than kT anyhow; your typical DC bias on the junction will be circa half a volt for best response. At lower values, like 0.1V, the poor diode is only getting few picoamps of current, it CANNOT slew at audio frequencies. At higher values, like 1.0V, the current in the diode has just blown your fuses and melted the circuit board. Just remember that the appropriate bias voltage is very much temperature-dependent.

Dual-transistor logarithm schemes use a second transistor as a reference, and the difference is dependent on the signal but not the temperature.

Spehro Pefhany expounded in news: snipped-for-privacy@4ax.com:

...

..

Oh- I see it now. Yes. That makes sense.

Thanks, Warren

Phil Hobbs expounded in news: snipped-for-privacy@electrooptical.net:

..

..

I hope you're getting over your cold. The only thing worse than a cold is to have one down south where it is warm (where I assume you are). Up here in Southern Ontario, we had -12C today. I am so done with winter.

I looked at AN-30 as suggested:

From what I understand, for audio frequency response, I'll want to use the Fast Log Generator shown in Figure 2. 1 to 5 ms in Figure

1 is not going to cut it. ;-)

So I need an equally fast inverse log, which I assume I need to derive from Figure 2 somehow. Figure 3 looks like a reworked Figure 1.

Based upon Figures 1 and 3, it appears that Ein becomes Eref in the anti-log. But I start getting lost about there.

I am guessing that the thermistor moves to the base of Q1 in the antilog circuit. Because of the speed enhancements, we have a LM102 living with 2 LM101As -- so much hippy love going on there. Consequently I am confused.

I'll stare at it a bit more tonight. Maybe I'll start to hear Sitar enlightenment then...

Warren

Thanks, I'm better today--got my AVR development system set up and discovered that the CPU on the target board has gone flatline. :(

Fortunately I'm at the optimal distance from Newark Electronics, i.e. close enough to get next-day delivery via UPS Ground, but far enough away to be in a good neighbourhood.

What I had in mind was something like this:

formatting link
No temperature compensation required, as long as all the transistors are on the same die and the collector currents are all in

The AD8307 is a log *detection* amp. Not at all the same function as the log amps of National's AN30.

Jeroen Belleman

sed/CubicPolynomial.pdf. =A0No temperature

t- Hide quoted text -

Phil Hobbs expounded in news: snipped-for-privacy@electrooptical.net:

..

So it went analog, eh? :)

Ok, so Q1C & Q1D going into the top right op amp (A5) are the antilog functions. Q1A and Q1B are the log functions going in the feedback loops of (say) A1 and A2.

So you're using (say) A3 and A4 to generate 2ln(x) and 1ln(x) which when summed (depending upon pots) and antilogged comes out as x^3.

I'm guessing you did the 2ln(x) and 1ln(x) separately to allow adjusting from maybe x to x^3. Is that right? Else why not go straight to 3ln(x) by setting the gain of A3 to 3 (perhaps adjustable)? Then you'd need one less op amp for a cubic.

Let's say I wanted to live dangerous and do this instead (I have a curve in mind):

y = ax^4 - bx^2. For now say a=b=1

Then I'd set A3 to have a gain of 4 to get 4ln(x) and then set A4 for a gain of 2 for 2ln(x). I'd need separate antilogs (adding an A6), so that:

y = exp( 4ln(x) ) - exp ( 2ln(x) ) = x^4 - x^2

A6 would be opposite-inverting to A5 and outputs summed. Or the subtraction done by a subtracting buffer stage A7. By choices of the input summing resistors going into A7, I could choose values for a and b, other than 1.

Do I get marks for that? :)

Not a problem. For my quartic, I need +/- output for y, which shouldn't be a problem AFAICS.

Now since there is a Vref going in, I assume that I only need to make x >= Vref. So if my understanding is right, I can set Vref to -3 volts to bias it and feed straight AC coupled audio into Vin, assuming worst case 3Vpp.

Warren

Bricks are indeed analogue. (However, my giving it the finger was digital.)

Right.

Not exactly--there's one copy of the Vbe drop in there as well. The gain of A3 and A4 is +2/-1 and +3/-2. That makes the collector currents come out right.

You can make it adjustable, but then you get a non-integer power.

Sure. The collectors are current outputs, of course, which is why I have the funny pot connections. You could use one more amp connected to the other (currently grounded) end of the pots, and sum the results. Centre position would be zero nonlinearity.

If you want the cubic term as well, you can use a quint package such as an LM3046 to give you an extra transistor.

Absolutely. If you have a scope handy, my fee is a few scope photos of the output with different pot settings.

Right. Actually X doesn't need to be greater than Vref, just greater than zero. You can center it on Vref as I showed in the schematic--you might want to use a 2.5 V reference and 20k resistors to get 3 V p-p.

Cheers

Phil Hobbs

[BTW I put up a corrected version of the schematic a few minutes after posting the original last night. The bases of the antilog transistors are grounded in the correct version.]
Dr Philip C D Hobbs Principal ElectroOptical Innovations 55 Orchard Rd Briarcliff Manor NY 10510 845-480-2058 email: hobbs (atsign) electrooptical (period) net http://electrooptical.net

Phil Hobbs expounded in news: snipped-for-privacy@electrooptical.net:

..

This I am still confused about.

The Vbe drop that you mention- is that because of A3's output connection through Q1D, into the pot wiper, to virtual ground at A5's (-) input (not to mention ground at the other pot end)?

I see the +2/-1 gain because of 10k vs 5k (2:1), but I can't see the +3/-2 gain for A4 (with 10k in feedbk and 10k going into it's - input).

I see, yes.

Yes- I get it- They are used to generate an input voltage for A5 (tweakable).

I'm not sure I follow your description..

Do you mean an additional non-inverting A6, with the grounded pot legs going into it? Then I could see why the centered pot position would be "zero non-linearity". Then by a tweak of the pot, you'd make the signal contribution a + or - in the sum. I like it.

Yes, that would be good for a audio prototyping assembly. I envision one ln(x) function, with 2-3 antilogs and a summer. So I like that idea.

Indeed. I'll be glad to do that. :)

For fun last year, I built a simple diode curve tracer out of an old PC power supply box (you get a power cord connector and switch for free):

formatting link

For the op amps, would a TL07x be good enough for this? I'll order quads for the build.

I am going to try to model this in LTspice first (until the parts arrive).

If I can get the prototype to work well enough, I plan to design a PCB for it. Then I can treat the whole assembly as a "module" of sorts.

Ok, so I do need to bias the Vin to something higher- probably Vref.

I see. So your design was based upon a smaller signal excursion? The 20k to obtain smaller input currents?

3v/20k => 150 uV peak

That's the copy I see. I did notice some white-out used. :)

Thanks Warren

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required