Silicon ChipCircuit Surgery - December 2021 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Subscriptions: PE Subscription
  4. Subscriptions: PicoLog Cloud
  5. Back Issues: PICOLOG
  6. Publisher's Letter
  7. Feature: The Fox Report by Barry Fox
  8. Feature: Techno Talk by Mark Nelson
  9. Feature: Net Work by Alan Winstanley
  10. Project: Easy-to-build Digital AM/FM/SW Receiver by Charles Koslna
  11. Project: Balanced Input and Attenuator for the USB by Phil Prosser
  12. Project: Mini Digital Volt/ Amp Panel Meters by Jim Rowe
  13. Feature: Max’s Cool Beans by Max the Magnifi cent
  14. Feature: KickStart by Mike Tooley
  15. Feature: Circuit Surgery by Ian Bell
  16. Feature: AUDIO OUT by Jake Rothman
  17. Feature: Electronic Building Blocks by Julian Edgar
  18. PCB Order Form
  19. Advertising Index

This is only a preview of the December 2021 issue of Practical Electronics.

You can view 0 of the 72 pages in the full issue.

Articles in this series:
  • (November 2020)
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
  • Techno Talk (June 2025)
Circuit Surgery Regular clinic by Ian Bell Op Amp Logarithmic and Exponential Amplifiers – Part 1 T his month we will start to look at op amp-based logarithmic and exponential (also called antilog) amplifiers. This was originally inspired by the use of exponential amplifiers in the MIDI Ultimate Synthesiser project, which concluded in July 2019 – so it has taken a while to get around to it! Much more recently, in the September 2021 issue of PE, we looked at multistage log amplifiers in RF power measurement. These circuits use a cascade of limiting amplifiers with summed outputs to approximate a logarithmic relationship between input and output. That article was inspired by the Low-cost Wideband Digital RF Power Meter by Jim Rowe in the August issue. In both cases the original articles are project-based and are not able to go into a lot of background detail on circuit operation. As noted in the September Circuit Surgery article, using cascaded limiting amplifiers is not the only way to implement a circuit with a logarithmic response (one where the output voltage is related to the logarithm of the input voltage). Logarithmic and exponential amplifiers can also be built using the fact that the base-emitter voltage of a bipolar transistor (or just a diode’s forward voltage) is proportional to the logarithm of the current through it. Or conversely, the current through a transistor or diode has an exponential relationship to the applied base-emitter voltage, also called the ‘forward’ voltage. Fig.1. Ideal logarithmic (log10) circuit input-output relationship for unscaled (y1, green) and scaled by 0.5 (y2, yellow) input amplitudes. Adding the log of two numbers and taking Logarithmic amplifiers have a range of the antilog is equivalent to multiplication: uses, including measurement of signal levels in decibels, RMS (root mean square) a × b = antilog(log(a) + log(b)) measurements, compression of signal dynamic range (eg, at analogue-to-digital Thus, you can make a multiplier using log converter (ADC) inputs), and multiplying and antilog circuits (and similarly divide signals and other mathematical operations. Logarithms Mathematically, the logarithm (or ‘log’ for short) and exponential are inverse functions – that is, if you take the logarithm of a value then take the exponential of that result you get the original value back, and vice versa. Simulation files Most, but not every month, LTSpice is used to support descriptions and analysis in Circuit Surgery. The examples and files are available for download from the PE website. 54 Fig.2. Ideal logarithmic (log10) circuit input-output relationship for unscaled (y1, green) and scaled by 2 (y3, red) output amplitudes. Practical Electronics | December | 2021 Fig.3. The three logarithmic amplifier responses from Fig.1 and Fig.2 (y1, y2, y3) shown on a logarithmic input axis. and raise to the power, such as squaring). Multiplication is required in a number of contexts, such as power measurement (multiply current and voltage) and signal processing operations based on multiplying signals together. However, op amp-based logarithmic amplifiers are not necessarily the best way of achieving signal multiplication, as we discussed in the November 2021 Circuit Surgery article. Logarithmic response basics Before looking at circuit details it is worth getting a feel for what the input-output relationship of a logarithmic amplifier looks like. Fig.1 shows two responses of ideal logarithmic amplifiers to input voltage x, where: y1 = log10(x) y2 = log10(x/2) The shape of both curves illustrates the general behaviour of a logarithmic response. As input amplitude increases, further increases in amplitude result in a diminishing increase in output amplitude – this is the compressing effect of a log response. Small input amplitudes produce large negative output amplitudes, tending towards minus infinity for zero input for an ideal logarithmic function. Of course, real logarithmic amplifiers will have a Fig.4. LTspice schematic for plotting Fig.1 to Fig.3. limited output range and may deviate from an accurate logarithmic response for both small and large input amplitudes. The two responses Fig.1 show that Op Amp in Log Amps the effect of scaling the input voltage is to produce an offset (fixed DC difference) in the output voltage. Specifically, for y = log(ax), where a is a constant scaling factor, the curve shifts up by log(a) (positive output offset in circuit terms) and for y = log(x/a) the curve shifts down by log(a) (negative offset). The example in Fig.1 is for y2 = log10(x/2) so the y2 curve is shifted down by log10(2) = 0.3 with respect to y1. For y = log(x/a) the curves cross the axis (y = 0) at x = a. For the examples, y1 = 0 for x = 1; and y2 = 0 at x = 2, as can be seen on Fig.1. Fig.2 shows the effect of scaling the output of a logarithmic amplifier – it shows two responses of ideal logarithmic amplifiers to input x, where: y1 = log10(x) y3 = 2log10(x) The effect of this scaling is to change the slope of the curve by the scaling factor, but with the curve crossing y = 0 at the same point. This can be seen in Fig.2 – the y3 curve is steeper than the y1 curve at all points, but both cross y = 0 at x = 1. The change of slope in the input-output relationship is the same effect as changing the gain of a linear amplifier. In general, we can write the input (Vin) to output (Vout) of a logarithmic voltage amplifier as: 𝑉𝑉!"# = 𝑉𝑉$ log%& & 𝑉𝑉'( ' 𝑉𝑉) Here, Va and Vb are constants determined by the circuit𝑉𝑉 configuration. Both * 𝐼𝐼* scaling = 𝐼𝐼+ expvalues & ' are voltages (for a these 𝑉𝑉, logarithmic voltage amplifier). This is to obtain the correct dimensions (physical quantities) in the equation. A logarithm is 𝐼𝐼* taken𝑉𝑉*of=a 𝑉𝑉 pure which we get by ' , ln &number, 𝐼𝐼+voltage V by voltage V . dividing the input in a V a is called the intercept voltage, because, as discussed above, it determines 𝐼𝐼* the 𝑉𝑉 point where the input-output curve - = −𝑉𝑉, ln & ' 𝐼𝐼+ result of the logarithm crosses the axis. The is a pure number which we multiply by a voltage to get an output voltage. Vb is 𝑉𝑉. called the−𝑉𝑉 slope voltage 𝑉𝑉- = ' because it changes , ln & 𝐼𝐼+ 𝑅𝑅 the slope of the input-output relationship. Fig.3 shows the three different amplifier responses from Fig.1 and Fig.2 on the 𝐼𝐼1 same logarithmic 𝑉𝑉/0 = 𝑉𝑉, ln & axis ' for the input (the 𝐼𝐼0+ the effect of intercept x-axis). This shows and slope scaling discussed above and provides more information than Fig.1 and 𝑉𝑉. Fig.2 on the response at lower voltages 𝑉𝑉 = −𝑉𝑉, ln & ' (the-plot is from to 10V). For a real 𝐼𝐼100nV 𝑅𝑅 0+ circuit, Va and Vb need be set so that the 𝑉𝑉.% 𝑉𝑉.3 𝑉𝑉-2, = 𝑉𝑉-% − 𝑉𝑉-3 = −𝑉𝑉, ln & ' − − 𝑉𝑉, ln & ' 𝐼𝐼0+ 𝑅𝑅 𝐼𝐼0+ 𝑅𝑅 𝑉𝑉. 𝑉𝑉.3 𝑉𝑉.% 𝑉𝑉-2, = −𝑉𝑉, ln & 0 ' = −𝑉𝑉, ln & ' 𝐼𝐼0+ 𝑅𝑅 𝐼𝐼0+ 𝑅𝑅 𝑉𝑉.3 Practical Electronics | December | 2021 55 ID IR V I R – V O + Fig.5. Logarithmic amplifier based on a diode and op amp. required output range is obtained for the input range of interest. The graphs in Figs.1 to 3 represent mathematical (idealised circuit) functions rather than real circuit responses. They were obtained using LTspice behavioural voltage sources and DC sweep simulations – see Fig.4. Amps Exponential diode response As mentioned above, logarithmic and exponential amplifi 𝑉𝑉'( ers can be based on the 𝑉𝑉!"# = 𝑉𝑉$ log%& & ' exponential current-voltage relationship 𝑉𝑉) of the diode. A simplifi ed version of the diode equation (for forward bias) is: 𝑉𝑉* 𝐼𝐼* = 𝐼𝐼+ exp & ' 𝑉𝑉, Here, V D is the voltage across the diode and I D is the current through 𝐼𝐼* it. 𝑉𝑉I* the = 𝑉𝑉 & ' saturation current – S is , ln diode 𝐼𝐼+ a parameter specifi c to the particular diode or transistor. VT is the thermal voltage, which commonly occurs in 𝐼𝐼* semiconductor VT depends 𝑉𝑉- = −𝑉𝑉, ln & equations. ' 𝐼𝐼+ on physical constants (the charge on an electron and Boltzmann’s constant) and Amps temperature. It has a value of about 25 to 𝑉𝑉temperature . 26mV at room (specifically 𝑉𝑉- = −𝑉𝑉 ' , ln & 𝐼𝐼 25.85mV at 27°C + 𝑅𝑅 = 300K (kelvin)). The 𝑉𝑉'( diode 𝑉𝑉!"# = equation 𝑉𝑉$ log%& & is 'commonly written in the exponential𝑉𝑉)form shown above, but 𝐼𝐼1 it to show the voltage we can rearrange 𝑉𝑉 = 𝑉𝑉, ln & ' 𝐼𝐼of as a/0function 0+ the current, which is a 𝑉𝑉* logarithmic function (we have to use 𝐼𝐼* = 𝐼𝐼+ exp & ' 𝑉𝑉, the inverse function of the exponential to make VD the𝑉𝑉.subject) – specifically: 𝑉𝑉- = −𝑉𝑉, ln & ' 𝐼𝐼0+ 𝑅𝑅 𝐼𝐼* 𝑉𝑉* = 𝑉𝑉, ln & ' 𝐼𝐼+ 𝑉𝑉.% 𝑉𝑉.3 𝑉𝑉-2, = 𝑉𝑉-% − 𝑉𝑉-3 = −𝑉𝑉, ln & ' − − 𝑉𝑉, ln & ' 𝐼𝐼 𝑅𝑅 𝐼𝐼 0+ 𝑅𝑅 Fig.7. LTspice0+𝐼𝐼 * 𝑉𝑉- = −𝑉𝑉,for ln & ' schematic 𝐼𝐼+ investigating the 𝑉𝑉. 𝑉𝑉.3 𝑉𝑉.% 𝑉𝑉-2, = −𝑉𝑉,circuit ln & in Fig.6. 0 ' = −𝑉𝑉, ln & ' 𝐼𝐼0+ 𝑅𝑅 𝐼𝐼0+ 𝑅𝑅 𝑉𝑉.3 𝑉𝑉. 𝑉𝑉- = −𝑉𝑉, ln & ' 𝐼𝐼+ 𝑅𝑅 𝑉𝑉/0 = 𝑉𝑉, ln & This is similar in form to the general Op Amp Log Amps logarithmic amplifier equation above, except that the ‘input’ and ‘intercept’ parameters are currents. Also, we have the natural logarithm (ln) rather than the base ten logarithm (log10). All logarithms are based on a particular number base. For base 10 (the number base we use for counting in everyday life), if y = log10(x) then we can find x from y using x = 10y, that is 10 to the power y. Natural logarithms use base e, where e = 2.71828 Op Amp Log Amps (approximately). The function exp(a) means ea, so if y = ln(x) then x = ey = exp(y). e is also known as Euler’s number after the mathematician Leonhard Euler (1707 – 1783). It is an important mathematical constant and the ln() and exp() functions have many interesting properties. The concepts of ideal logarithmic amplifiers discussed above are the same for different log bases. To get a base-10 log from a natural log we can use: log10(x) = ln(x)/ln(10) ln(x)/2.303 IC R 𝑉𝑉!"# =V I 1 𝑉𝑉$ log%& & IR 𝑉𝑉'( ' 𝑉𝑉) V B E – V O + 𝑉𝑉* 𝐼𝐼* = 𝐼𝐼+ exp & ' 𝑉𝑉, Fig.6. Logarithmic amplifier based on an NPN bipolar transistor and op amp. 𝐼𝐼* 𝑉𝑉* = 𝑉𝑉, ln & ' 𝐼𝐼+ voltage (VO) must be negative and equal 𝑉𝑉'( for a current of ID: to the diode voltage 𝑉𝑉!"# = 𝑉𝑉$ log%& & ' 𝐼𝐼*𝑉𝑉) 𝑉𝑉- = −𝑉𝑉, ln & ' 𝐼𝐼+ Assuming an ideal 𝑉𝑉* op amp, no current will 𝐼𝐼* = 𝐼𝐼+ exp ' flow into the&op 𝑉𝑉𝑉𝑉,. amps inputs (assume it has nite input impedance and requires 𝑉𝑉- infi = −𝑉𝑉 ln & ' , + 𝑅𝑅 current). This means zero external 𝐼𝐼bias that all the current in the diode must 𝐼𝐼* 𝑉𝑉* through = 𝑉𝑉, ln & the ' flow 𝐼𝐼𝐼𝐼+1 resistor, so ID = IR. The resistor is, ln connected between the input 𝑉𝑉/0 = 𝑉𝑉 & ' 𝐼𝐼0+ so the voltage across and virtual earth, it is equal to the 𝐼𝐼* input voltage (VI) and 𝑉𝑉- =Ohm’s −𝑉𝑉, lnlaw & 'the current is ID = IR = from 𝐼𝐼+. 𝑉𝑉 V𝑉𝑉I/R. Substituting ' ID with VI/R in the - = −𝑉𝑉, ln & 𝐼𝐼0+ 𝑅𝑅 equation for V we get: O It terms of the generic circuit discussion above, a change of base is related to the slope voltage (we are scaling the result from the logarithm function). This makes it straightforward to obtain an output 𝑉𝑉. related to log10 despite the diode function 𝑉𝑉- = −𝑉𝑉, ln & ' 𝐼𝐼 + 𝑅𝑅 𝑉𝑉.% 𝑉𝑉.3 being a natural logarithm. 𝑉𝑉 ' − − 𝑉𝑉, ln & ' -2, = 𝑉𝑉-% − 𝑉𝑉-3 = −𝑉𝑉, ln & 𝐼𝐼0+is 𝑅𝑅 of the same 𝐼𝐼form This equation 0+ 𝑅𝑅 as the generic logarithmic voltage amplifier Op amp circuit 𝐼𝐼1 discussed above, A diode on its own has a logarithmic 𝑉𝑉/0 = 𝑉𝑉, ln & ' with Va = ISR and Vb 𝐼𝐼 𝑉𝑉.% will have relationship between a current and = –V 𝑉𝑉. .The𝑉𝑉choice of resistor .3 0+ 𝑉𝑉-2, = −𝑉𝑉, ln & T 0 ' = −𝑉𝑉 ln & ' applied voltage. Using an op amp allows some𝐼𝐼0+effect is.3fixed by VT. 𝑅𝑅 𝐼𝐼0+on 𝑅𝑅 Va, but, Vb 𝑉𝑉 us to make a circuit with a logarithmic We should also note that with VT being 𝑉𝑉. relationship between two voltages – a the thermal 𝑉𝑉- = −𝑉𝑉, ln &voltage, ' the circuit’s output 𝐼𝐼0+ 𝑅𝑅 logarithmic amplifier. Such a circuit is is very much dependent on temperature. shown in Fig.5. The op amp has negative Furthermore, the diode saturation feedback applied via the diode. The op voltage also varies significantly with 𝑉𝑉.% both the slope 𝑉𝑉.3 amp’s non-inverting input is grounded (at temperature, 𝑉𝑉-2, = 𝑉𝑉-% − 𝑉𝑉-3 = −𝑉𝑉, ln & so ' − − 𝑉𝑉, ln & ' and 𝐼𝐼0+ 𝑅𝑅 𝐼𝐼0+ 𝑅𝑅 0V) which means that the feedback will intercept voltages are temperature adjust the output voltage to try to maintain dependent, which will certainly be a 0V at the other input (inverting input). problem in some applications. 𝑉𝑉.3 can be improved 𝑉𝑉.% by using The non-inverting input behaves as if it The𝑉𝑉.circuit 𝑉𝑉-2, = −𝑉𝑉, ln & 0 ' = −𝑉𝑉, ln & ' is at 0V – that is, as if it is grounded or a bipolar instead𝑉𝑉.3 of a diode, as 𝐼𝐼0+ 𝑅𝑅 transistor 𝐼𝐼0+ 𝑅𝑅 earthed. This is known as a ‘virtual earth’. shown in Fig.6. This uses the transistor’s With the diode in Fig.5 forward biased, base-emitter junction instead of the the anode is connected to the virtual diode drop to set the output voltage. The earth and the cathode is connected to transistor’s base is connected directly to the op amp output. The op amp output ground which forces the output voltage 𝐼𝐼1 ' 𝐼𝐼0+ 𝑉𝑉. 𝑉𝑉- = −𝑉𝑉, ln & ' 𝐼𝐼0+ 𝑅𝑅 56 𝑉𝑉.% 𝑉𝑉.3 𝑉𝑉-2, = 𝑉𝑉-% − 𝑉𝑉-3 = −𝑉𝑉, ln & ' − − 𝑉𝑉, ln & ' 𝐼𝐼0+ 𝑅𝑅 𝐼𝐼0+ 𝑅𝑅 Practical Electronics | December | 2021 Fig.8. Results from simulating the LTspice circuit in Fig.7. ideal diode behaviour than an individual diode. The transistor circuit also reduces the effects of offset voltages at the op amp’s mps inputs, which (in real circuits) shift the diode voltage with respect to VO, but do not affect 𝑉𝑉'( VBE in the transistor version by 𝑉𝑉!"# = 𝑉𝑉$ log%& & ' 𝑉𝑉) virtue of the directly grounded base. The transistor version Amps has the same problem with 𝑉𝑉* temperature dependence as the 𝐼𝐼* = 𝐼𝐼+ exp & ' diode version. 𝑉𝑉, 𝑉𝑉'( F i g . 7 s h o w s a n LTs p i c e 𝑉𝑉!"# = 𝑉𝑉$ log%& & ' 𝑉𝑉) schematic of the circuit in Fig.6. 𝐼𝐼* There are copies of the circuit 𝑉𝑉* = 𝑉𝑉, ln & ' with different resistors values to 𝐼𝐼+ 𝑉𝑉* observe the effect of changing 𝐼𝐼* = 𝐼𝐼+ exp & ' Fig.9. Modification 𝑉𝑉, of part of the schematic of Fig.7 R in Fig.6. Two values of R are to show the effect used: R1 = 100 and R2 = 500 ; the 𝐼𝐼* of transistor temperature. 𝑉𝑉- = −𝑉𝑉, ln & ' circuits are otherwise identical. 𝐼𝐼+ 𝐼𝐼* The op amp is an arbitrarily selected to be exactly equal to the base-emitter 𝑉𝑉* = 𝑉𝑉, ln & ' precision op amp, and the transistor is voltage: VO = –V 𝐼𝐼+ BE. a generic (LTspice default) NPN. A DC The relationship 𝑉𝑉. between the collector 𝑉𝑉- = −𝑉𝑉 & base-emitter ' sweep simulation is performed, changing current (IC,)ln and voltage (VBE) 𝐼𝐼+ 𝑅𝑅 the input voltage from source V3 from of a bipolar transistor also follows the 𝐼𝐼* 𝑉𝑉- = −𝑉𝑉, ln & ' 100nV to 10V logarithmically, with 20 diode equation: 𝐼𝐼+ data points per decade of voltage. 𝐼𝐼1 𝑉𝑉/0 = 𝑉𝑉, ln & ' The results are shown in Fig.8, in which 𝐼𝐼0+ –V(out) is plotted so that the graph is 𝑉𝑉. 𝑉𝑉- =I −𝑉𝑉 ' , ln & more visually similar to Fig.3 than a Here, current of the ES is the 𝐼𝐼saturation + 𝑅𝑅 direct plot of the negative output voltages. transistor’s base-emitter junction. The 𝑉𝑉. Noting that IESR corresponds with Va in collector 𝑉𝑉- = −𝑉𝑉, current ln & 'all flows through the 𝐼𝐼0+ 𝑅𝑅 resistor, as just for the diode the generic response plotted in Fig.3, 𝐼𝐼discussed 1 𝑉𝑉/0 = So, 𝑉𝑉, lnwith & 'VO = –VBE and IC = IR current. we would expect changing the resistor 𝐼𝐼0+ (with everything else equal) to shift the = VI/R dropped into the above equation, 𝑉𝑉.% 𝑉𝑉.3 response in a similar way to V(y1) and we=get: 𝑉𝑉-2, = 𝑉𝑉-% − 𝑉𝑉-3 −𝑉𝑉, ln & ' − − 𝑉𝑉, ln & ' 𝐼𝐼0+ 𝑅𝑅 𝐼𝐼0+ 𝑅𝑅 V(y2) in Fig.3, which is what we see. 𝑉𝑉. 𝑉𝑉- = −𝑉𝑉, ln & ' However, in comparison with Fig.3 we 𝐼𝐼0+ 𝑅𝑅 observe that the circuit does not provide 𝑉𝑉. 𝑉𝑉.3 is very similar 𝑉𝑉.% the diode an ideal logarithmic response over the 𝑉𝑉-2, = −𝑉𝑉,This ln & equation 0 ' = −𝑉𝑉, ln & to ' 𝐼𝐼0+ 𝑅𝑅 but 𝐼𝐼0+ 𝑅𝑅the transistor 𝑉𝑉.3 version is entire input voltage range. version, 𝑉𝑉.% 𝑉𝑉.3 The V(out1) output levels off at high better because a transistor’s 𝑉𝑉-2, = 𝑉𝑉-% − a𝑉𝑉-3 = −𝑉𝑉circuit ln & ' − − 𝑉𝑉 ln & ' , , 𝐼𝐼0+ 𝑅𝑅a more 0+ 𝑅𝑅 input voltages and both versions cease base-emitter 𝐼𝐼junction provides 𝑉𝑉. 𝑉𝑉.3 𝑉𝑉.% Practical Electronics | December 𝑉𝑉-2, = −𝑉𝑉 0 ' = −𝑉𝑉 ' | 2021 , ln & , ln & 𝐼𝐼0+ 𝑅𝑅 𝐼𝐼0+ 𝑅𝑅 𝑉𝑉.3 to provide a logarithmic response below about 1µV input. A limitation of range is to be expected from a real circuit. The value of R1 was chosen to show the high voltage levelling off in this example, but in real designs the input resistor is likely to be much larger for handling this level of input voltage, which produces a 100mA current in the circuit in Fig.7. The circuit produces a logarithmic response over an approximately 1µV to 1V range – which is 120dB. The simulation uses a real op amp model, but overall is still somewhat idealised; for example, in a real circuit noise will have a significant effect for very small input voltages. Temperature considerations LTspice can be used to observe the effect of temperature. LTspice uses a default temperature of 27°C, but the temperature of the whole simulation or individual components can be changed. The circuit in Fig.7 was modified so that the transistor in the V(out2) circuit was at a different temperature. Fig.9 shows the modified V(out2) circuit in which the resistor is the same as in the V(out1) circuit, but the transistor temperature is set to 90°C. Fig.10 shows the simulation results in which we see a shift in offset and change of slope. This is because a change of temperature alters the value of both VT and IESR, corresponding to both slope (Vb) and intercept (Va) voltages in the generic logarithmic amplifier response. If it possible to compensate for the effect of IES varying with temperature by using two logarithmic amplifiers with matched transistors – they must have the same characteristics (and hence IES value) and temperature for this to work. With discrete transistors, matching can be a challenge, but it is relatively 57 Op Amp Log Amps Op Amp Log Amps 𝑉𝑉'( ' 𝑉𝑉𝑉𝑉'( 𝑉𝑉'( ) 𝑉𝑉!"# = 𝑉𝑉$ log%& & ' 𝑉𝑉!"# = 𝑉𝑉$ log%& & ' 𝑉𝑉) 𝑉𝑉) 𝑉𝑉!"# = 𝑉𝑉$ log%& & 𝑉𝑉* 𝐼𝐼* = 𝐼𝐼+ exp & ' 𝑉𝑉, 𝐼𝐼* 𝑉𝑉* = 𝑉𝑉, ln & ' 𝐼𝐼+ 𝐼𝐼* 𝑉𝑉- = −𝑉𝑉, ln & ' 𝐼𝐼+ 𝑉𝑉- = −𝑉𝑉, ln & 𝑉𝑉/0 = 𝑉𝑉, ln & 𝑉𝑉. ' 𝐼𝐼+ 𝑅𝑅 𝐼𝐼1 ' 𝐼𝐼0+ Fig.10. Results of the temperatureeffect simulation. 𝑉𝑉* 𝐼𝐼* = 𝐼𝐼+ exp & ' 𝑉𝑉*, 𝐼𝐼* = 𝐼𝐼+ exp & ' 𝑉𝑉, 𝐼𝐼* 𝑉𝑉* = 𝑉𝑉, ln & ' 𝐼𝐼*+ 𝑉𝑉* = 𝑉𝑉, ln & ' 𝐼𝐼+ 𝐼𝐼* 𝑉𝑉- = −𝑉𝑉, ln & ' 𝐼𝐼*+ 𝑉𝑉- = −𝑉𝑉, ln & ' 𝐼𝐼+ 𝑉𝑉. ' 𝐼𝐼𝑉𝑉 + 𝑅𝑅 . 𝑉𝑉- = −𝑉𝑉, ln & ' 𝐼𝐼+ 𝑅𝑅 𝑉𝑉- = −𝑉𝑉, ln & 𝐼𝐼1 ' 𝐼𝐼𝐼𝐼0+ 1 𝑉𝑉/0 = 𝑉𝑉, ln & ' 𝐼𝐼0+ 𝑉𝑉/0 = 𝑉𝑉, ln & 𝑉𝑉. 𝑉𝑉- = −𝑉𝑉, ln & ' 𝐼𝐼0+ 𝑉𝑉.𝑅𝑅 𝑉𝑉. IC designers. ' If we take the difference 𝑉𝑉- =straightforward −𝑉𝑉, ln & ' 𝑉𝑉for - = −𝑉𝑉, ln & 𝐼𝐼0+ 𝑅𝑅 in Fig.6 we get: 𝑅𝑅 copies between𝐼𝐼0+ two of the circuit 𝑉𝑉.% 𝑉𝑉.3 𝑉𝑉-2, = 𝑉𝑉-% − 𝑉𝑉-3 = −𝑉𝑉, ln & ' − − 𝑉𝑉, ln & ' 𝐼𝐼 𝑅𝑅 𝐼𝐼 𝑉𝑉.% 𝑉𝑉.3𝑅𝑅 𝑉𝑉.% 𝑉𝑉.3 0+ 0+ 𝑉𝑉-2, = 𝑉𝑉 − 𝑉𝑉 = −𝑉𝑉 ln & ' − − 𝑉𝑉 ln & ' 𝑉𝑉-2, = 𝑉𝑉-% − 𝑉𝑉-3 = −𝑉𝑉 ln & ' − − 𝑉𝑉 ln & ' -3 , , , , 𝐼𝐼0+ 𝑅𝑅 to dividing 𝐼𝐼0+-% 𝑅𝑅 subtracting 𝐼𝐼0+logarithms 𝑅𝑅 𝐼𝐼0+ 𝑅𝑅 Recalling that is equivalent the values inside the logarithm we get: 𝑉𝑉. 𝑉𝑉.3 𝑉𝑉.% 𝑉𝑉-2, = −𝑉𝑉, ln & 0 ' = −𝑉𝑉, ln & ' 𝐼𝐼0+ 𝑅𝑅 𝐼𝐼0+ 𝑉𝑉.3𝑅𝑅 𝑉𝑉.% 𝑉𝑉. 𝑉𝑉.3 𝑉𝑉.% .3 . ' = −𝑉𝑉, ln & ' 𝑉𝑉-2, = −𝑉𝑉, ln & 0𝑉𝑉-2, '==−𝑉𝑉 −𝑉𝑉 '0 , ln , ln& & 𝐼𝐼0+ 𝑉𝑉.3 𝐼𝐼0+ 𝑅𝑅 𝐼𝐼0+ 𝑅𝑅 𝑉𝑉.3𝑅𝑅 𝐼𝐼0+ 𝑅𝑅 Q 1 R V I1 1 – + V O 1 R U 1 R 3 – + Q 2 R 5 R V I2 R 2 4 V O U T U 3 6 – + V O 2 U 2 Fig.11. Logarithmic amplifier with compensation for the temperature dependence of transistor IES. JTAG Connector Plugs Directly into PCB!! No Header! No Brainer! Our patented range of Plug-of-Nails™ spring-pin cables plug directly into a tiny footprint of pads and locating holes in your PCB, eliminating the need for a mating header. Save Cost & Space on Every PCB!! Solutions for: PIC . dsPIC . ARM . MSP430 . Atmel . Generic JTAG . Altera Xilinx . BDM . C2000 . SPY-BI-WIRE . SPI / IIC . Altium Mini-HDMI . & More www.PlugOfNails.com Tag-Connector footprints as small as 0.02 sq. inch (0.13 sq cm) 58 The IES values cancel if they are the same for the two transistors. This approach has the added advantage that VI2 can be used to control the intercept voltage. Alternatively, the second input can be from a reference signal source (eg, from a sensor, as is done in some light intensity measurements using photodiodes). An implementation of this idea is shown in Fig.11. The difference between the two logarithmic amplifiers is obtained using a standard op amp differential amplifier configuration, for which the gain is R4/R3, and R3 = R5 and R4 = R6. The pairs of resistors must have very closely matched values for good performance. The dependence on VT is not removed by this approach, but as this effect is simply proportional to absolute temperature it is relatively easy to add another amplifier stage with an equal and opposite temperature coefficient using a suitable temperature-dependent resistor in the gain setting. The MAX4206 Precision Transimpedance Logarithmic Amplifier IC from Maxim Integrated is an example of a chip based on the differencing circuit. It does not have the input resistors built in, so it has current inputs (hence ‘transimpedance’ in the name). Practical Electronics | December | 2021