Connect with us

Simulating a variable resistance input with LTSpice?

Discussion in 'Electronic Design' started by Joerg, Apr 13, 2010.

Scroll to continue with content
  1. Joerg

    Joerg Guest

    Hello Folks,

    Got stuck when trying to simulate an NTC. This temperature-variant
    resistor will be the only variable input so ".STEP" and stuff do not cut
    it because that only overlays multiple curve in an AC or DC simulation.
    I want just one curve: Output of my circuit versus varying NTC resistor

    Tried to make a voltage dependent resistor this way:

    It works but is incredibly slow. Any better ideas?
  2. Joerg

    Joerg Guest

    Well, the one in the link works now. Turns out one shall not get too
    close to very low values where LTSpice has a hard time. At least it
    heats my office :)

    When do we get some global warming out here?

    This function stuff is pretty cool. For example, it can be used to get
    pressure sensor readings from a file into something that electrically
    resembles the sensor.
  3. Fred Bartoli

    Fred Bartoli Guest

    Joerg a écrit :
    The way I'd do it is with a B current source (OK, sink).
    Basically you measure voltage across the NL resistor nodes (a,b) and
    sink a current between these nodes which is your NL function of V(a,b).

    That also better handles the R=0 pathological case, because you're less
    tempted to allow infinite current flow :)
  4. Joerg

    Joerg Guest

    Thanks, will check it out. Got the circuit pretty much done by now but
    some day if I get more of those little temp sense projects I want to
    pour the Steinhart-Hart equation in there. Then I'd have a true
    temperature-variable resistor. LTSpice has the nice feature of being
    able to read in a WAV table.
  5. Joerg

    Joerg Guest

    That's a good idea. Right now I map a variable voltage source into a
    resistor. Works, but leaves one weirdness: kiloohms on the horizontal
    scale are labeled kilovolts.

    I always wondered if there'd be a way to inlude a phssst ... *POOF*
    function in LTSpice, with audio effects, sirens and all. That would be
    nice to have during a design review :)
  6. Fred Bartoli

    Fred Bartoli Guest

    Joerg a écrit :
    Some XSPICE simulators allow you to monitor values during simulation and
    do almost whatever you want. The one I use handles wave files, so maybe :)

  7. Hello John,

    LTspice has B-deviecs. They can do a lot of math.
    ** power
    / divide

    See the help pages for B-devices.
    The B-device is the best device to implement a NTC-resistor
    with it's exponential resistance versus temperature function.

    The LTspice Yahoo group provides examples.

    Best regards,
  8. Joerg

    Joerg Guest

    In the current case it's a whole lot uglier than that, see under
    "Inverse of the equation":–Hart_equation

    T (Temperature) must be scooted. I think LTSpice will have a cow when I
    try this.
  9. Joerg

    Joerg Guest

    Depends on the client, how much precision they want, how much MIPS is
    there, how much RAM is there.

    Just the regular kind, silicon-based resistor.

    In industry it's usually the 2-term or the 3-term Steinhart-Hart equation.
  10. Joerg

    Joerg Guest

    There are modulators though, regular and I/Q, under special functions.
  11. Joerg

    Joerg Guest

    I find myself SPICE-ing many hours a week by now. With some of the more
    unorthodox circuits there is no other way. Like PWM chips used flat-out
    as solenoid drivers and so on.
  12. Joerg

    Joerg Guest

    That ain't the normal thermistor curve. There are some switching types
    where there's reversal but those are typically used sans controller, as
    triggers, before something goes kablouie.

    The client asked that they'd like to see at least 12 bits so I figure
    they have a reason for that.
  13. Joerg

    Joerg Guest

    That was one fine aircraft. The best flight on one was with Air
    Caledonian from London to Shannon. With a grand total of about 20
    passengers in there ...

    Projects are sorta piling up here, this afternoon a new one in the
    aerospace field will be discussed. Why is it that you chip guys complain
    about a dry market inside the US and us hardware guys are living under a
    chunk of domestic projects?
  14. Joerg

    Joerg Guest

    For my consumer market designs that's sometimes also the case. But
    aerospace and similar high-end products like that are made right here in
    our country.
  15. qrk

    qrk Guest

    Here's a couple NTC subcircuits I made up for PSpice. LTspice is
    compatible with PSpice syntax, so these should work. These respond to
    the temperature parameter in Spice. Easiest to use the Beta equation
    approximation, but Steinhart-Hart equation is a bit more accurate.

    * NTC resistor using the Beta equation: *
    * R = Ro * EXP(B*(1/T - 1/298.15)) *
    * Requires resistor value at 25 deg C and Beta *
    * which can be set in this subcircuit or passed *
    * thru the X instantiation. e.g. *
    * X1 1 0 THERMISTORntcB PARAMS: Ro=100k B=4300 *
    * Schematics component: RntcB *
    * By: Mark 26 March 2003 *
    * +------------------- NTC resistor terminals
    * |
    * | +-------- Resistance at 25 deg C
    * | | +- Beta value
    ..SUBCKT THERMISTORntcB 1 2 PARAMS: Ro=10k B=4300
    ETHERM 1 3 VALUE={ I(VSENSE)*Ro*EXP(B*(1/(TEMP+273.15)-1/298.15)) }
    VSENSE 3 2 DC 0

    * NTC resistor using the Steinhart-Hart equation: *
    * 1/T = A + B*ln(R) + C*ln(R)**3 (ugly solution for R) *
    * Requires equation coefficients which can be *
    * set in this subcircuit or passed thru the *
    * X instantiation. e.g. *
    * X1 1 0 THERMISTORntcS PARAMS: A=8.215E-4 B=2.111E-4 C=6.716E-8 *
    * See for coefficient gen *
    * Schematics component: RntcS *
    * By: Mark 26 March 2003 *
    * +-------------------NTC resistor terminals
    * | +------+------+- equation coeffs
    ..SUBCKT THERMISTORntcS 1 2 PARAMS: A=8E-4 B=2E-4 C=7E-8
    .PARAM D={ ((1/(TEMP+273.15))-A)/(2*C) }
    .PARAM E={ (B/(3*C))**3 }
    .PARAM F={ SQRT(D**2+E) }
    .PARAM G={ EXP(PWRS(D-F,1/3)+PWRS(D+F,1/3)) }
    VSENSE 3 2 DC 0

  16. qrk

    qrk Guest

    If he wants to use Steinhart-Hart equation, I probably have a solver
    for the coefficients using Mathcad somewhere. I think I pulled that
    off an app note. The beta and S-H equations are pretty close to
    another if I recall correctly. That's why I have two different PSpice
    components - to please the inner "place".

    Coefficients calculation given in this note:

    Excel solver: 4 REV02 Thermistor Calibration and Steinhart Hart.pdf
  17. Joerg

    Joerg Guest

    If I need it again I'll probably pour it into one large WAV file and
    feed that into SPICE. I know that sounds like cheating but then the PC
    doesn't have to crunch so much on every run. One value for every 0.5C or
    so should suffice.

    Thanks, for all the info, Mark. I'll take a look, but this small circuit
    had to be done quickly and is now finished.

  18. Hello Joerg,

    I have sent you an email with an example using the models from Mark..
    It's for LTspice of course.

    Best regards,
  19. Joerg

    Joerg Guest

    Thanks, Helmut, got it and will try it out this weekend. It was a little
    off when I sent the stuff to the client. The method with the formula in
    the resistor (controlled via voltage source) that I used yesterday did
    the trick but it does leave one weirdness: The x-axis of the plot is now
    labeled in kilovolts instead of kiloohms :)
  20. Hello Joerg,

    I assumed you want simulate resistance versus temperature.
    Do you need it the other way? Temperature(resistance)?

    Best regards,
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day