Electronics-Related.com
Forums

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

Started by Fibo April 15, 2016
On Thursday, April 14, 2016 at 6:21:54 PM UTC-10, Tim Wescott wrote:
> On Thu, 14 Apr 2016 20:44:56 -0700, omnilobe wrote: > > > 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 > > But how do you take the derivative of ln(x)? > > -- > www.wescottdesign.com
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.
On Fri, 15 Apr 2016 10:24:07 -0400, Phil Hobbs wrote:

> On 04/15/2016 12:21 AM, Tim Wescott wrote: >> On Thu, 14 Apr 2016 20:44:56 -0700, omnilobe wrote: >> >>> 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 >> >> But how do you take the derivative of ln(x)? >> >> > Put a small dither on it, and measure the AC gain.
I thought of that, but could not figure out a succinct explanation. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On Fri, 15 Apr 2016 08:57:26 -0700, omnilobe wrote:

> On Thursday, April 14, 2016 at 6:21:54 PM UTC-10, Tim Wescott wrote: >> On Thu, 14 Apr 2016 20:44:56 -0700, omnilobe wrote: >> >> > 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 >> >> But how do you take the derivative of ln(x)? >> >> -- >> www.wescottdesign.com > > 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.
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
On Fri, 15 Apr 2016 13:03:18 -0500, Tim Wescott
<seemywebsite@myfooter.really> wrote:

>On Fri, 15 Apr 2016 08:57:26 -0700, omnilobe wrote: > >> On Thursday, April 14, 2016 at 6:21:54 PM UTC-10, Tim Wescott wrote: >>> On Thu, 14 Apr 2016 20:44:56 -0700, omnilobe wrote: >>> >>> > 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 >>> >>> But how do you take the derivative of ln(x)? >>> >>> -- >>> www.wescottdesign.com >> >> 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. > >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.
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
On Fri, 15 Apr 2016 00:47:44 -0700, whit3rd wrote:

> On Thursday, April 14, 2016 at 8:18:30 PM UTC-7, Fibo wrote: >> 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 > > 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.
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 <some constant>/x. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
On Fri, 15 Apr 2016 11:08:12 -0700, Jim Thompson
<To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote:

>On Fri, 15 Apr 2016 13:03:18 -0500, Tim Wescott ><seemywebsite@myfooter.really> wrote: > >>On Fri, 15 Apr 2016 08:57:26 -0700, omnilobe wrote: >> >>> On Thursday, April 14, 2016 at 6:21:54 PM UTC-10, Tim Wescott wrote: >>>> On Thu, 14 Apr 2016 20:44:56 -0700, omnilobe wrote: >>>> >>>> > 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 >>>> >>>> But how do you take the derivative of ln(x)? >>>> >>>> -- >>>> www.wescottdesign.com >>> >>> 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. >> >>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. > >Sno-o-o-ort ;-) > >Back to serious... the OP indicated fairly sloppy tolerance... why not >simply a PWL fit? > > ...Jim Thompson
Like this... <http://www.analog-innovations.com/SED/PWL_Fit_to_OneOverV_2016-04-15_11-55-53.png> 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
On Fri, 15 Apr 2016 11:08:12 -0700, Jim Thompson wrote:

> On Fri, 15 Apr 2016 13:03:18 -0500, Tim Wescott > <seemywebsite@myfooter.really> wrote: > >>On Fri, 15 Apr 2016 08:57:26 -0700, omnilobe wrote: >> >>> On Thursday, April 14, 2016 at 6:21:54 PM UTC-10, Tim Wescott wrote: >>>> On Thu, 14 Apr 2016 20:44:56 -0700, omnilobe wrote: >>>> >>>> > 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 >>>> >>>> But how do you take the derivative of ln(x)? >>>> >>>> -- >>>> www.wescottdesign.com >>> >>> 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. >> >>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. > > Sno-o-o-ort ;-) > > Back to serious... the OP indicated fairly sloppy tolerance... why not > simply a PWL fit? > > ...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
On Friday, April 15, 2016 at 1:18:30 PM UTC+10, Fibo wrote:
> 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).
Use an exponentially decaying current to charge a capacitor. I think it's written 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 generating 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 read his lab notes a few years later - but he found the solution really quickly once he'd identified the problem. There are other solutions, but non that we could come up with was as good. -- Bill Sloman, Sydney
On Friday, April 15, 2016 at 8:57:32 AM UTC-7, omni...@gmail.com wrote:
> On Thursday, April 14, 2016 at 6:21:54 PM UTC-10, Tim Wescott wrote: > > On Thu, 14 Apr 2016 20:44:56 -0700, omnilobe wrote: > > > > > 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
> > But how do you take the derivative of ln(x)?
> 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
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.
On Saturday, April 16, 2016 at 11:55:56 AM UTC+10, bill....@ieee.org wrote:
> On Friday, April 15, 2016 at 1:18:30 PM UTC+10, Fibo wrote: > > 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). > > Use an exponentially decaying current to charge a capacitor. I think it's written 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 generating 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.
Oops. You've got to increase the voltage applied to the base terminal of the 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 mirror 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 the hyperbolic transistor and the negative rail. There's got to be a pot in there somewhere to be twiddled reflect the actual base resistance and current gain of the transistor making the hyperbola. I don't think that is the way we did it - it got bundled into the system for starting the hyperbolic voltage at right point - whatever we did was pretty simple.
> 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 read his lab notes a few years later - but he found the solution really quickly once he'd identified the problem. > > There are other solutions, but non that we could come up with was as good. > > -- > Bill Sloman, Sydney