I’m very new to Spice simulation and tried to simulate a simple transistor amplifier.
For this, I created a small project which schematic is shown below (as well as the spice sreenshot).
At first, I got the following errors (I replaced ‘*’ by ‘x’ as some comments wouldn’t show correctly in bold) :
Note: can’t find the initialization file spinit. xxxxxxxx xx ngspice-42 shared library xx Creation Date: Jan 19 2024 07:06:53 xxxxxxxx Note: No compatibility mode selected!
Circuit: * Warning: No job (tran, ac, op etc.) defined: run simulation not started Error: vector frequency not found! Error: vector frequency not found!
However, the error changed after closing the simulator and schematic editor and opening them again.
The same happens after closing KiCAD and re-opening the project :
List of plots available: Current const Constant values (constants) Note: Compatibility modes selected: ps lt a Error in line inc. bjts Not enough parameters Error: ngspice.dll cannot recover and awaits to be detached
I see several issues, and you’ve obviously not run ERC to highlight them.
First, using global labels is OK, but a wire is safer. Redraw. That removes four of them
Second, for the output, don’t use a global label, but a connector of some kind from the library.
Third, your capacitors are “1”. “1” what? p, n, u? And I’m not certain that “K” is acceptable for resistors, normally “k” is used.
Fourth, the simulator expects C-B-E as pins for a BJT. Yours is B-E-C. Fix the pin sequencing.
That should be a good starting point. And run ERC before simulating.
By the way, it looks like you don’t have to follow the CBE pin sequence: when selecting the Spice model, the Pin Assignment tab allows setting the correspondances between the Symbol pins and the Model Pins.
Yes, that’s what I meant by watching the pin sequencing. It’s done under “Symbol Properties”.
You seems to have changed the symbol pins instead, which is unnecessary.
Thanks ! Works better although I can only see gains.
How can I see the output voltage (AC) depending on the V2 frequency (80mV audio signal, say from 100Hz to 10kHz) ?
Tried that but only get gains (dB) and can’t right-click the scales.
How do you inject a sine wave ranging from 100Hz to 10kHz and plot the output voltage ?
dB’s is what you want. If you have no experience with them, then learn how to use them.
It took me some time to interpret the graph posted by ML9104. Amplitude changes between 8.996dB and 8.934dB which is a negligible change of 0.06dB. Phase looks weird, but it goes from -180 degrees to +180 degrees, so it mostly shows a math anomaly, but is (nearly) “flat” otherwise. To get meaningful info about the AC analysis, you have to do it over a bigger frequency range.
Phase looks normal. The flip from -180 degrees to +180 degrees is standard in all simulators etc. I know of.
Just for fun, I ran a sim from 0.01 Hz to 1 MHz. Here it is:
The intial high-pass is of course from the input capacitor. The high-frequency response is a bit disappointing, but with a 330k resistor for base biasing, I guess the BC817 is starved of base current.
R1 with apparent input capacitance of the transistor caused by the Miller effect is the low pass filter.
Transistor working in common emitter system has the lower band than in common base or common collector.
Thanks for your feedback.
I’m trying to determine the output level of this circuit when used as LF amplifier with a 80mV input level.
I could easily scope it but what interests me is to simulate it in order to easily change values to eventually adapt the output level which shouldn’t exceed 200mV.
I have been playing with electronics since I was 10. My conclusion from studies was: Oh shit, everything I know intuitively can be calculated! There were no personal computers back then - you couldn’t simulate a circuit, you had to calculate gain in the midband, poles of the characteristics for low and high frequencies.
Have in mind that AC simulation is ‘small signal simulation’. It don’t counts such things like output voltage limiting by supply. Transient simulation shows you how signals really look like.
Some additional remarks:
There is a bug in the BC817 model file posted in Post 4. KiCad/ngspice complains
**Error in line inc. bjts**
**Not enough parameters**
Why not take this message seriously? The model file contains a line Inc. BJTs. What is that? If a line starts with I, ngspice looks for a current source, with parameters like 2 nodes and a value. This is not there. Well I know that this is a mis-placed line break, and Inc. BJTs belongs to the end of the line above. Unfortunately such things are strictly forbidden, as they always will lead to mis-interpretation and error.
Using global labels for input and output is o.k., if we are doing simulation only. A global label eases readability, and you want to plot out versus in.