Author Topic: LTSpice LM394 Log Converter  (Read 2478 times)

0 Members and 1 Guest are viewing this topic.

Offline mc172Topic starter

  • Frequent Contributor
  • **
  • Posts: 490
  • Country: gb
LTSpice LM394 Log Converter
« on: July 19, 2019, 08:54:38 am »
I'm messing around with a log converter (aka log amplifier) in LTSpice and am a bit stuck. I figured that a good place to start would be an application note or something so found this on the LM394 NPN "supermatched pair" datasheet:



The LM394 datasheet can be found here: http://www.sycelectronica.com.ar/semiconductores/LM394.pdf

When I put this circuit into LTSpice I get the following performance:



The red trace is Vout and the green trace is Vin. I have attached a ZIP file containing the LTSpice simulation.

The plot has Vin (V(n009)) as the horizontal scale, which is the input to the log converter and is a 1 Hz triangle wave going from 1 uV to 10 V. I expect to see a straight line (which would be the log of a triangle on a log scale) but I only see that for 3 decades. Has anyone got any idea why I only get log conversion after 10 mV?

I have built other variants such as the circuit in the SSM2212 datasheet and have the same problem - I can only get about 3 decades out of it. I am tempted to just build one and see if it works but I'd like to get the simulation working really.
« Last Edit: July 19, 2019, 09:39:27 am by mc172 »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13216
Re: LTSpice LM394 Log Converter
« Reply #1 on: July 19, 2019, 10:23:50 am »
The LM394 datasheet only claims four decades range for that circuit, and elsewhere it notes that most datasheet parameters are guaranteed from 1uA to 1mA Ic, which implies only a three decade range with guaranteed accuracy.

I don't have your transistor or OPAMP models, but doing a .dc sweep over a carefully chosen six decade range:
Code: [Select]
.dc dec V4 30u 30 50
using the generic UniversalOpamp2 model with its default parameters and any small signal NPN, gives very close to a straight line for six decades - far better than I suspect you'll achieve in real life.  Remember all LTspice components default to being 0% tolerance, and most to being ideal.
 
The following users thanked this post: mc172

Offline mc172Topic starter

  • Frequent Contributor
  • **
  • Posts: 490
  • Country: gb
Re: LTSpice LM394 Log Converter
« Reply #2 on: July 19, 2019, 04:58:09 pm »
Thanks for that. I just tried what you wrote in the code tags and indeed I get around 6 decades.

I was previously manually commanding a voltage source to generate a triangle, something like this:

Code: [Select]
PULSE(0.000001 10 0.1 0.4 0.05)


Do you know why doing a DC sweep gives different results to giving it a triangle? Not that it matters - I won't do that any more!
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13216
Re: LTSpice LM394 Log Converter
« Reply #3 on: July 19, 2019, 06:20:51 pm »
At the very beginning of the triangle wave, the transient response of the circuit is critically important.  I think it is compromising the result for very low Vin due to the brief period from when the up-ramp starts till it crosses  1mV.
 
The following users thanked this post: mc172

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13216
Re: LTSpice LM394 Log Converter
« Reply #4 on: July 20, 2019, 03:37:27 am »
Yep, confirmed.  Avoid the too rapid transition through the uV decades by using a behavioural voltage source to implement an exponential function for the input:
Code: [Select]
V=pow(10,7*time-6)
and you'll get six decades with acceptable linearity same as the .dc sweep gave.
 
The following users thanked this post: mc172

Offline mc172Topic starter

  • Frequent Contributor
  • **
  • Posts: 490
  • Country: gb
Re: LTSpice LM394 Log Converter
« Reply #5 on: July 21, 2019, 07:20:08 pm »
Thanks Ian, thanks for your time and effort. Much appreciated!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf