How do I make a potentiometer in QSPICE?

Is there a recommended way of making a potentiometer in QSPICE? Or is it done in the same way as LTSPICE? Thanks.

1 Like

Will this help? I added 1u in formula if ratio have to set to 0 and 1 (prevent R1 or R2 equal 0 ohms).
A symbol can be created with is .subckt
.subckt VR + - out params: Rt=1k ratio=0.5
R1 + out (1-ratio)*Rt+1µ
R2 out - (ratio)*Rt+1µ
.ends VR

1 Like

For a 10k pot would I just set Rt to 10k or 5k? Where are the individual values of R1 and R2 set? I’m a beginner with QSPICE (and SPICE in general) so I’m unfamiliar with the syntax. I’ll give it a try anyway and figure it out.

PS It’s slowly starting to make sense that R1 and R2 values use (1-ratio)*RT+1u and (ratio)*RT+1u respectively.

This is to implement potentiometer with user parameters.
Rt is total resistance or potentiometer
ratio is how much this resistor is set.
For example, if Rt = 10k, ratio = 0.1, you will get R1=(1-0.1)x10k=9k and R2=0.1x10k=1k, this can keep total resistance at 10k

I just google from web, if you don’t like the idea of +1u to prevent 0ohms resistance, you can consider this subckt

.subckt VR + - out params: Rt=1k ratio=0.5
.param w = limit(1m,ratio,0.999)
R1 + out (1-w)*Rt
R2 out - (w)*Rt
.ends VR

this .subckt will clamp ratio to [1m,0.999] and prevent it go to 0 or 1.

take a look of Mike Engelhardt Qspice introduction video and you will know how to simply create subckt. very easy to do.
Importing 3rd Party Models into QSPICE - Qorvo

1 Like