### Author Topic: analog circuit to divide two currents  (Read 6990 times)

0 Members and 1 Guest are viewing this topic.

#### KTP

• Frequent Contributor
• Posts: 515
##### analog circuit to divide two currents
« on: October 14, 2010, 01:27:13 am »
So say I wanted to build a demonstration circuit that would graph the beta (Ic/Ib) of a bipolar transistor vs the collector current (Ic).  I could fix the collector voltage with a regulator at, say 3V, and have a small series resistance the voltage across which would represent my collector current.  I could then sweep the base resistor with a ramp voltage going from 0 to 3 volts and measure the voltage across the base resistor to represent the base current.  Further say I scale these with amplifiers such that 10mV represents 1mA of current or some such factor.

Now, I am kind of stuck on how to generate a voltage to represent Ic/Ib such that I can feed this and the voltage representing Ic into the oscilloscope in x-y mode and get the plot I want.

I remember there is an op-amp circuit using a common base transistor in the negative feedback path to generate a negative logarithm of the input voltage, but I think it would greatly depend on the saturation current and the thermal voltage.  Aside from that, I guess two of these circuits fed into a subtractor and then a anti-log circuit would give me what I want?  (going on the premise that x/y = e^(ln(x)-ln(y)) if me maths is still rememebered).

Totally stupid and not the way to go about getting an analog version of x/y?  Thanks for any help.

#### Simon

• Global Moderator
• Posts: 13920
• Country:
• Did that just blow up? No? might work after all !!
##### Re: analog circuit to divide two currents
« Reply #1 on: October 14, 2010, 06:03:04 am »
surely just imputting the base voltage to one channel and the collector voltage or the voltage across the collector resistor will achieve it ? why do you want to transform voltage to current and back to voltage, you may need a diff amplifier to get the collector resistor voltage but having a fixed supply the collector will take up the rest anyhow and be referenced to ground. you might want to amplify the voltages to get the scales you want but thats all
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559

#### KTP

• Frequent Contributor
• Posts: 515
##### Re: analog circuit to divide two currents
« Reply #2 on: October 14, 2010, 01:33:55 pm »
Agilent has an app note on using a scope as a curve tracer. I think that's what your trying to do.

No, that is the IV relationship...I already know how to do that.

Here is a much simpler explanation of what I would like to do real time, with an analog circuit:

Vertical axis of plot: Ic/Ib

Horizontal axis of plot: Ic

#### KTP

• Frequent Contributor
• Posts: 515
##### Re: analog circuit to divide two currents
« Reply #3 on: October 14, 2010, 03:59:13 pm »
A little more digging around and decided that yes, analog division can be done with discrete op-amps but it is messy.

A better way would be to include something like the AD633 4 quadrant multiplier in the feedback path of an op-amp to get Vout = V1/V2.  Unfortunately I can't find a AD633 in my parts bin of scrap analog boards

Perhaps at low frequencies it would be easier just to ADC -> Microcontroller division -> DAC

I really was interested in the analog discrete solution though...

#### Simon

• Global Moderator
• Posts: 13920
• Country:
• Did that just blow up? No? might work after all !!
##### Re: analog circuit to divide two currents
« Reply #4 on: October 14, 2010, 04:31:56 pm »
DON'T use an MCU to do the job, you looking at 10 bits in and 10 bits out with at least a +/-1 bit error at each conversion so up to 2 bits error (in theory, if you check the specs possibly worse), I don't know what analogue error would be like but get a gut feeling that by the time you have done it with the MCU you might as well do it with analogue which will respond much better
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559

#### jimmc

• Frequent Contributor
• Posts: 278
• Country:
##### Re: analog circuit to divide two currents
« Reply #5 on: October 14, 2010, 04:49:49 pm »
A little more digging around and decided that yes, analog division can be done with discrete op-amps but it is messy...

Try log, subtract, antilog approach.

See http://www.national.com/an/AN/AN-30.pdf fig 5

Jim

#### Zero999

• Super Contributor
• Posts: 13171
• Country:
• 0999
##### Re: analog circuit to divide two currents
« Reply #6 on: October 14, 2010, 05:59:10 pm »
DON'T use an MCU to do the job, you looking at 10 bits in and 10 bits out with at least a +/-1 bit error at each conversion so up to 2 bits error (in theory, if you check the specs possibly worse), I don't know what analogue error would be like but get a gut feeling that by the time you have done it with the MCU you might as well do it with analogue which will respond much better

If that's true, a MCU is better than the AD633 analogue multiplier which has an accuracy of 2%, a 2-bit error in 10 bits is 1/512  <0.2%

Even an 8-bit ADC has a better than the AD633. The question is getting an MCU which is fast enough to process the maximum frequency of interest but note the price of the AD633 vs how much processing power you can get for the same price.

#### Simon

• Global Moderator
• Posts: 13920
• Country:
• Did that just blow up? No? might work after all !!
##### Re: analog circuit to divide two currents
« Reply #7 on: October 14, 2010, 06:03:03 pm »
yea I've not looked in depth at the two options, the 2 bits is theoretical, it would depend on the specific device, speed would be a problem and is 1/512 of the full scale sufficient resolution ? analogue with give practically infinite resolution, digital will not
https://www.simonselectronics.co.uk/shop
Varied stock of test instruments and components including EEVblog gear and Wurth Elektronik Books.
Also, if you want to get ripped off: https://www.ebay.co.uk/usr/simons_electronics?_trksid=p2047675.l2559

#### KTP

• Frequent Contributor
• Posts: 515
##### Re: analog circuit to divide two currents
« Reply #8 on: October 14, 2010, 06:13:34 pm »
yes, I think Hero999 is correct in that a microcontroller solution is cheaper and maybe more accurate than using the analog solution of a AD633 and op-amp.

Since what I really want is a dc operating point graph of beta (Ic/Ib) vs collector current (Ic) and I am using the oscilloscope in X-Y mode, I probably can get away with a fairly slow division if my ramp input to the base of the transistor DUT has a small dv/dt.  Even 10K divisions per second would probably allow me to view a reasonable representation of Ic/Ib vs Ic on the scope.

jimmc:  If you go back and read my first post, I had orginally said I knew the log, subtract, antilog approach would work, but thanks for the link to that pdf as I had not seen it before.  You can see though how if you implement all of the required circuits in that link it would be really messy (especially if you are breadboarding it).

This is all extra stuff I am doing, the lab we are required to do wanted a hand drawn graph of Ic/Ib vs Ic taken by 100 measurements with a multimeter while varying the base current and holding the collector at 3V.  I like to try and automate tests like this for fun.

What I really need for my lab experiments is a little board with 4 ADC inputs accepting -10V to +10V range, perhaps with some sort of autorange mechanism and 4 DAC outputs with -10V to +10V range, source/sink 100mA, 10uS or so settling time.  Perhaps a trigger input/output also.  USB interface would be swell.  Does such a little board exist?
« Last Edit: October 14, 2010, 06:16:33 pm by KTP »

#### Bored@Work

• Super Contributor
• Posts: 3932
• Country:
##### Re: analog circuit to divide two currents
« Reply #9 on: October 14, 2010, 06:43:44 pm »
Waitaminute ...

... to see what I think you would like to see, you would have to vary Ic over approximately a factor of  10^5 for a small signal transistor, from 1 µA to 100 mA. To display such a range you need a logarithmic scale on the horizontal axis.

Ic/Ib approximately varies by a factor of three over this range. In other words, the variation of Ib, is in the same order of magnitude as Ic, 10^5. If you want to do the math with OpAmps you have to deal with an awfully large dynamic input range.

It is also not simple with an MCU. 10^5 means at a minimum a 17 bit DAC for signal generation and a similar or better ADC for measurement to go over the range, assuming perfect devices, and no noise.

Pencil, paper and two good multimeters might be a simpler way to get the curve.
« Last Edit: October 14, 2010, 06:48:33 pm by BoredAtWork »
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List

#### KTP

• Frequent Contributor
• Posts: 515
##### Re: analog circuit to divide two currents
« Reply #10 on: October 14, 2010, 06:52:20 pm »
Waitaminute ...

... to see what I think you would like to see, you would have to vary Ic over approximately a factor of  10^5 for a small signal transistor, from 1 µA to 100 mA. To display such a range you need a logarithmic scale on the horizontal axis.

Ic/Ib approximately varies by a factor of three over this range. In other words, the variation of Ib, is in the same order of magnitude as Ic, 10^5. If you want to do the math with OpAmps you have to deal with an awfully large dynamic input range.

It is also not simple with an MCU. 10^5 means at a minimum 17 bit DAC for signal generation and a similar or better ADC for measurement to go over the range, assuming perfect devices, and no noise.

Pencil, paper and two good multimeters might be a simpler way to get the curve.

Yes, that is about right.  Some of the analog multipliers have a 5 decade range, so possibly could plot from 10uA to 100mA?

I was thinking about sweeping the base with a log ramp with the assumption that this would make Ic (the horizontal axis) a log representation.   My function generator can do this....maybe this wouldn't work...have to think about that a second...it *seems* like it would work.

I know, I know, pencil, paper and my Fluke 289 would make quick work of this problem...but hey, what if you wanted to view this curve for 200 different parts?  Then my ideas might not look so silly!

#### Bored@Work

• Super Contributor
• Posts: 3932
• Country:
##### Re: analog circuit to divide two currents
« Reply #11 on: October 14, 2010, 07:25:37 pm »
I was thinking about sweeping the base with a log ramp with the assumption that this would make Ic (the horizontal axis) a log representation.   My function generator can do this....maybe this wouldn't work...have to think about that a second...it *seems* like it would work.

It won't work. The oscilloscope works linear. If you give it 1V input the trace moves to the 1V position. If you give it 5V input it moves to the 5V position. It doesn't matter if the 1V or 5V are on a logarithmic curve. The curve shape just determines how fast or slow you move along the axis.

You need a logarithmic amplifier or an exponential amplifier.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List

#### Zero999

• Super Contributor
• Posts: 13171
• Country:
• 0999
##### Re: analog circuit to divide two currents
« Reply #12 on: October 14, 2010, 08:08:40 pm »
I think BoredAtWork is right regarding the dynamic range of the signal, I didn't think of that so yes, I think a log amplifier is the best way to go.

Just a couple of points regarding the digital solution, for purely educational purposes of course:

For optimum accuracy, the DAC should have twice as many bits as the ADC because 2552 = 65025 which requires 16 bits.

For an extra bit of accuracy a full wave precision rectifier and zero crossing comparator can be used before the ADC and a switched inverting/non-inverting amplifier used after the DAC but it's probably not worth it as you'd need low offset op-amps and precision resistors so you don't loose the bit of accuracy gained by it.

Of course all of the above points are mooted by the one about dynamic range.

#### KTP

• Frequent Contributor
• Posts: 515
##### Re: analog circuit to divide two currents
« Reply #13 on: October 14, 2010, 08:33:50 pm »
I was thinking about sweeping the base with a log ramp with the assumption that this would make Ic (the horizontal axis) a log representation.   My function generator can do this....maybe this wouldn't work...have to think about that a second...it *seems* like it would work.

It won't work. The oscilloscope works linear. If you give it 1V input the trace moves to the 1V position. If you give it 5V input it moves to the 5V position. It doesn't matter if the 1V or 5V are on a logarithmic curve. The curve shape just determines how fast or slow you move along the axis.

You need a logarithmic amplifier or an exponential amplifier.

IR confused.  If the input to a linear equation (Ic = beta*Ib) is a log function, then wouldn't the output of the equation also be a log function?

let me play around with this a bit in LTspice and get back to you.  Thanks.

#### KTP

• Frequent Contributor
• Posts: 515
##### Re: analog circuit to divide two currents
« Reply #14 on: October 14, 2010, 09:42:51 pm »
Ok, it took quite a bit of time to figure out how to make the LTspice B type sources obey me, but in the end I prevailed!

(I found a link to all of the different functions LTspice supports in arbitrary sources (the B types).  I wanted 10^x but had to implement it as pow(10,x)

Anyway, here is a screenshot of the simple LTspice circuit.  I have generated a exponential (base 10) current into the base of the 2n2222 which ranges from .1uA to 1mA over a period of 1mS in the fashion I think I wanted. (You can see this in the plot of IB1 on the graph).

A plot of Ic/Ib shows a beta that is smaller at low currents and high currents, which I believe is correct.  I think there may be a simulation error or a model error in the 2n2222 at really low currents because the beta starts off higher then dips instead of starting off at the low value.

Anyway, this would tend to support my idea of pumping the base with an exponentional current in order to display log values on a linear scale (the horizontal scale is linear in the picture).

« Last Edit: October 14, 2010, 11:00:13 pm by KTP »

#### allanw

• Frequent Contributor
• Posts: 343
##### Re: analog circuit to divide two currents
« Reply #15 on: October 14, 2010, 09:04:19 pm »
An easier way to do that would have been to use DC sweep analysis on the current source. It can do decade plotting.

#### jimmc

• Frequent Contributor
• Posts: 278
• Country:
##### Re: analog circuit to divide two currents
« Reply #16 on: October 15, 2010, 10:37:13 am »

jimmc:  If you go back and read my first post, I had orginally said I knew the log, subtract, antilog approach would work

It does annoy me when people post without reading the whole thread first, and now I've done it myself  sorry KTP.

The closest device I know of for your experiments  is http://labjack.com/u12

The good...

# PGA with Gains of 1, 2, 4, 5, 8, 10, 16, or 20 V/V
# Up to 8 kSamples/Sec (Burst) or 1.2 kSamples/Second (Stream)

# 2 Analog Outputs. Each analog output can be set to a voltage between 0 and the supply voltage (+5 volts nominal) with 10-bits of resolution. The analog outputs are controlled in command/response mode at up to 50 Hz per channel.

Output current is nowhere near 100mA

Jim

Smf