Modifying library symbols

  1. I noticed most of the power transistor library symbols are not correct wrt the schematic symbol in that the pin numbers are not aligned for bipolar devices - eg base and emitter swapped. How can I correct the pin numbering so its permanent in the library? I could add a suffix like ‘BIP’ to signify it’s for bipolar devices.

  2. If I change the dimensions of holes in the footprint, I have the same question - how can I update the library so its permanently fixed?

I’m assuming other users of power bipolar devices have the same issues - seems a bit counterproductive to edit each symbol to correct it when designing a new board, that’s why I want to correct it.

The answer to your general question is to save the symbols you want to change to a new library and modify them there. The default libraries are read only and even if you make them read-write, any changes will be overwritten when you update KiCad. Same for footprints.

As to your specific comments about power transistor pins, can you point to some specific symbols that you think aren’t right?

1 Like

Thanks for your reply. I will look into that for the library.

for the footprint <> Schematic correspondence, I noticed this on the TO-126 tab down

Schematic symbol Base =1 Collector =3 Emitter = 2
PCB Physical Base = 1 - should be emitter Emitter = 2 (should be collector) Collector = 3 (should be emitter)

The devices I am looking at are KSA1381 and on the TO-3P packages the NJW3281 there is a similar issue. Might be the packages are pin aligned for power mosfets, but they don’t seem right for power bipolar devices.

image

The footprint above should read left to right emitter, collector and base

I disagree with your conclusion :slight_smile:

I don’t see either of those symbols in the KiCad libraries, so I’m going to assume you made your own symbols or used a generic symbol - correct me if not.

Both BJTs and FETs are available (in the real world) in all combinations of lead ordering - BCE, ECB, CEB, GDS, DGS, SDG, etc. Some are more common than others, but it depends on the specific part you’re talking about.

Therefore if you want a generic TO-126 footprint that will work for any TO-126 transistor, you choose the standard pad numbering of left-to-right, 1-2-3, like it is in the KiCad library (this also matches industry standards, where they exist). This does not represent a specific transistor, it represents all transistors in a TO-126 package. Then you make/choose a symbol that has the right pin/pad numbers mapped to the base, collector, emitter, gate, drain, source pin as appropriate.

Let’s compare two TO-126 BJT symbols in the Transistor_BJT KiCad library: MJE13003 and 2SB631.

The MJE13003 KiCad symbol has the base on pin 1, the collector on pin 2, and the emitter on pin 3. Combined with our knowledge that the footprint has pads numbered 1-3 going from left to right, this matches the datasheet’s pinout for this part:

The 2SB631 symbol has the emitter on pin 1, the collector on pin 2, and the base on pin 3. This again matches the datasheet pinout:

So these two examples, at least, will map correctly to the board. It’s always possible that there is a mistake in the library, but that would be a pretty serious issue (and should be reported to the library team to be fixed).

If you’re using a transistor that isn’t in the libraries, you can either make your own new symbol, taking care to get the pin numbering right, or use one of the generic transistor symbols in the Device library: for example, Q_NPN_EBC is an NPN with emitter pin 1, base pin 2, collector pin 3.

For the KSA1381 you’re using, you said you had a schematic symbol with base on pin 1, emitter on pin 2, and collector on pin 3. But the datasheet I found for this part says it has the emitter on pin 1, the collector on pin 2, and the base on pin 3. So I think that’s your problem.

2 Likes

FWIW
I keep my “personal” libraries in a folder under “My Documents” with the prefix j_ (my first initial).
So my version of your device would be …j_Libraries_Dir/j_activeParts/KSA1381

This way Kicad doesn’t overwrite them and my “My Documents” periodic backup saves them to a backup location.

John

1 Like

You seemed to have missed the point that the schematic pin assignments do not correspond to the correct physical pin assignments for standard bipolar transistor pinouts. I made the point that editing one or the other every time a new design is underway is not productive. So either I make my own library or the correct pin assignment footprint exists in the library. If it is the latter, please point me to it.

Almost all modern bipolar transistors used in audio for TO-126 have the pinout I gave (from left to right emitter, collector, base), the same applies to TO-220 and to TO-3P where the pinout is also standardised for those packages. The devices you have in your post are discontinued (Sanyo 2SB631) and the MJE13003 is a very old generic switching transistor typically used in CFL lighting.

I picked two devices at random (they were the first and last results in a search for TO-126). I also did the example for one of the devices you mentioned, which is ECB as you said.

In your case, you just need to use an appropriate symbol where pin 1 is E, pin 2 is C, and pin 3 is B. That can be a symbol you have made yourself or the Device:Q_NPN_ECB symbol I mentioned above. You don’t need to modify the footprints.

(Edit - above I actually mentioned a generic EBC symbol, not ECB, but I was speaking generically. The library provides all possible combinations, because they all exist in the wild).

2 Likes

What is this about?
What libraries are you using?
KiCad does have a footprint with the name: TO-126-3_Horizontal_TabDown, but this footprint does not have the B E C names near it’s pins. Usually the footprints are generic. Such footprints can also be used for thyristors, triac’s (dual) diodes and even for resistors sometimes. KiCad also does not have any default schematic symbol for transistors either starting with KSA or with NJW.

Going back to your opening post:

Name one. If there is an error in one of KiCad’s own libraries, you should open an issue for it on gitlab, or at the very least give the name of that symbol or footprint in your post.

For generic BJC’s, KiCad has the Q_NPN_xxx and Q_PNP_xxx symbols in the Device library. The xxx is replaced by the order of the pins in the schematic symbol. KiCad has these symbols for all pin combinations, and then some extra symbols for footprints with a 4th pin or tab that is connected to one of the pins.

I’m with @paulvdh here. The libraries supplied are to 99% correct in my experience. I don’t know where your symols or footprints come from, sorry.

Hi @Bonsai

The problem is not the Kicad libraries, the problem is the methodology used to find the correct symbols and footprints to match the component you wish to use.

In your example you use the PNP transistor KSA1381.
From the Data sheet, this shows the package, pin numbers and pin names.

The first thing to do is to open the appropriate Kicad footprint library (Package_TO_SOT_THT).
There are three footprints for TO-126-3. The Data sheet shows a drawing Horizontal_TabDown, so open that footprint and confirm its correctness with the Data sheet.

You now know the Package matches the Footprint :tada:

Next; from the Data sheet, you have a simple, Bipolar, PNP Transistor with pins: 1=E, 2=C & 3=B
You open the Symbol libraries to find a suitable Symbol.
The Kicad “Device” library has all six combinations of the symbols for bipolar transistors. You need to select the one you require. In this example, you need Q_PNP_ECB.

Finally: Place the Q_PNP_ECB symbol on your schematic. In the symbol properties, associate the desired TO-126-3 footprint package with the symbol and move on to your next job. :smiley:

4 Likes

This is why I make my own library, both Symbol and footprint. Then I never have to worry about the “whatever is different” again.

Before Kicad I used to work with a PC Design house. They created new footprints for every job.

Not reading once more all posts I don’t suppose anyone here could suggest doing it every time you do a new design. You can always save edited by you symbols and reuse them instead of editing them once more.
I use only my own symbols with footprints attached so I never need to think of selecting footprints during schematic/pcb design.
Whenever I decide to use new element I add it to my symbol libraries (with correct footprint attached).

2 Likes

Thanks for that feedback. I’ve taken some symbols from the library layout and altered them to match the pin assignment on the schematic. I’ve added ‘_Bip’ to the end of the symbol name to show that it is my version and different from the original.

My question is, where do I save these, and what do I call the library, and how do I link my schematic to my library, rather than the standard library which does not have the right pinouts?

The other option of course is to change the schematic pin assignments, but then I also need to know the same info as above.

Regards

AndrewR

What I ended up doing after realizing it was faster to “roll my own” symbols is to create a “Libraries” subfolder where I keep my schematics and footprints and tell KiCAD to look in that folder for my parts. I also named it “Custom parts”.

Looking trough forum FAQ I found:

I didn’t read it as I have defined my libraries while KiCad was V4 and since then they are with me.

It is of course your choice.
Some time ago I have written something about my file organization including libraries.

Thanks - this is clear now!

I wrote that FAQ to make it as easy as possible, for new to Kicad and this type of software, to create.
You can never have enough personal libraries. I have 24 symbol and 22 footprint libraries.

It is easiest to save a Kicad symbol into a personal library first, and then modify it.
To do that:
Find and then highlight the symbol in the Kicad library you wish to modify.
Click File > Save as; then change the name to whatever you wish; then scroll through the library list in the window you just re-named the symbol, highlight your personal library in which you want the symbol saved, then save.
Close the symbol in the Kicad library you just copied and open the same symbol in your personal library.
Modify and save.

When drawing your schematic, use the symbol you have placed (and modified) in your personal library, instead of the Kicad library symbol and this will automatically link your symbol in your library to the schematic.

If, at a later date, you decide to move your symbols to different personal libraries or rename your personal libraries, symbols involved will no longer link to schematics. So: as mentioned in the FAQ, take a little time to plan the names and what is placed in whichever personal libraries.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.