# Simulating a variable resistance input with LTSpice?

• posted

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 value.

Tried to make a voltage dependent resistor this way:

It works but is incredibly slow. Any better ideas?

```--
Regards, Joerg

http://www.analogconsultants.com/```
• posted

Do you need a voltage to resistance converter? That's easy if you have a multiplier. Interestingly, LT Spice doesn't provide a multiplier component.

John

• posted

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.

```--
Regards, Joerg

http://www.analogconsultants.com/```
• posted

Get this file...

VVR.zip VOLTAGE VARIABLE RESISTOR SYMBOL/SUBCIRCUIT

On the Subcircuits and Symbols Page of my website.

It's just a text file... all you care about is the "Template" line. ...Jim Thompson

```--
| James E.Thompson, CTO                            |    mens     |
• posted

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 :-)

```--
Thanks,
Fred.```
• posted

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.

```--
Regards, Joerg

http://www.analogconsultants.com/```
• posted

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 :-)

```--
Regards, Joerg

http://www.analogconsultants.com/```
• posted

Read up on behavioral modeling techniques... lots of simulation power there. ...Jim Thompson

```--
| James E.Thompson, CTO                            |    mens     |
• posted

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 :-)

```--
Thanks,
Fred.```
• posted

Loosen up them thar spats, the multiplier "element" is "*" :-)

As in...

Emult Outnode1 Outnode2 Value = {(Vinnode1,0)*(Vinnode2,0)}

[Snicker :-] ...Jim Thompson
```--
| James E.Thompson, CTO                            |    mens     |
• posted

Sorry, Joerg, I misread your need. It's actually quite simple, IF you can describe the TC with coefficients of T and T^2... make your own resistor model:

Resistor

General form

R [model name]

• [TC = [,]]

TC1, and TC2 are the linear and squared coefficients, respectively.

See the LTspice manual for clarity (the above was pasted from PSPCREF.pdf) ...Jim Thompson

```--
| James E.Thompson, CTO                            |    mens     |
• posted

"John Larkin" schrieb im Newsbeitrag news: snipped-for-privacy@4ax.com...

Hello John,

LTspice has B-deviecs. They can do a lot of math.

* ** power / divide sin tanh exp

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, Helmut

• posted

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

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

```--
Regards, Joerg

http://www.analogconsultants.com/```
• posted

Sure, but a canned multiplier component would be handy, without a bunch of typing. As would an ideal diode. At least they have ideal opamps.

John

• posted

Then use a resistance vs temperature table... trivial in PSpice, probably so in LTspice.

Besides, that smells like unnecessary obfuscation :-)

What kind of NTC?

They're usually spec's as R = Ro*e^(beta*(1/T-1/To)) ...Jim Thompson

```--
| James E.Thompson, CTO                            |    mens     |
• posted

Lazy spat wearer, can't even roll his own B-devices ;-) ...Jim Thompson

```--
| James E.Thompson, CTO                            |    mens     |
• posted

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.

```--
Regards, Joerg

http://www.analogconsultants.com/```
• posted

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

```--
Regards, Joerg

http://www.analogconsultants.com/```
• posted

Thompson's Fundamental Rule #1, Stay away from PhD's, use this instead....

Do you really have one bad enough to need the high order corrections? ...Jim Thompson

```--
| James E.Thompson, CTO                            |    mens     |
```--