gschem Symbol and PCB Element Transistor Guide

The issue is how to manage a library of gschem transistor symbols and a library of PCB transistor elements such that we can be confident of correct pin number correspondence between the libraries. We need to understand how to handle the many permutations of emitter, base, and collector (e,b,c) pinouts and the variations of package number of pins and pin numbering. This doc shows the approach I've taken in my custom gschem symbols and PCB elements.

gschem symbols

There are a couple of ways to consider:

  1. Have a base set of gschem transistor symbols such as npn.sym, pnp.sym, fet.sym, etc. which have a fixed and arbitrarily assigned pin number for the emitter, base, and, collector. To accommodate the different permutations of (e,b,c) to pin numbers that exist for transistor packages, you would have to have a set of PCB elements for each transistor package like TO-92-123, TO-92-132, TO-92-213, TO-92-231, TO-92-312, TO-92-321, and similarly for TO-220, TO-5, etc. The problem with this is that manufacturers do specify pin numbers for their packages and we would be making many elements with pin numbers not corresponding to real packages. Remember, a PCB element on a PCB layout is supposed to correspond to a physical electronic component.
  2. Have a base set of gschem transistor symbols which spans the possible (e,b,c) permutations which can exist for any given transistor package. The set of gschem symbols for npn transistors would be npn-ebc.sym, npn-ecb.sym, npn-bec.sym, npn-bce.sym, npn-ceb.sym, and npn-cbe.sym. There would be similar sets for pnp transistors and FETs (fet-sdg.sym, fet-sgd.sym, …). Then there would be PCB elements only for actual physical transistor packages.

It makes sense to me to say the second approach is obviously better. Setting up the gschem symbols is simple enough, just create the six symbols for each transistor type with the pin numbers of the emitter, base, and collector corresponding to the sequence indicated in the name. For example, the symbol npn-ebc.sym would have an emitter pinnumber attribute of 1, a base pinnumber attribute of 2 and a collector pinnumber attribute of 3. Now you only need to make PCB elements with correctly numbered pins for transistor packages as you need them and you need to have a systematic approach for naming these elements.

PCB Elements

A point to keep in mind when looking at transistor package pin configurations and numbers is that a TO (Transistor Outline) designation is really only just that - a designation of a particular shaped and sized outline. It actually is not a specification of the pins coming out of that package. Manufacturers may have have a TO package designation qualified by their internal “case style” or “package number” code. This qualification determines the definition of the number of pins, the arrangement of the pins, and the pin numbering.

However, most TO packages do conform to a standard pin numbering convention and have a predominant number of pins and pin placement configuration. So it makes sense to have PCB elements with a particular TO name which can be used for a majority of cases. Then when a non conforming case is encountered, we can make a new TO element for it.

Here's a description of what seems to be the most common transistor outline configurations:

General Procedure

The process of using a transistor for the first time in a gschem to PCB design takes these steps (2N3904 used as an example):

  1. Most transistor spec sheets can be found in pdf format on the web, so get one and determine the case style and pin name and number ordering. For the 2N3904 the case style is TO-92, the pin number order left to right is (1,2,3), and the pin name order left to right is (e,b,c).
  2. If we have a PCB element in our library for that case style with the correct pin number order, use it. If not, make a new PCB element. For the 2N3904, I have a TO-92 element in my custom library that has the pin number order of (1,2,3), so I can use it.
  3. Copy the gschem transistor symbol corresponding to the pin name order to a new transistor symbol name. For the 2N3904 example, the pin name order is (e,b,c) so copy the base symbol npn-ebc.sym into 2N3904.sym.
  4. Edit the new symbol and change the value attribute to the transistor name and the footprint attribute to the right PCB element. For our example, this would be 2N3904 and TO-92.

Special Cases

  1. I have in my library a TO-92o PCB element which has the middle pin offset so the pins are in a triangular arrangement. This element has the left to right pin number order of (1,2,3) and can be used in place of the TO-92 for layout considerations. You only have to slightly bend the middle pin of the transistor when installing it.
  2. The BC546 transistor spec sheet shows its pin number order to be (1,2,3) in a straight line and the pin name order to be (c,b,e). But I've seen this transistor shipped from the factory with the middle pin prebent into the offset configuration. For this transistor, you would create the gschem symbol from npn-cbe.sym as expected but use the PCB element TO-92o.
  3. The BF240 transistor spec sheet shows its pin number order to be left to right (3,2,1) in a straight line and the pin name order would be left to right (c,e,b). If you made a new PCB element with pins numbered (3,2,1), then you would have to create the gschem BF240.sym from npn-bec.sym because pin 1 on the PCB element has to correspond to pin 1 on the gschem symbol. But it would be easier to just ignore this uncommon pin numbering and assume the transistor pins are actually numbered the standard left to right (1,2,3). Then you could use the existing TO-92 PCB element and create the gschem symbol using npn-ceb.sym. Some transistor spec sheets give the pin name order and do not give a pin number order, and for these you just make the same assumption that the pins are numbered left to right (1,2,3).
  4. In the second case above, the transistor had an offset pin 2 when the spec sheet showed the pins in a straight line, and the pin numbers on the spec sheet were ordered left to right (1,2,3). But many transistors have the offset pin 2 indicated on the the spec sheet and the pin numbers are ordered left to right (3,2,1). You could use an element such as my TO-92o by ignoring the spec sheet ordering as I suggested in case 3. But this configuration is much more common than the BF240 example so you might want to have a distinct PCB element for it with pins numbered to match the spec sheet.

tutorial by Bill Wilson (bill–at–gkrellm.net)