Newbie getting unexpected measurements from Simulator

Hi all,
I’m hoping the community won’t mind me asking for a bit of help with my first-ever attempt to use KiCad and simulate a relatively ‘simple’ PSU from a Quad 44 pre-amplifier. I have lots of electronics repair experience but my design/theory knowledge is quite lacking so please treat me as a novice.

In this particular Amp I am trying to understand an undocumented modification which has been made which derives +7.5v and -7.5v (Plus 8.2V from the anode of D403) from +15v and -15v HT rails. This is used to power some analogue switch ICs which take ±7.5v and a panel with buttons and LEDs which uses the 8.2v. I think I’m missing something important because the spice simulation does not produce the expected voltages even for the original circuit.

I’m trying to follow an example of a balanced PSU into an Op Amp from here: KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation (Under “Inverting amplifier with generic OpAmp”).

I must give a caveat that all the components involved are probably 20-30 years old so I’m having to pull in substitutes! I think for the purposes of obtaining the voltages I should be able to use fairly generic 7V5 Zeners and Diodes but I’m happy to accept that this problem is almost certainly user error.

I’ll also note that the existing circuit is not faulty (the amp has an unrelated fault) however this bit does run at about 90°C and it’s a bodged mess on the board, which is why I’m trying to understand it.

The Transistor types in brackets are the current originals, and the BC32x numbers are the substitutes used in simulation.

I’m running KiCad 9.0.2 on Ubuntu 20.04 and have built ngspice42 from source (although I’m not 100% certain whether it’s picked that up or is using a bundled library).
I’ve been using the Simulation libraries from the following collection: Kicad Spice Library · GitHub.

As I’m a new user, I’m not able to attach more than one image, so I’ve put everything together in one:


ERC passes with no Errors and just warns me that my ±7.5v outputs aren’t connected - I think this is okay as I only want to measure them.

In summary - I thought this might be a neat and relatively simple circuit to try and analyse and understand as a first project in KiCad.

Thanks in advance for any help, even if it’s some pointers to the documentation I should be reading.

Jonathan

One of the most common problems is with the models, or the pin assignments. I’m not very good with ngspice, but a while back I created the simplest BJT test project I can imagine and just now uploaded it to the ngSpice examples thread.

The major flaw in your design is that you have put everything together as simulator input. A minor bug somewhere, and everything (e.g. the simulation) breaks down.

So start small: the first circuit should consist of V1, R4, and D6 only.
You will need a suitable spice model for a 7.5 V Zener diode. Attach it to the diode.
Then you have to check the diode pin assignment. Anode and cathode may be switched with your symbol!
Then run the op simulation.
Then add the top branch D4, D5, R5, and V2. You need another spice model (for the 1N4161). Add the models to the diodes.
Check the pin assigment.
Run the op simulation. Only when this is ok, move on to the next circuit. Its sketch seems to be wrong.

1 Like

I agree with Holger. For example D4 goes from +15V to 129mV, while the junction should just have around 600mV over it and that is a strong indication the diode does not work as expected. Test those simple things first, and only expand when those things work. This is also the reason I posted the BJT curve tracer in the examples thead. You can use it to verify your BJT model works.

1 Like

Thank you all for your quick and helpful responses.

I hadn’t initially realised that the symbols and SPICE models are separate items and indeed thanks to your tips I’ve found that the pin assignments were the opposite way around for the simulator compared to the symbol.

This was also true of D1 in the Modification however the BJTs in the modded circuit appear to be correct. I could not find symbols or spice models for either of the original transistors so I’ve gone with equivalents which have different pinouts - I’ve reflected that in the schematic though.

If I remove the modification circuit completely and run the simulation just with the original QUAD PSU and the corrected diode, it’s still not giving the expected results:

As @holger suggested I will try building up the original circuit bit by bit and see if I can spot where I am going wrong.
The sketch of the modification circuit may well have mistakes because I’ve been trying to reverse engineer it by looking at the components on an old PCB with no silkscreen markings - I’ve re-checked it a few times but remain open to the possibility that I’ve simply got it wrong.

Something I am finding quite difficult at the moment is that there seems to be a big gap between the built-in symbols and the available SPICE models - For example the original Zener diodes at D5 and D6 are BZY88C-7V5 which don’t exist as symbols or spice. So there’s a built in symbol for BZV55B7V5 which I thought would do for starters because it’s at least a 7.5v zener, however the SPICE libraries I have obtained contain no BZV or BZY diodes at all and there actually seems to be a lot from KiCad’s symbol library which don’t have models available.
Is there any nice solution where there’s a big library of symbols and their corresponding models all combined together?

Many Thanks
Jonathan

I’m not using Spice at all.
Do R120 means 120 ohm or 0.120 ohm?

1 Like

With 402mA though R5 and less then 100mV over R5 it’s definitely not a 120 Ohm resistor. But still a good catch.

According to https://en.wikipedia.org/wiki/RKM_code it should be a 0.12 Ohm resistor I’m not sure whether ngSpice recognizes the value of those resistors. But it does at leasts recognize RKM values such as 4M7 or 1M8.

To make it more complicated, this also depends on compatibility mode, and the value can also be overridden inside the resistor properties, (and thus not visible in the schematic).

So again, back to what both Holger and I wrote earlier. Start with simulating the simplest circuit (i.e. diode with series resistor) and then slowly expand in steps.

1 Like

The sim DC Operating Point values show negligible voltage across R4/R5, so it look like ngSpice is correctly interpreting them as 0.12 ohm. It looks like the OP intended them to be 120. You can also just omit using the R code usage thing an just type in a decimal point. . .

I just want to report back and send my thanks to everyone who replied with help.

I’ve now got the simulation working - after fixing the pinouts on the diodes you were right that the 120ohm resistors were not being correctly interpreted… I’m not even sure exactly why because with a value of ‘R120’ it seemed to be correctly (and automatically) setting the simulation value to 120 ohms but on one device it had the sim value as a ‘string’ type whilst the other was a ‘float’…

Needless to say, when I expressed the simulation value as 120.0 - it sprang into life and gave me the kind of results I was hoping for.

On the modification circuit I had managed to get the NPN and PNP transistors the wrong way around! A bit of tweaking + correction has got it close to expected behaviour.

Sadly it looks like all the spice models I can find for the 1N4148 diode and its common alternatives throw a parse error, which I think is due to some ngspice compatibility. However using a more generic diode is good enough for now.

I’m very impressed with KiCad and I’m extremely grateful that the community is so welcoming and helpful to newcomers like me.

1 Like

Euhm, no.
Look at the RKM code link on Wikipedia I posted earlier. Standard interpretation of R120 is 0.12 Ohm.

Sorry - I didn’t mean to sound like I was disputing that… Writing R120 originally was a combination of me not paying attention and not being familiar with KiCad.
I agree that that I should have put 120R in the first place :face_with_open_eyes_and_hand_over_mouth:

I think what I did was set the symbol value to R120 but then edit the Spice Model parameters and delete the R on the incorrect assumption that it needed an integer value to pair with the ohm symbol in the Unit column:

i.e. I think I did this at first:

Anyhow, thanks to your kind and patient help I now understand how to correctly enter the values :smiley:

Yes, you can override the value in the schematic with spice directives, but it’s much less confusing if you do not use spice directives but directly use the value field in the resistor itself. That way the same value is shown and used both in the schematic and for the simulation.