Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Resource icon

Diode Log and AntiLog Circuit Derivations 2012-10-15

Here is some basic theory on diode log and antilog circuits and their derivations. Lots of people seem to be interested in this kind of circuit so i thought it would be a good idea to present some useful information on this subject.

I'm starting with the log circuit and as time goes by I'll update with antilog and related circuits and improvements.

THE LOG CIRCUIT DERIVATION
(See Attachment 1 below)

Starting with the diode equation:

[LATEX]i=IS*(e^{(v/(N*VT))}-1)[/LATEX]

Where:
i is the current through the diode,
IS is the diode saturation current,
N is the diode emission constant,
v is the voltage across the diode,

And:

[LATEX]VT=k*T/q[/LATEX]

k=Boltzmanns constant 1.381e-23 J/K,
q=charge on one electron 1.6e-19 Coulombs
T=Kelvin temperature

Simplifying a little we get:
[LATEX]i/IS=e^{(v/(N*VT))}-1[/LATEX]
[LATEX]i/IS+1=e^{(v/(N*VT))}[/LATEX]
[LATEX]ln(i/IS+1)=v/(N*VT)[/LATEX]

Now the inside of the natural log on the left side contains
[LATEX]i/IS+1[/LATEX]

but for many current levels we encounter i/IS is much greater than 1, so we can approximate this as:
[LATEX]i/IS[/LATEX]

making the new approximated equation:
[LATEX]ln(i/IS)=v/(N*VT)[/LATEX]

Expanding the natural log function on the left we get:
[LATEX]ln(i)-ln(IS)=v/(N*VT)[/LATEX]

or
[LATEX]ln(i)=v/(N*VT)+ln(IS)[/LATEX]

What this means is that the output of the op amp will be v, not ln(i), so we would have to divide by N*VT and then add ln(IS) to get the natural log of i. But there's another little catch here, we dont really want the natural log of i anyway because we would have to use large values for i like 1 amp or 2 amps or 4 amps. We would like to scale this down so we can use much smaller currents like 100ua and 1ma. To do this, we include a scaling factor A.

Adding this to the equation, we get:
[LATEX]ln(i/A)=v/(N*VT)+ln(IS)[/LATEX]

and now again we can expand the natural log on the left side and we get:
[LATEX]ln(i)-ln(A)=v/(N*VT)+ln(IS)[/LATEX]

and solving again for ln(i) we get:
[LATEX]ln(i)=v/(N*VT)+ln(IS)+ln(A)[/LATEX]

and this equation allows us to construct a practical circuit that takes the log of the input current.

What we really want in the end though is to be able to take the natural log of the input voltage, so we use a resistor and whatever voltage we apply across that resistor is the voltage we will be taking the natural log of. The way it works into the circuit is that A is equal to the input resistor value in ohms. So we can change the equation a little now:

[LATEX]ln(i)=v/(N*VT)+ln(IS)+ln(Rin)[/LATEX]

and this is the equation for the circuit shown in Figure 1 of the attachment.

The output is v, but we need to perform some operations on it to get it to equal the natural log of i (which is now the natural log of the input voltage Vin because of the resistor Rin). This means we have to divide by (N*VT), add the natural log of IS, and add the natural log of Rin. The divide can be performed with a gain stage set equal to 1/(N*VT), but since we want a positive output we make it negative as shown in the diagram in Figure 2. We then add ln(IS) and add ln(Rin) and that gives us the circuit shown in figure 3.

An actual implementation of this would be done using op amps for the two summing blocks shown in Figure 3.

I'll be posting more on this as time goes on.
  • DiodeLogAntiLog-01.gif
    DiodeLogAntiLog-01.gif
    16.6 KB · Views: 912
Author
MrAl
Views
9,384
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from MrAl

Latest threads

New Articles From Microcontroller Tips

Back
Top