Super simple astable not simulate in Ngspice

LTSpice shows a slow starting up from both transistors ON over several cycles

I have no external libraries, astable started working without problems


Astable is an example which comes with Ltspice
Edit: A note: This is one of the first circuits I built years ago. Real circuit has one problem., BE diode of transistors gets reverse voltage spikes. If supply voltage is too high eventually one transistor will break. The other will be almost broken.

Do note that in the circuit LM21 posted a bit of asymmetry is added. R4 is 100k, while R3 is 101k Ohm.

2 Likes

And the transistors are not biased on that strongly, so linear operation is more likely

One more note. I think I have had resistors R3 and R4 connected to + power supply, and not to collector like here. Someone should simulate that circuit and check whether that would also work.

In the last hour I’ve been fiddling a bit and got something working in KiCad:

Edit: I’m feeling a bit silly about the Alternative Node Sequence not working. Holger (in post 23 of this thread) had the correct answer.

For me the asymmetry does not matter much. It’s mostly a difference in startup time of either 13ms or 24ms.

But getting anything to work in spice is always a struggle for me and lots of hurdles to overcome. The Spice model I used, I found on my SSD. in the location: ~/projects/kicad/spice/KiCad-Spice-Library/Models/Manufacturer/TRT-Electronics/2n3904.lib (Copied and zipped with the project below.)
You can also find 4 different spice models for this transistor on the Onsemi Website but those all have some copyright notice which confuses me. Why publish that data at all when it’s copyrighted, What does that copyright mean?

For example the “SP2 model”

**************************************
*      Model Generated by MODPEX     *
*Copyright(c) Symmetry Design Systems*
*         All Rights Reserved        *
*    UNPUBLISHED LICENSED SOFTWARE   *
*   Contains Proprietary Information *
*      Which is The Property of      *
*     SYMMETRY OR ITS LICENSORS      *
*Commercial Use or Resale Restricted *
*   by Symmetry License Agreement    *
**************************************
* Model generated on Aug 7, 01
* MODEL FORMAT: SPICE2
*$
.MODEL q2n3904 npn
+IS=1.26532e-10 BF=206.302 NF=1.5 VAF=1000
+IKF=0.0272221 ISE=2.30771e-09 NE=3.31052 BR=20.6302
+NR=2.89609 VAR=9.39809 IKR=0.272221 ISC=2.30771e-09
+NC=1.9876 RB=5.8376 IRB=50.3624 RBM=0.634251
+RE=0.0001 RC=2.65711 XTB=0.1 XTI=1
+EG=1.05 CJE=4.64214e-12 VJE=0.4 MJE=0.256227
+TF=4.19578e-10 XTF=0.906167 VTF=8.75418 ITF=0.0105823
+CJC=3.76961e-12 VJC=0.4 MJC=0.238109 XCJC=0.8
+FC=0.512134 CJS=0 VJS=0.75 MJS=0.5
+TR=6.82023e-08 PTF=0 KF=0 AF=1

At least it’s safe to say I have no commercial interest in this. But does it mean I can not sell my astable anymore? It’s a yucky world we live in.

Also note the transistors are upside down. I fiddled a bit with “alternate node sequence”, but (again) did not get that to work.

I’m also getting some weird stuff:

I’ve never been able to do anything useful with spice. I always bump into so many issues that I start second guessing whether the stuff I see in the simulation has any usable correlation with reality.

2022-11-22_astable.zip (7.7 KB)

Edit:
A new version with the transistors “normal side up” and a working Alternative Node Sequence.
I’ve also connected all 4 resistors to the power supply as is more common by the astable Multi Vibrator. It also starts immediately now with maybe just some asymmetry in the first cycle.

2022-11-22T23:06_astable.zip (8.1 KB)

If you publish something, you are the copyright owner of the published material. Even if you do not state this explicitely, it is enforced by national laws worldwide (and most national regulations are simular).

As the copyright owner you then have the right to issue a licence for using the published material. This license can be permissive or restrictive, this is up to you as the copyright owner.

There is one exception: If you explicitely put your published material into the ‘public domain’, then there is no copyright, and no restriction to its usage whatsoever.

For example: ngspice has as Copyright owners for its source code either UCB (University of California at Berkeley, the originator of spice) or the ngspice dev team for new material. Its licence is BSD 3-clause, a very permissive license.

The KiCad copyright ownwers are

 * Copyright (C) 2019 CERN
 * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.

and maybe some others, its software license is GPL.

For the above cited device model parameters the copyright owner is Symmetry Design Systems, the license is a 'Symmetry License Agreement (whatever that may be). Its major statement is the restriction for ‘Commercial Use or Resale’. And sometimes the legal texts seem to contain a little nonsense: Onsemi puiblished a model which is unpublished and contains proprietary information???

The major question in my view is here: Does this license allow re-publishing? Difficult to answer, and therefore KiCad is very restrictive when somebody asks: Why not distibute model parameters for simulation with KiCad.

How have your Astable sales been, lately?

That weird stuff is typical parasitic oscillation in emitter followers being driven from a negative impedance. It can be avoided by using base resistors.

image

Where has the comment gone about the weird schematic?
Connecting all 4 resistors to Vcc is indeed much more common:

I had just copied the schematic posted by LM21 without thinking much about it.

So that implies it’s actually impressive that ngSpice simulates it…

This seems to be working a lot more stable, even when setting R5 and R6 to zero.

The biggest remaining issue is that I can’t get the Alternate Node Sequence to work.

2022-11-22T19:21_astable.zip (8.2 KB)

Yes, but not surprising. It’s behaviour that’s not well known, but completely explainable.
Most people think emitter followers are pretty simple and harmless… they’re not. Make a note. :slight_smile:

It’s not an emitter follower, it’s an upside down transistor with the emitter and collector swapped so would have low h_fe. Surprising that it works at all unless ngspice is swapping the nodes again.

I didn’t notice until now.

As I wrote before in this thread:

ngSpice apparently expect the pins in CBE order

So maybe you should pick a Q symbol with that pin sequence so that the schematic reflects the reality.

That is indeed a workaround, but an ugly one. If a PCB is made for it later, it won’t work becase of the wrong pin assignment. In the past I have managed to get things to work with Alternate Node Sequence, but now I’m stuck there.

It looks like you wrote
321
as alternate node sequence. What about writing
3 2 1
?

Aaahhrgg, adding spaces helped indeed.
I’m feeling a bit silly now.

Some kind of complaint that it could not find pin “Threehundred and Twenty One” or a parsing failure for the Alternative Node Sequence would have been nice though.

Completely true, but in that configuration it is one, although with miserable performance.

Concerning “alternate node sequence”, you should indeed use spaces. No need for workarounds.

It’s still not an emitter follower. In an EF, the BE junction is forward biased as normal. Here it’s the BC junction that’s forward biased and the BE junction is reversed biased. It will show miserable gain. An emitter follower has unity or less voltage gain.

Anyway it was actually working in commom emitter mode, just a discrepancy between KiCad and ngspice pin numbering.