Newbie help with simple bjt_bias simulation

Hello everyone,
I started using KiCAD a cpl od weeks ago bcos I joined an electric engineering degree.
I understand the learning curve of gigantic software like this is steep.
I would like to start leaning how to setup a simple BJT_bias simulation.

From a text book example, I took this circuit with the following practice points:

V1 = 5V
Rb = 50K
Mode: DC Sweep
Component to sweep: VCE
Active Signal : Ic
Primary Start: 0
Primary Stop: 15
Primary Step : 1m
bjt_bias_circuit
and it requires to
a) analyze the obtained graph
b) determine saturation voltage
c) determine Ic at Vce = 8V

So, first things first:

  1. i don’t even seem to be able to reproduce the identical circuit bcos I can’t find that Vce Variable symbol on kicad library
    bjt_bias_circuit_kicad_schematic
  2. if i try to setup a simlation with the circuit as it is i get a “Warining” message window and I don’t seem to move forward


I have only a V source in the circuit so I don’t know what it is asking me by “You Need to select a DC source”. I thought I did

Any suggestions will be highly appreciated.

Thank you

I forgot to mention:
at Uni they adopt LTSpice on windows if you wonder why I chose it in the compatibility mode (or maybe it has nothing to do with it)

I’m not an NGspice expert so, when it comes to simulations, I feel no shame in declaring that LTspice is the best thing since Sliced Bread.

I’ve geeked many times comparing NGspice and LTspice and boiled it down to avoiding NGspice.

I always get what I want from LTspice and, most always need extra effort/work for NGspice.

If it’s a circuit that I don’t want to build twice (for NG and LT) and, want the schematic in Kicad (because I’ll make the PCB) then I use the Netlist from kicad and run simulation in LT (usually via direct command in the Kicad netlist panel, example here)

It’s a good learning-curve and I recommend doing you own comparison. I’d avoid the voltage & time-steps/etc you show…

(some of my projects are Audio and LT does a nice job of .Wave simulations, example below)

That said, this is an excellent, simplified NGspice Tutorial that contains BJT example (that works).

EDIT: Replaced screenshot with more useful LT examples…
Audio-in with Speaker & Transistor

You may have a look at KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation for an example of a BJT simulation with KiCad/ngspice.

The 2022-11-22T23:06_astable.zip (8.1 KB) I orinally posted in this thread:

seems to work all right.

When experimenting with simulation, I always like to have something “moving” to verify it works. After such a verification you can start making small changes and then analyze the difference to understand what and why things are happening.

And there are probably quite a lot of other simple spice simulations floating around on this forum…

Here you go.
Simulates beautifully:

sim

I would love to thank you and i appreciate the fact that you took the time to re-produce the circuit and successfully run a simulation on KiCAD however, i have no idea what you did or how and i cant learn from it so that i can start experimenting with it myself.
Would you be so kind to, briefly, explain what you did and how?
Many thanks in advance

The two biggest differences are: connection, spice voltage source

If you look at your original circuit capture you have connected the BJT to EARTH but the PSU isnt. There is no “solder blob” indicating a node connection. As a result there is no closed path for the PSU and thus no current can flow

The next is the type of PSU. The PSU is connected between the gate and the collector and thus no current can flow.
You can use two PSU as @ML9104 has done (one for gate-emitter, one for collector-emitter) or you can use one and bias the gate from this common PSU

Also be mindful of the symbols you use, esp EARTH, they have to be spice compatible otherwise the netlister is unable to generate something meaningful for ngspice

Thank you.
this was very useful at least to know,
I will try to reproduce the circuit with the right symbols and report back.
Although by simulation, I was implying the DC sweep and its characteristic curves and, from what I have seen on various tutorials there seems to be no details on ML9104’s schematic of a dc_sweep.
Anyway, I know that learning KiCAD will mean countless sleepless nights.
Thank you for now.

First, I reproduced your original schematic with the parameters listed (but other designators).
I added a 15 VDC source to do the Vce sweep.
I added R2 to be able to monitor the collector current I(R2).
I added a SPICE model to Q1.
I added a simulation “0” (GND) to the circuit.

Then I ran an ngspice simulation with a DC sweep of V2 over 0…15 V, measuring the current through R2.
That’s it.

First, draw the circuit as I did.
Then call up ngspice and do a “DC Transfer” simulation, sweeping V2 from 0 to 15 with 1m step.
Run the simulation.
“Add signals” and select I(R2).
Tadaaah!

HI again,
I have recreated the circuit but i am really stuck now, specifically on this few points:

  1. you said: call up ngspice → how? (following another random tutorial … is calling the ngspice basically adding text to the schematic so that the simulaor know what to do?
  2. do transfer simulation → how? if i am correct about adding text, how/where do i find all the details of the probably tens of possible simulations parameters available?
  3. even after recreating your circuit exactly (or, at least so i thought) when i run the Electrical rule Checker from the Inspect menu’ it still returns an error, screenshot below

    I am sorry but I really am a newbie.
    Thanks for helping

so, I am getting excited now because finally i can see something (although completely wrong with no understanding of what i am doing wrong).
I put aside the BJT simulation for a little while and decided to reproduce the circuit and simulation on the tutorial i was following earlier.

I swear I think i followed it like a 4yrs old child, word-by-word and i still don’t get the expected curve.


What am i doing wrong? or not doing at all?
Thanks

1: Menu “Inspect” → “Simulator…”.
2: In ngspice, menu “Sim Parameters” → “DC Transfer”.
3: Ignore the ERC error, it’s of no consequence.

Thanks for the tips.
From what I learned from KiCAD tutorials, I learned that it’s better to add the title text on the actual schematic bcos the ‘Sim Parameters’ don’t get saved and if i want/need to run the simulation again I will have to set them up again.
Anyway thats not a problem at the moment, I just want to learn and see something showing up and not that I didn’t play with those settings before; nevertheless, it still gives me an error which this time I think i know what it wants, i just don’t know if i am right and if so, where/how to correct it.

I remember at a lector on LTSpice simulation at UNI that we need to add some kind of data-sheet to each compnent (similarly to how we edit values of resistors and capacitors etc.). Is this what the error is trying to tell me now? If so, how/where do I add those data-sheet?

p.s.: i recall that when i installed KiCAD 6 i had some small issues with directory installations and paths and I had to manually set them to the right place. However, for some reason I have a symbols directory and a library directory. Should i move all the files.sym in the library directory (or viceversa) and then reset it correctly in paths? or this is not really making any sense and I will still have to add manually the data-sheet for certain components?

Your emitter connection disappeared. How about proof reading?

ops, that was embarrassing.

Nevertheless, even after connecting the emitter, the simulation returns the same error

Note: No compatibility mode selected!
warning, can’t find model ‘2n3904’ from line
q1 0 net-q1-pad2 net-q1-pad3 2n3904
Circuit: KiCad schematic
Error on line 5 or its substitute:
q1 0 net-q1-pad2 net-q1-pad3 2n3904
could not find a valid modelname
Error: circuit not parsed.

No KiCAD symbols have Spice models. You need to install one yourself.
Right-click on the transistor, select “Properties” and click “Spice Model”.

yay!!!
thank you so much!
My very 1st simulation.
p.s.: i have 11 signals available. Shouldn’t it be 8 or so?

How can we know?
Have a look at those signals and interpret them. It’s probably voltages and currents. BJT’s have both base, collector and emitter currents.

Plot the graphs of your signals, and then figure out what they do.
You can also use the “probe” to point at nets in your schematic to show them in the simulator.