If I run a transient simulation on it, then I see that maximum voltage on VC1 is 5.0V, which is fine. But the minimum voltage is 456mV, that can’t be right. In fully off state, drain-source resistance is dominated by leakage current. The datasheet says leakage current at 30V Vds is 5 uA maximum, so the off-state resistance should be at least 6 megaohms. So in off state, VC1 should be 5/(1e4+6e6)*1e4 = 8 mV at most.
I don’t know enough about spice models to understand the mod file, can somebody please tell me if I did something wrong? Or maybe the mod file is wrong?
then it looks like it expects pin numbers 4, 1 and 2. Problems with pin numbers are quite common during addition of spice models to KiCad symbols. KiCad’s pin numbers are based on the footprint pads, while spice does not use “pin” numbers, but “node numbers”. These numbers are quite like a “net” in KiCad. These numbers are often quite random, or follow some unknown rules.
KiCad does have the ability to map the pin numbering of symbols to the spice node numbers, but you have to enter this manually. There is a Pin Assignments tab in the Spice Model part of the symbol properties.
Looks quite plausible to me, with a threshold voltage of 1200mV.
It took quite some puzzling to figure out what the pin assignment was, but I finally did find it in the ngSpice manual.
This subcircuit model also has another PMOS fet in it. I guess this is used to simulate some sort of imperfection of the main fet, but further details are a bit fuzzy to me.
Thank you for your help, and for spending so much time with this. I’m new to KiCad, and I can already see that the community is very welcoming and helpful here.
Especially as a beginner, I have no idea what 2 and 1 means in “2 (1)”, which one is the pin and which one is the node in model .
Probably a better naming would be:
.SUBCKT AO3400 4D 1G 2S
I’ll try to change the model source that way, and submit a PR to the model’s author.
It is also not clear why would anybody use pin number 4, when pin number 3 is not used? The official datasheets of these devices usually do not mention pins by their numbers, and the default package Package_TO_SOT_SMD:SOT-23 also does not have pin 4; only 1,2,3.
In
.SUBCKT AO3400 4 1 2
the node names 4 1 2 are used inside of the subcircuit to connect the internal devices. Instead of numbers one could use letters or a combination of both.
To the outside, when calling the subcircuit, the node names are not of impartance, but the sequence of the nodes, their position in the list is.
As Paul has noted, the position numbers (from left to right) 1, 2, 3 correspond to the node names 4 1 2 and correspond to the device terminals drain, gate, and source.
These position do not correspond to the symbol pin numbers, which stem from the transistor package, and which are determining the outside connections.
The pin assignment has the task to translate between symbol and model pins.
The symbol column on the left is fixed. The user has to shift the nodes in the list of model pin on the right., so that the functions (drain, gate, source) match.
.“2 (1)” does then mean: position “2”, with model node name “1”. Position 2 is the gate.