1
\$\begingroup\$

I'm trying to design and simulate a MOSFET load-switch in KiCad. I'm new to that application and I've been tearing my hair out for 4 hours on this simulation. :(

The Vg voltage is being simulated as a flat line with permanent 24 volts.

  • I'm simulating a VPULSE square wave voltage source which switches between 0v and 3.3v every 0.5 seconds. That's supposed to drive the gate, and is meant to simulate an ESP32 GPIO pin turning on/off.
  • The goal is to turn on/off the V_OUT via the P-mosfet by varying the Vg voltage.
  • But for me, the gate voltage (Vg) is permanently the same as Vs (V_IN_1)... which means there's no voltage differential. So V_OUT is permanently ~0 volts.

I've attached the KiCad project files since that includes the Spice model files, and wonder if someone could please see what's wrong with this simulation?

14 kb: (link removed since the problem was perfectly explained by the accepted answer)

Here's also an image in case the problem is visible on it:

Schematic

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

The mapping from schematic to Spice models is not correct.

If you change enter image description here both the BJT models to the correct mapping from the schematic, and the MOSFET to :

enter image description here

It will work.

\$\endgroup\$
7
  • \$\begingroup\$ Thank you so much! I had no idea that the pin mapping was incorrect in the SPICE model files! I had a look inside the IRF9540NPBF model file and see they've documented the pin numbers in a comment, so now I know where to look next time. For the MMBT2222ALP4, which doesn't contain any comments about the pin order in the model file, I guess you just tried different combinations until it worked? Or was there a trick to also figuring out the 2222A's pins via the model file? And should I always use 1=2 (numeric) Sim.Pins syntax, or is there ever a 1=C alphabetical mapping for some sim models? \$\endgroup\$ Commented Apr 8 at 3:30
  • 1
    \$\begingroup\$ For the 2222 I looked at your schematic symbol with the pin numbers and corrected E B C to match. 1=C sounds like a TO-92 mapping for European part numbers. \$\endgroup\$ Commented Apr 8 at 3:38
  • 1
    \$\begingroup\$ I changed the line to 1=B 2=E 3=C since I know B = Base E = Emitter and C = Collector and the symbol is marked with 1, 2, 3. \$\endgroup\$ Commented Apr 8 at 3:48
  • 1
    \$\begingroup\$ Oh okay I was confused by your screenshots, which showed the wrong BJT mapping. Now I understand that you just said that I should fix that wrong mapping. I've done these fixes now via the pin assignment GUI: BJTs: 1=B 2=E 3=C, P-MOSFET: 1=2 2=1 3=3 (their modelfile comments confirm that this is correct), and finally I changed the BZX diode to 1=1 3=2 because it seems like that one was incorrect too (their modelfile seems to say that 1=A, 2=K). See: i.imgur.com/K9gfBvI.png (Do you agree that it seems like 1=A, 2=K?) If so, it's all fixed now! :D \$\endgroup\$ Commented Apr 8 at 3:54
  • 1
    \$\begingroup\$ I deleted everything so I can't check, but if the Zener was reversed it wouldn't work at all. \$\endgroup\$ Commented Apr 8 at 4:06

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.