I'm quite new to pspice and I'm trying to simulate the dc transfer function of an op-amp in log configuration.

Here my circuit. I'm using Kicad and ngspice:

enter image description here

R3 and R4 are there because it gave me warnings about a singular matrix.

I set the simulation for a dc sweep of V1 between 0 and 3V:

.dc V1 0 3 100m

Here the netlist:

.title KiCad schematic
.include "/home/mark/Development/Kicad/pspice/1N4148.lib"
.include "/home/mark/Development/Kicad/pspice/mcp6001.lib"
XD1 output Net-_R1-Pad2_ 1N4148
R3 0 Net-_R3-Pad2_ 1
XU1 0 Net-_R1-Pad2_ Net-_U1-Pad4_ Net-_U1-Pad5_ output MCP6001
R1 input Net-_R1-Pad2_ 1k
V1 input 0 dc 3
V2 Net-_U1-Pad4_ Net-_R3-Pad2_ dc 5
R4 Net-_R4-Pad1_ 0 1
V3 Net-_R4-Pad1_ Net-_U1-Pad5_ dc 5
.save @r3[i]
.save @r1[i]
.save @v1[i]
.save @v2[i]
.save @r4[i]
.save @v3[i]
.save V(Net-_R1-Pad2_)
.save V(Net-_R3-Pad2_)
.save V(Net-_R4-Pad1_)
.save V(Net-_U1-Pad4_)
.save V(Net-_U1-Pad5_)
.save V(input)
.save V(output)
.dc V1 0 3 100m

Here the pspice model for the op-amp and here for the diode. In kicad I adjusted the pin ordering as usual.

This is the output of the simulation:

enter image description here

In cyan the input signal and in orange the output one. The output is stick to the negative rail. I played with the value of R1 from 100R to 1M without affecting the output signal.

Is there something wrong in my simulation setup or in my circuit?

  • \$\begingroup\$ It's not clear what the graph is. Your input is called Input (presumably) and your output is called (presumably) Output but, the graph gives no indication you are plotting the right nodes. \$\endgroup\$
    – Andy aka
    Feb 10, 2023 at 21:09
  • \$\begingroup\$ Yes, in my question there is the description of those signals. In kicad they are reported in another window. I can post that too, but it's correct: the input signal (named input) is cyan, the output signal (named output) is orange. \$\endgroup\$
    – Mark
    Feb 10, 2023 at 21:17

1 Answer 1


The problem was about the pin ordering of the diode. The Kicad symbol is this one:

enter image description here

Where 1 is anode and 2 is cathode. Looking at the spice model I read:

Package Pin 1: Cathode
* Package Pin 2: Anode
* Extraction date (week/year): #
* Simulator: PSPICE
* The resistor R1 does not reflect 
* a physical device. Instead it
* improves modeling in the reverse 
* mode of operation.
.SUBCKT 1N4148 1 2

Hence I reordered the pins in kicad:

enter image description here

This led to the wrong behavior described. Instead, letting the default values (that seem wrong to me anyway thanks to Ste Kulov for the explanation: "SPICE ordering convention for diodes is always 1:Anode 2:Cathode, regardless of the real-world pinning/packaging") the circuit seems to work now:

enter image description here

  • 2
    \$\begingroup\$ Your snip of the model's comments is missing a vital part: Package pinning does not match Spice model pinning. This is the key. SPICE ordering convention for diodes is always 1:Anode 2:Cathode, regardless of the real-world pinning/packaging. Since you used the diode symbol from the pspice KiCad library, it's meant for simulation only and the ordering should be left alone. HOWEVER, if you use almost any other symbol/package from KiCad (like an actual 1N4148 symbol) you do need to flip the node sequence since single-diode KiCad symbols are typically ordered 1:Cathode 2:Anode. \$\endgroup\$
    – Ste Kulov
    Feb 11, 2023 at 3:19
  • \$\begingroup\$ @SteKulov thanks. I definitely misunderstood that sentence. I thought it was just a reminder for adjust the pinning, it was not clear to me the scenario behind it. Thanks for the clarification. \$\endgroup\$
    – Mark
    Feb 11, 2023 at 9:50
  • \$\begingroup\$ @SteKulov answer updated with your info \$\endgroup\$
    – Mark
    Feb 11, 2023 at 9:52
  • \$\begingroup\$ Sure, no problem. I can totally see how it's confusing. \$\endgroup\$
    – Ste Kulov
    Feb 11, 2023 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.