EDN Access

 

March 27, 1997


Spice simulates potentiometer

Stanley Shell and Sopheap Heng, University of California--Los Angeles,
and Tim Christensen, Microsim Corp, Irvine, CA

Spice and its derivatives are useful tools for simulating the performance of electrical and mechanical circuits. Most versions of Spice can simulate voltage sources, current sources, and voltage- and current-controlled voltage and current sources, as well as can sweep model parameters, which in turn sweep component values as well as voltages or currents. For example, Listing 1 and the circuit in Figure 1 show how you can model a potentiometer and sweep its output from one end to the other. Specifically, the circuit in Figure 1 uses a potentiometer to provide an offset voltage for an op amp. Listing 1 shows the corresponding PSpice listing.

This Spice program models the circuit's output as the potentiometer sweeps from one end to the other. There is no need to run the program repeatedly to obtain the data for each potentiometer setting. Listing 1 uses the statement

STEP LIN PARAM RVAL .001 500.001 10

to output values step by step, in increments of 10V, starting with 0.001 and ending with 500.001.

Replacing this STEP statement with the following DC statement enables you to make plots such as VOUT vs the swept value of the potentiometer:

DC LIN PARAM RVAL .001 500.001 10

In both cases, you must globally declare the sweep parameters as indicated in the brackets following R1 and R2 in Listing 1. (DI #2002)


Listing 1--Spice model of amplifier offset voltage
V1 3 0 15V

V2 5 0 -15V

I1 3 2 100uA

I2 4 5 100uA

Rd 2 0 .1k

Rc 0 4 .1k

Cc 1 0 .01u

.PARAM RVAL =1

R1 2 1 {500.002-RVAL}

R2 1 4 {RVAL}

.STEP LIN PARAM RVAL .001 500.001 10

*.DC LIN PARAM RVAL .001 500.001 10

.PROBE

.END

Figure 1
You can create a potentiometer in Spice to model circuit effects such as amplifier offset voltage.

| EDN Access | Feedback | Table of Contents |


Copyright © 1997 EDN Magazine, EDN Access. EDN is a registered trademark of Reed Properties Inc, used under license. EDN is published by Cahners Publishing Company, a unit of Reed Elsevier Inc.