1/x function with op amps or multiplier or something else...

Hello,

I'm trying to figure out the best way to go about making a -1/x function in hardware. From googling around I see 2 methods,

  1. Inverting log -> Anti-log
  2. OpAmp with multiplier in the feedback loop

I have +/-5V rails available, and my input is from 0.4V to 2V (which should give me an output of (-2.5 to -0.5). All DC values.

Can anyone point me in the right direction here, I'm trying to do this with as few parts (no microcontroller) and as painlessly as possible, it doesn't have to be very accurate (2-5% error it ok).

Much Thanks!

Reply to
Fibo
Loading thread data ...

Use a diode with exponential current vs voltage. Input a current to the diode and measure the voltage to get a log function. Then a derivative of ln(x) = 1/x

Reply to
omnilobe

But how do you take the derivative of ln(x)?

--
www.wescottdesign.com
Reply to
Tim Wescott

For a production system that has to work at all temperatures over all possible part variations, a microprocessor may be the most painless thing of all.

Either of your proposed methods should work. Beware of temperature variations. Multiplier circuits are compensated.

--
www.wescottdesign.com
Reply to
Tim Wescott

Oh -- forgot to mention. If you feel compelled to roll your own with diodes or whatnot, a transistor with the base shorted to the emitter works better than a diode -- I dunno why, and I don't have a lot of experience, but it's been mentioned to me here before and my own (limited) experience seems to bear it out.

--
www.wescottdesign.com
Reply to
Tim Wescott

For a multiplier, one possibility is a variable duty cycle chopper. Start with a '555 with current source pullup (just a grounded-base PNP transisor with emitter resistor to +5) to make a sawtooth ('555 powered from GND and -5V, this makes a 1.67 Vpp triangle). Attenuate the input signal, 'X', to the {0, 1V} range and feed to a comparator, and use the comparator's open-collector output to chop (shunt to ground) your other signal, 'Y'.

After a bit of low-pass filtering, the chopped signal has a value of X * Y /1.67...

I'd level-translate the triangle with a blocking capacitor and ground-clamp diode, but there's other options.

This all assumes that your 'X' input, and your 'Y' output signals can be much slower than a manageable sawtooth generator. Under 1 kHz would work fine; over

1 MHz, means you'd be better off with something else.
Reply to
whit3rd

A transdiode is a transistor with base shorted to the collector, not emitter. You'll get a diode even with the emitter connection, but with worse performance.

--

-TV
Reply to
Tauno Voipio

A diode-connected transistor is actually the world's simplest feedback amplifier. V_CE adjusts itself to be exactly what V_BE has to be in order to draw the exact amount of collector current applied. That's why they're such accurate logging devices.

They work great at low frequency and decent current levels, but even a 5 GHz transistor like the BFT25A will run out of bandwidth when you get down to the nanoamps. (I discovered this experimentally.) ;)

For the OP's problem, I'd vote for a log-antilog based on a matched quad NPN such as a MAT14 or LM3046 (which is a quint).

Of course the input and output are both in volts, so you're really computing Vref**2/Vin. You need two V_BE's derived from Vref (either two diodes in series or one and a 2x amplifier), subtract the Vin one, and then exponentiate the result. It's best to buffer the Vref side with an op amp, because otherwise the variable current on the output side will cause an error. (Same thing on the output of the subtraction..)

The tempco goes away to leading order, I think, because the I_S term varies slowly with collector current, and the eV_BE/kT term cancels since the sum of the V_BEs is the same in both branches.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs 
Principal Consultant 
ElectroOptical Innovations LLC 
Optics, Electro-optics, Photonics, Analog Electronics 

160 North State Road #203 
Briarcliff Manor NY 10510 

hobbs at electrooptical dot net 
http://electrooptical.net
Reply to
Phil Hobbs

I've tried doing a square root function with an analog multiplier and opamp. It was happiest with big input voltages... as the input got smaller, the error got bigger.

George H.

Reply to
George Herold

Put a small dither on it, and measure the AC gain.

Cheers

Phil Hobbs

--
Dr Philip C D Hobbs 
Principal Consultant 
ElectroOptical Innovations LLC 
Optics, Electro-optics, Photonics, Analog Electronics 

160 North State Road #203 
Briarcliff Manor NY 10510 

hobbs at electrooptical dot net 
http://electrooptical.net
Reply to
Phil Hobbs

The derivative of ln(volts) is done with an op amp differentiation circuit. Op amps can make intagrators and differentiators to do calculus using capacitor feedback and series circuits. That is a standard op amp functional product.

Reply to
omnilobe

I thought of that, but could not figure out a succinct explanation.

--

Tim Wescott 
Wescott Design Services 
http://www.wescottdesign.com
Reply to
Tim Wescott

My GOD! Why didn't I think of that?!?!?!?!?!

Maybe it's because an op-amp differentiation circuit takes the derivative IN TIME, and what you're suggesting something that needs the derivative taken OF THE VOLTAGE RESPONSE. Which is a different thing.

--

Tim Wescott 
Wescott Design Services 
http://www.wescottdesign.com
Reply to
Tim Wescott

Sno-o-o-ort ;-)

Back to serious... the OP indicated fairly sloppy tolerance... why not simply a PWL fit? ...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
           The touchstone of liberalism is intolerance
Reply to
Jim Thompson

Oooh oh! You could make a voltage-to-period converter for input, then a frequency-to-voltage converter for output.

Could all be done with a 555, or maybe a pair of 'em -- use a PNP transistor connected as a constant-current source instead of the charging resistor, with a very fast discharge. Then make a constant-width pulse (with a second 555) every time the thing pops off. The average voltage out should be proportional (roughly) to /x.

--

Tim Wescott 
Wescott Design Services 
http://www.wescottdesign.com
Reply to
Tim Wescott

Like this...

Bunch of OpAmps and resistors and diodes _but_ it's stable.

...Jim Thompson

--
| James E.Thompson                                 |    mens     | 
| Analog Innovations                               |     et      | 
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    | 
| San Tan Valley, AZ 85142   Skype: Contacts Only  |             | 
| Voice:(480)460-2350  Fax: Available upon request |  Brass Rat  | 
| E-mail Icon at http://www.analog-innovations.com |    1962     | 
              
           The touchstone of liberalism is intolerance
Reply to
Jim Thompson

d'oh. Just when I'm starting to convince myself that I'm clever...

--

Tim Wescott 
Wescott Design Services 
http://www.wescottdesign.com
Reply to
Tim Wescott

in hardware. From googling around I see 2 methods,

ld give me an output of (-2.5 to -0.5). All DC values.

th as few parts (no microcontroller) and as painlessly as possible, it does n't have to be very accurate (2-5% error it ok).

Use an exponentially decaying current to charge a capacitor. I think it's w ritten up in U.K. patent 2028503 "Improvements in or relating to ultrasonic apparatus"; assigned to EMI Ltd in 1978. I didn't invent it - my name got on the patent (somewhat to my surprise) for the digital scheme for generati ng hyperbolically increasing digital numbers.

The catch with using a transistor emitter to charge a capacitor is the base resistance of the transistor - the scheme that worked subtracted a voltage equal to the base current times the base resistance from the base voltage, which wasn't all that complicated.

I've forgotten how we did it. The guy that made the circuit work had a hard time working out what was making up the hyperbola imperfect - I got to rea d his lab notes a few years later - but he found the solution really quickl y once he'd identified the problem.

There are other solutions, but non that we could come up with was as good.

--
Bill Sloman, Sydney
Reply to
bill.sloman

That's not a d/dx, it's a d/dt derivative. It works only on TIME. So, you need a ramp generator with a constant dx/dt... and some sample/hold trickery.

Reply to
whit3rd

n in hardware. From googling around I see 2 methods,

ould give me an output of (-2.5 to -0.5). All DC values.

with as few parts (no microcontroller) and as painlessly as possible, it do esn't have to be very accurate (2-5% error it ok).

written up in U.K. patent 2028503 "Improvements in or relating to ultrason ic apparatus"; assigned to EMI Ltd in 1978. I didn't invent it - my name go t on the patent (somewhat to my surprise) for the digital scheme for genera ting hyperbolically increasing digital numbers.

se resistance of the transistor - the scheme that worked subtracted a volta ge equal to the base current times the base resistance from the base voltag e, which wasn't all that complicated.

Oops. You've got to increase the voltage applied to the base terminal of th e transistor to compensate for voltage drop across the base resistance.

That's actually very easy to do if you can put a current mirror between the collector of the transistor and the rail. The current going into the mirro r collector current is proportional to the base current, so you can use it to develop and extra voltage drop of the right size between the base of th e hyperbolic transistor and the negative rail. There's got to be a pot in t here somewhere to be twiddled reflect the actual base resistance and curren t gain of the transistor making the hyperbola.

I don't think that is the way we did it - it got bundled into the system fo r starting the hyperbolic voltage at right point - whatever we did was pret ty simple.

rd time working out what was making up the hyperbola imperfect - I got to r ead his lab notes a few years later - but he found the solution really quic kly once he'd identified the problem.

.
Reply to
bill.sloman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.