Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

328 views
Skip to first unread message

Fibo

unread,
Apr 14, 2016, 11:18:30 PM4/14/16
to
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!

omni...@gmail.com

unread,
Apr 14, 2016, 11:45:04 PM4/14/16
to
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

Tim Wescott

unread,
Apr 15, 2016, 12:21:54 AM4/15/16
to
But how do you take the derivative of ln(x)?

--
www.wescottdesign.com

Tim Wescott

unread,
Apr 15, 2016, 12:24:21 AM4/15/16
to
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

Tim Wescott

unread,
Apr 15, 2016, 12:52:10 AM4/15/16
to
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

whit3rd

unread,
Apr 15, 2016, 3:47:49 AM4/15/16
to
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.

Tauno Voipio

unread,
Apr 15, 2016, 5:45:26 AM4/15/16
to
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

Phil Hobbs

unread,
Apr 15, 2016, 10:12:11 AM4/15/16
to
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

George Herold

unread,
Apr 15, 2016, 10:12:47 AM4/15/16
to
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.

Phil Hobbs

unread,
Apr 15, 2016, 10:24:13 AM4/15/16
to
Put a small dither on it, and measure the AC gain.

omni...@gmail.com

unread,
Apr 15, 2016, 11:57:32 AM4/15/16
to
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.

Tim Wescott

unread,
Apr 15, 2016, 2:01:47 PM4/15/16
to
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

Tim Wescott

unread,
Apr 15, 2016, 2:03:23 PM4/15/16
to
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.

Jim Thompson

unread,
Apr 15, 2016, 2:08:17 PM4/15/16
to
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

Tim Wescott

unread,
Apr 15, 2016, 2:08:23 PM4/15/16
to
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.

Jim Thompson

unread,
Apr 15, 2016, 3:01:45 PM4/15/16
to
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.

Tim Wescott

unread,
Apr 15, 2016, 3:03:45 PM4/15/16
to
On Fri, 15 Apr 2016 11:08:12 -0700, Jim Thompson wrote:

> On Fri, 15 Apr 2016 13:03:18 -0500, Tim Wescott
> <seemyw...@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...

bill....@ieee.org

unread,
Apr 15, 2016, 9:55:56 PM4/15/16
to
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

whit3rd

unread,
Apr 15, 2016, 10:12:51 PM4/15/16
to
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.

bill....@ieee.org

unread,
Apr 15, 2016, 10:54:20 PM4/15/16
to
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.

whit3rd

unread,
Apr 16, 2016, 3:26:39 AM4/16/16
to
On Friday, April 15, 2016 at 11:08:23 AM UTC-7, Tim Wescott wrote:
> On Fri, 15 Apr 2016 00:47:44 -0700, whit3rd wrote:

> > For a multiplier, one possibility is a variable duty cycle chopper.

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

Well, a voltage doubler rectifier (one capacitor, two diodes) into ground
is a frequency-current converter, so it only takes that and a transimpedance amp for its load.

A ramp-up/reset-at-V oscillator can be made to do the voltage-to-period part.
A comparator, one-shot, current source, timing cap will do (can't use the '555
direct, it has the wrong thresholds).

Big problem is, with variable frequency, your lowpass filter has to deal with
the worst case... which limits the input range. 0,0 V_in wasn't ever gonna work, anyhow.

Jim Thompson

unread,
Apr 16, 2016, 2:18:52 PM4/16/16
to
On Thu, 14 Apr 2016 20:18:25 -0700 (PDT), Fibo <panf...@gmail.com>
wrote:
See...

<http://www.analog-innovations.com/SED/OneOverV_2016-04-16_11-10-50.png>

I leave it as an exercise for the student to convert the output
current from C4 to the appropriate voltage needs of your system ;-)

Note that node IN is essentially a virtual ground, considering your
loose tolerance requirements... so you could drive your incoming
0.4-2.5V thru a resistor into this node.

Note also that there is no multiplier in a feedback loop issue/hang...
both OpAmps are used simply to force nodes C1 and C3 to be zero.

AND: It's temperature compensated ;-)

bitrex

unread,
Apr 16, 2016, 2:35:25 PM4/16/16
to
On 04/16/2016 02:18 PM, Jim Thompson wrote:
> On Thu, 14 Apr 2016 20:18:25 -0700 (PDT), Fibo <panf...@gmail.com>
> 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).
>>
>> Much Thanks!
>
> See...
>
> <http://www.analog-innovations.com/SED/OneOverV_2016-04-16_11-10-50.png>
>
> I leave it as an exercise for the student to convert the output
> current from C4 to the appropriate voltage needs of your system ;-)
>
> Note that node IN is essentially a virtual ground, considering your
> loose tolerance requirements... so you could drive your incoming
> 0.4-2.5V thru a resistor into this node.
>
> Note also that there is no multiplier in a feedback loop issue/hang...
> both OpAmps are used simply to force nodes C1 and C3 to be zero.
>
> AND: It's temperature compensated ;-)
>
> ...Jim Thompson
>

Cool circuit! MAT04AD? Hmm...I bet this shit is expeeeeensive...

Jim Thompson

unread,
Apr 16, 2016, 2:44:00 PM4/16/16
to
I've never bought one, just designed them in many times.

Phil Hobbs would know the price... I don't think it's outrageous.

Jim Thompson

unread,
Apr 16, 2016, 2:49:24 PM4/16/16
to
You _could_ roll your own... the MAT-04 is just 4 matched
transistors... just sort thru your stockpile of 3904's.

Phil Hobbs

unread,
Apr 16, 2016, 2:54:07 PM4/16/16
to
Right, that's basically what I was talking about.

Except the 2N3904 idea....a 1K temperature error makes an 8% current error.

Cheers

Phil Hobbs

Jim Thompson

unread,
Apr 16, 2016, 2:54:43 PM4/16/16
to
On Sat, 16 Apr 2016 11:18:47 -0700, Jim Thompson
<To-Email-Use-Th...@On-My-Web-Site.com> wrote:

>On Thu, 14 Apr 2016 20:18:25 -0700 (PDT), Fibo <panf...@gmail.com>
>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).
>>
>>Much Thanks!
>
>See...
>
><http://www.analog-innovations.com/SED/OneOverV_2016-04-16_11-10-50.png>
>
>I leave it as an exercise for the student to convert the output
>current from C4 to the appropriate voltage needs of your system ;-)
>
>Note that node IN is essentially a virtual ground, considering your
>loose tolerance requirements... so you could drive your incoming
>0.4-2.5V thru a resistor into this node.
>
>Note also that there is no multiplier in a feedback loop issue/hang...
>both OpAmps are used simply to force nodes C1 and C3 to be zero.
>
>AND: It's temperature compensated ;-)
>
> ...Jim Thompson

Even better, force the left-side diode...

<http://www.analog-innovations.com/SED/OneOverV_2016-04-16_11-51-22.png>

Tim Williams

unread,
Apr 16, 2016, 5:33:16 PM4/16/16
to
"Tim Wescott" <seemyw...@myfooter.really> wrote in message
news:xdGdnTcxP7B7sYzK...@giganews.com...
> 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.

So? Convert voltage into time:

- Create a periodic log ramp. Start with a sawtooth oscillator, make it
linear, and feed that ramp to a log amp. Then take the derivative.
- Meanwhile, compare the input voltage to the ramp. This generates a
delayed rising edge.
- Trigger a S&H by the edge. You now have a sampled 1/x function, with
variable sampling proportional to the input.

Simply run it fast enough that you don't mind the steps from the S&H.

All told, this only needs a dual comparator, a quad op-amp, and a handful of
transistors (a CCS, something for the log, and maybe a sampling JFET or
analog switch), not too terrible.

:-)

Tim

--
Seven Transistor Labs, LLC
Electrical Engineering Consultation and Contract Design
Website: http://seventransistorlabs.com

Winfield Hill

unread,
Apr 16, 2016, 5:45:46 PM4/16/16
to
Jim Thompson wrote...
> Jim Thompson wrote:
>> On 14 Apr 2016, Fibo wrote:
>>>
>>> I'm trying to figure out the best way to go about
>>> making a -1/x function in hardware.
>>
>> See...
>><http://www.analog-innovations.com/SED/OneOverV_2016-04-16_11-10-50.png>
>> I leave it as an exercise for the student to convert the output
>> current from C4 to the appropriate voltage needs of your system ;-)
>
> Even better, force the left-side diode...
> <http://www.analog-innovations.com/SED/OneOverV_2016-04-16_11-51-22.png>

The MAT04, of course, is long gone. When it was
still available, it cost more than a multiplier IC.
Looking at AoE-III Table 8.1b, page 502, we see the
only matched quad NPN is the THAT 300, about $10.

The Analog Devices AD633 "low-cost" multiplier IC
is $9.15. My favorite AD734 costs $28. But oops,
besides $$$, neither part can run on +/-5 volts.

We're again forced to regret that Barrie Gilbert
and Analog Devices haven't chosen to update their
accurate, medium-speed analog multiplier designs.


--
Thanks,
- Win

bitrex

unread,
Apr 16, 2016, 6:33:00 PM4/16/16
to
Their HQ is right down the street from me, I can go over on Monday and
yell at 'em if you like...

Jim Thompson

unread,
Apr 16, 2016, 7:00:25 PM4/16/16
to
On 16 Apr 2016 14:45:25 -0700, Winfield Hill
Wonder how well matched the devices are in an MPQ2222?

But, as multipliers go, this application doesn't need an exotic
multiplier. Wonder what the golden oldies MC1594-95-96 go for
now-a-days?

srober...@gmail.com

unread,
Apr 16, 2016, 9:07:17 PM4/16/16
to
Here, see if this fits, I linked it where I can post attachments...

http://www.eevblog.com/forum/projects/alegbraic-inversion-for-other-forum/

Steve

Jim Thompson

unread,
Apr 17, 2016, 11:03:11 AM4/17/16
to
On Thu, 14 Apr 2016 20:18:25 -0700 (PDT), Fibo <panf...@gmail.com>
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).
>
>Much Thanks!

My posting of...

<http://www.analog-innovations.com/SED/OneOverV_2016-04-16_11-51-22.png>

is a bit obscure, given the scrambled pin-out of the MAT-04.

So I have drawn up an easier to follow schematic along with an
explanation of how it works.

This explanation is on the S.E.D/Schematics Page of my website as
"OneOverV_Explained.pdf"

Jim Thompson

unread,
Apr 17, 2016, 12:06:17 PM4/17/16
to
On Sat, 16 Apr 2016 18:07:13 -0700 (PDT), srober...@gmail.com
wrote:

>Here, see if this fits, I linked it where I can post attachments...
>
>http://www.eevblog.com/forum/projects/alegbraic-inversion-for-other-forum/
>
>Steve

Thanks, Steve!

I had forgotten all the CA parts from the past. The CA3086 should
work just fine in my circuit.

And there's also the CA3046.

I have Spice models for those devices.

Jim Thompson

unread,
Apr 17, 2016, 12:25:19 PM4/17/16
to
On Thu, 14 Apr 2016 20:18:25 -0700 (PDT), Fibo <panf...@gmail.com>
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).
>
>Much Thanks!

"OneOverV_Explained.pdf", on the S.E.D/Schematics Page of my website,
has been updated, showing it working with CA3046 NPN's.

Jim Thompson

unread,
Apr 17, 2016, 1:17:33 PM4/17/16
to
On Thu, 14 Apr 2016 20:18:25 -0700 (PDT), Fibo <panf...@gmail.com>
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).
>
>Much Thanks!

"OneOverV_Explained.pdf", on the S.E.D/Schematics Page of my website,
has been further updated, showing it working with CA3046 NPN's, AND
with voltage-input/voltage-output... with an added benefit, the
voltage at the collector of Q4 is now held at zero volts... improving
the matching.

Fibo

unread,
Apr 17, 2016, 3:02:17 PM4/17/16
to
Thanks for all the responses, a lot of good info, it's going to take me a while to wrap my head around some of it! Dang smart people in this forum! Much thanks for the OneOverV pdf!

Jim Thompson

unread,
Apr 17, 2016, 3:16:48 PM4/17/16
to
On Sun, 17 Apr 2016 12:02:12 -0700 (PDT), Fibo <panf...@gmail.com>
wrote:

>Thanks for all the responses, a lot of good info, it's going to take me a while to wrap my head around some of it! Dang smart people in this forum! Much thanks for the OneOverV pdf!

Fibo, You are quite welcome! (It was fun for me ;-)

piglet

unread,
Apr 18, 2016, 3:06:27 AM4/18/16
to
On 15/04/2016 08:47, 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.
>

Yes, I think the OP said the signals were dc or slow varying so a PWM
based multiplier could be a very practical method and avoids all the
tempco and matching problems of Vbe based log/exp.

piglet


piglet

unread,
Apr 18, 2016, 6:33:41 AM4/18/16
to
Here is a sketch of the concept I had in mind:

<https://www.dropbox.com/s/jnu9c2x3redhnv3/ReciprocatorPWM.pdf>

If a 2.5V or similar reference is available then the comparator PWM
maker levels can be referenced to that and a wider duty cycle range
obtained and less gain needed in the output servo - should improve the
accuracy.

piglet

Jim Thompson

unread,
Apr 18, 2016, 11:49:12 AM4/18/16
to
On Thu, 14 Apr 2016 20:18:25 -0700 (PDT), Fibo <panf...@gmail.com>
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).
>
>Much Thanks!

You can actually get a pretty decent 1/x function with a 555 timer...

<http://www.analog-innovations.com/SED/OneOver_Using_555_Timer_2016-04-18_08-42-38.png>

(Period proportional to Control voltage. Run it thru a F-to-V
converter to get back to voltage.)

For better linearity, replace boot-strap-style current source with an
OpAmp-controlled mirror.

Jim Thompson

unread,
Apr 19, 2016, 12:07:08 PM4/19/16
to
On Thu, 14 Apr 2016 20:18:25 -0700 (PDT), Fibo <panf...@gmail.com>
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).
>
>Much Thanks!

Better approach, avoid timing error due to using "Discharge" pin, run
symmetric...

<http://www.analog-innovations.com/SED/OneOverV_Using_555_Better_2016-04-19_09-02-49.png>

Clifford Heath

unread,
Apr 23, 2016, 4:08:12 AM4/23/16
to
On 18/04/16 02:06, Jim Thompson wrote:
> On Sat, 16 Apr 2016 18:07:13 -0700 (PDT), srober...@gmail.com
> wrote:
>
>> Here, see if this fits, I linked it where I can post attachments...
>>
>> http://www.eevblog.com/forum/projects/alegbraic-inversion-for-other-forum/
>>
>> Steve
>
> Thanks, Steve!
>
> I had forgotten all the CA parts from the past. The CA3086 should
> work just fine in my circuit.
>
> And there's also the CA3046.

and the HFA3101 and its friends.

piglet

unread,
Apr 23, 2016, 6:44:03 AM4/23/16
to
Finally made a simulation showing PWM multiplier inside a servo:

Version 4
SHEET 1 1700 680
WIRE 464 -176 464 -192
WIRE 608 -176 464 -176
WIRE 816 -160 704 -160
WIRE 704 -128 704 -160
WIRE 464 -112 464 -176
WIRE 1008 -112 944 -112
WIRE 1152 -112 1072 -112
WIRE 816 -96 816 -160
WIRE 432 -80 320 -80
WIRE 608 -80 608 -96
WIRE 768 -80 608 -80
WIRE 608 -64 608 -80
WIRE 608 -64 512 -64
WIRE -80 -48 -80 -64
WIRE 96 -48 -80 -48
WIRE 400 -48 176 -48
WIRE 432 -48 400 -48
WIRE 1152 -16 1152 -112
WIRE 1232 -16 1152 -16
WIRE -80 16 -80 -48
WIRE 320 16 320 -80
WIRE 320 16 240 16
WIRE 448 16 448 -16
WIRE 448 16 432 16
WIRE 1024 16 1024 -16
WIRE 432 32 432 16
WIRE 816 32 816 -16
WIRE 832 32 816 32
WIRE 944 32 944 -112
WIRE 944 32 912 32
WIRE 992 32 944 32
WIRE 240 48 240 16
WIRE 1152 48 1152 -16
WIRE 1152 48 1056 48
WIRE 464 64 464 -16
WIRE 992 64 960 64
WIRE -80 128 -80 96
WIRE 320 128 320 16
WIRE 608 128 608 -64
WIRE 608 128 560 128
WIRE 400 144 400 -48
WIRE 1024 144 1024 80
WIRE 176 160 -32 160
WIRE 176 176 176 160
WIRE 128 192 48 192
WIRE 960 208 960 64
WIRE 1232 208 1232 176
WIRE 48 224 48 192
WIRE 128 240 80 240
WIRE 816 240 816 32
WIRE 768 256 720 256
WIRE 176 272 176 256
WIRE 320 272 320 208
WIRE 320 272 176 272
WIRE 400 272 400 224
WIRE 400 272 320 272
WIRE 720 272 720 256
WIRE -32 288 -32 160
WIRE 80 304 80 240
WIRE 608 304 608 128
WIRE 608 304 80 304
WIRE 768 304 608 304
WIRE 1232 336 1232 288
WIRE 1280 336 1232 336
WIRE 176 352 176 272
WIRE 80 368 80 304
WIRE 128 368 80 368
WIRE 816 368 816 320
WIRE 1152 368 1152 48
WIRE 1152 368 816 368
WIRE 1232 384 1232 336
WIRE 128 416 80 416
WIRE 80 448 80 416
WIRE 176 448 176 432
WIRE 176 448 80 448
WIRE 176 464 176 448
WIRE 1232 464 1184 464
FLAG -80 128 0
FLAG 1280 336 0
FLAG 1232 176 5P
FLAG 1184 464 5N
FLAG -80 -64 Vin
FLAG 1024 -16 5P
FLAG 464 -192 5P
FLAG 464 64 5N
FLAG 1024 144 5N
FLAG 240 112 0
FLAG 432 32 0
FLAG 560 128 PWM
FLAG 1232 -16 Vout
FLAG 720 272 0
FLAG 704 -128 0
FLAG 768 -32 0
FLAG 960 288 0
FLAG 176 464 0
FLAG 48 224 0
FLAG -32 368 0
SYMBOL voltage -80 0 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value PULSE(2 0.4 10m 100m)
SYMBOL voltage 1232 192 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value 5
SYMBOL voltage 1232 368 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V3
SYMATTR Value 5
SYMBOL Comparators\\LT1011 464 -64 R0
SYMATTR InstName U1
SYMBOL Opamps\\LT1001 1024 -16 R0
SYMATTR InstName U2
SYMBOL res 592 -192 R0
SYMATTR InstName R1
SYMATTR Value 4.7k
SYMBOL res 416 240 R180
WINDOW 0 -45 68 Left 2
WINDOW 3 -65 24 Left 2
SYMATTR InstName R2
SYMATTR Value 1meg
SYMBOL res 336 224 R180
WINDOW 0 36 76 Left 2
WINDOW 3 36 40 Left 2
SYMATTR InstName R3
SYMATTR Value 100k
SYMBOL res 192 -64 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R4
SYMATTR Value 33k
SYMBOL cap 224 48 R0
SYMATTR InstName C1
SYMATTR Value 1n
SYMBOL cap 1072 -128 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C2
SYMATTR Value 1n
SYMBOL res 928 16 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R6
SYMATTR Value 330k
SYMBOL sw 816 224 R0
SYMATTR InstName S1
SYMATTR Value AS1
SYMBOL sw 816 -112 R0
WINDOW 3 38 74 Left 2
SYMATTR InstName S2
SYMATTR Value AS2
SYMBOL voltage 960 192 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName VrefNegServo
SYMATTR Value -0.4
SYMBOL sw 176 160 R0
SYMATTR InstName S3
SYMATTR Value AS3
SYMBOL sw 176 336 R0
SYMATTR InstName S4
SYMATTR Value AS4
SYMBOL voltage -32 272 R0
WINDOW 0 -151 5 Left 2
WINDOW 3 -74 83 Left 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName VrefPosPWM
SYMATTR Value 2.5
TEXT 1104 584 Left 2 ;EPW APR 2016
TEXT 968 528 Left 2 ;PWM -1/x RECIPROCATOR
TEXT -120 504 Left 2 !.tran 120m
TEXT 576 552 Left 2 !.model AS1 SW(Vt=1)
TEXT 576 584 Left 2 !.model AS2 SW(Vt=-1)
TEXT 280 552 Left 2 !.model AS3 SW(Vt=1)
TEXT 280 584 Left 2 !.model AS4 SW(Vt=-1)
TEXT 280 408 Left 2 ;At Vin=2 PWM is 80%
TEXT 280 448 Left 2 ;At Vin=0.4 PWM is 16%
TEXT 280 504 Left 2 ;AS1-4 = 2/3 of HC4053
TEXT 616 408 Left 2 ;For 80% of Vout = -0.4
TEXT 616 448 Left 2 ;For 16% of Vout = -0.4
TEXT 864 408 Left 2 ;then Vout must be -0.5
TEXT 864 448 Left 2 ;then Vout must be -2.5

I am a spice newbie, and hope one of the spice wizards will give tips on
speeding up simulation. I think the servo action makes LT very slow to
converge on a result?

piglet


Jim Thompson

unread,
Apr 23, 2016, 10:05:45 AM4/23/16
to
On Sat, 23 Apr 2016 11:43:54 +0100, piglet <erichp...@hotmail.com>
wrote:
[snip]
>TEXT 864 408 Left 2 ;then Vout must be -0.5
>TEXT 864 448 Left 2 ;then Vout must be -2.5
>
>I am a spice newbie, and hope one of the spice wizards will give tips on
>speeding up simulation. I think the servo action makes LT very slow to
>converge on a result?
>
>piglet
>

Did you miss my post that produces V-to-Period...

<http://www.analog-innovations.com/SED/OneOverV_Using_555_Better_2016-04-19_09-02-49.png>

Then run this output thru an F-to-V to get the 1/V function.

LTspice has many issues with initial convergence. Try setting
Solver=Alternate and adding "Spice Directive"...

.options plotwinsize=0

But don't hold your breath, LTspice still chokes.

Jim Thompson

unread,
Apr 23, 2016, 11:30:14 AM4/23/16
to
On Thu, 14 Apr 2016 20:18:25 -0700 (PDT), Fibo <panf...@gmail.com>
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).
>
>Much Thanks!

New and improved Voltage-to-Period Converter...

See "Voltage-to-Period_Converter_555_4.png" on the S.E.D/Schematics
Page of my website.

piglet

unread,
Apr 23, 2016, 11:43:05 AM4/23/16
to
On 23/04/2016 15:05, Jim Thompson wrote:
>
> Did you miss my post that produces V-to-Period...
>
> <http://www.analog-innovations.com/SED/OneOverV_Using_555_Better_2016-04-19_09-02-49.png>
>
> Then run this output thru an F-to-V to get the 1/V function.
>
> LTspice has many issues with initial convergence. Try setting
> Solver=Alternate and adding "Spice Directive"...
>
> .options plotwinsize=0
>
> But don't hold your breath, LTspice still chokes.
>
> ...Jim Thompson
>

Thanks Jim, will try spice tricks. Yes I saw your 555 solution and I
think it is pretty neat. What F to V would you suggest feeding it with -
just so we offer the OP and end-to-end solution?

piglet

Jim Thompson

unread,
Apr 23, 2016, 11:57:43 AM4/23/16
to
On Sat, 23 Apr 2016 16:42:56 +0100, piglet <erichp...@hotmail.com>
wrote:
That's a chip function that's available off-the-shelf, but to keep the
ignorati braying, I'll try making one from a 555 >:-}

piglet

unread,
Apr 23, 2016, 12:04:47 PM4/23/16
to
On 23/04/2016 16:57, Jim Thompson wrote:
>> Thanks Jim, will try spice tricks. Yes I saw your 555 solution and I
>> think it is pretty neat. What F to V would you suggest feeding it with -
>> just so we offer the OP and end-to-end solution?
>>
>> piglet
>
> That's a chip function that's available off-the-shelf, but to keep the
> ignorati braying, I'll try making one from a 555 >:-}
>
>
> ...Jim Thompson
>

Yes, and I was thinking an LM2907 kind of thing a bit overkill. Can you
do something minimalist with just a C and Q and arrange the transistor
temp coeff in the F-V to cancel with Vbe TCs in the current sources
around the 555 ? :>

piglet


Jim Thompson

unread,
Apr 23, 2016, 12:22:03 PM4/23/16
to
On Sat, 23 Apr 2016 17:04:40 +0100, piglet <erichp...@hotmail.com>
wrote:
There's an ultra-simple "tachometer" F-to-V circuit using one
transistor, one diode, two capacitors and one resistor, but it has a
2-Vbe offset.

I used it a gezillion years ago in a smog control element for
automobiles.

I'll see if I can adapt it.

(The effect of the Vbe TC's in the current mirrors is pretty small...
and it's trivial to add an OpAmp to make it approach zero, so I think
it's better to make the F-to-V TC zero as well.)

Jim Thompson

unread,
Apr 23, 2016, 4:56:25 PM4/23/16
to
On Sat, 23 Apr 2016 16:42:56 +0100, piglet <erichp...@hotmail.com>
wrote:

I considered doing it with a 555, but it takes too many parts. The
following is the more accurate equivalent of the transistor, diode, 2
capacitors, resistor method... using an OpAmp, a comparator, and 2
analog switches...

<http://www.analog-innovations.com/SED/F-to-V.png>

piglet

unread,
Apr 24, 2016, 4:09:16 AM4/24/16
to
On 23/04/2016 21:56, Jim Thompson wrote:
> I considered doing it with a 555, but it takes too many parts. The
> following is the more accurate equivalent of the transistor, diode, 2
> capacitors, resistor method... using an OpAmp, a comparator, and 2
> analog switches...
>
> <http://www.analog-innovations.com/SED/F-to-V.png>
>
> ...Jim Thompson
>

Yes, an opamp, a comparator and analog switch is a potent combination,
that is what I used to implement the whole of the OP's challenge ...

Seriously, an opamp, comparator and set of switches would make a good
analog building block kind of chip, does anyone make one?

piglet

Jim Thompson

unread,
Apr 24, 2016, 9:31:59 AM4/24/16
to
On Sun, 24 Apr 2016 09:09:10 +0100, piglet <erichp...@hotmail.com>
wrote:
Yes. It's called an F-V converter >:-}

piglet

unread,
Apr 24, 2016, 11:47:10 AM4/24/16
to
On 24/04/2016 14:31, Jim Thompson wrote:
>> Yes, an opamp, a comparator and analog switch is a potent combination,
>> that is what I used to implement the whole of the OP's challenge ...
>>
>> Seriously, an opamp, comparator and set of switches would make a good
>> analog building block kind of chip, does anyone make one?
>>
>> piglet
>
> Yes. It's called an F-V converter >:-}
>
> ...Jim Thompson
>

Sure, but aren't off-the-shelf F-V chips all prewired so the switches
are committed to F-V/V-F ? So cannot be configured to do PWM reciprocal
(like this thread) or PWM square root taking (as we discussed last year)
or any of all the other things a building block with uncommitted opamp,
comparator and switches could.

My dream chip would have these pins:
opampin-, opampin+, opampout
cmpin-, cmpin+
switch1 com, switch1 no, switch1 nc
switch2 com, switch2 no, switch2 nc
2.45vref out, vdd, vss

the comparator output commutates both analog switches and need not be
bonded out to a pin. Say 3-16V operation at a few hundred uA, rail to
rail or at least cmr includes one of the rails, comparator zippy to a
few 00s ns delay and slower opamp say GBW 1Mhz with nA Ib and mV or two
Vos. Basically an updated LM392+4053 combo?


piglet


Phil Hobbs

unread,
Apr 24, 2016, 1:09:53 PM4/24/16
to
The AD630 was the last chip that I can think of that worked like that. Thing is, there are lots of excellent fast MUX chips with really low charge injection available for cheap these days, which is what used to be the parlour trick.

So you might just as well use jellybeans and save a lot of money.

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

Jim Thompson

unread,
Apr 24, 2016, 3:01:43 PM4/24/16
to
On Thu, 14 Apr 2016 20:18:25 -0700 (PDT), Fibo <panf...@gmail.com>
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).
>
>Much Thanks!

Turns out you can just "smoooosh" the function into a single 555, plus
a quad of OpAmps, plus some current mirrors, see...

"MinusOneOverV_555.pdf"

on the S.E.D/Schematics Page of my website.

Someone needs to make current mirrors on a chip ;-)

Jim Thompson

unread,
Apr 24, 2016, 3:02:54 PM4/24/16
to
On Sun, 24 Apr 2016 16:46:58 +0100, piglet <erichp...@hotmail.com>
wrote:
I could design that for you... for a nominal NRE >:-}

whit3rd

unread,
Apr 24, 2016, 5:37:44 PM4/24/16
to
On Sunday, April 24, 2016 at 12:01:43 PM UTC-7, Jim Thompson wrote:

> Someone needs to make current mirrors on a chip ;-)

Well, there's the REF200 if you don't mind 'extras';
<http://www.ti.com/product/REF200>

If you saturate the inputs (only takes a volt) on an OTA, you
get a kind of current mirror. Input is diode-clamped to
negative rail, but you can choose the output to be source or
sink, and compliance is good.

Didn't TI advertise a three-terminal current mirror line some years ago? It had
several ratios available, but all NPN (current-sink) polarity. I never
saw one, just literature...

Phil Hobbs

unread,
Apr 24, 2016, 5:43:32 PM4/24/16
to
>Didn't TI advertise a three-terminal current mirror line some years ago?  It had
>several ratios available, but all NPN (current-sink) polarity.   I never
>saw one, just literature..

The TL011 series--a fave of mine, now long gone (*sniff*). They had 1:2, 1:1, 2:1, and 4:1 versions.

I used to use them for stuff like 5X current multipliers. I still have some, but there's no point in using them.

Cheers

Phil Hobbs
0 new messages