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:
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,
k=Boltzmanns constant 1.381e-23 J/K,
q=charge on one electron 1.6e-19 Coulombs
Simplifying a little we get:
Now the inside of the natural log on the left side contains
but for many current levels we encounter i/IS is much greater than 1, so we can approximate this as:
making the new approximated equation:
Expanding the natural log function on the left we get:
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:
and now again we can expand the natural log on the left side and we get:
and solving again for ln(i) we get:
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:
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.
Diode Log and AntiLog Circuit Derivations
Here is some basic theory on diode log and antilog circuits and their derivations. Lots of people s