LM317 symbol creation


#1

Hi, first time posting. A complete beginner here :slight_smile:

This is not KiCad specific. I am confused about creating a schematic symbol from this unencrypted LM317 library. It’s a PSpice .LIB file (thanks hermit)

My first confusion is that it contains many SUBCKT headers (do you call it headers?), unlike online tutorials. Which .SUBCKT should I choose ?

Secondly, this is a 3-pin voltage regulator, but the SOT-223 package here appears to have 4 pins, two of which are actually outputs!. What exactly should I do ? There is no .SUBCKT in the lib file with three pins.

For symbol creation, I open the .lib text file in LTSpice, highlight “LM317_TRANS”, right click and choose create symbol. It’s easy and creates a generic symbol (but 4 pins ?!!!)

Sorry if this is off-topic. Hope this doesn’t bother anyone.

Cheers.


#2

There seems to be 11 LM317 symbols already in the KiCAD library. They all seem to be package dependent. Which physical unit are you going to use? Surface mount? Through hole? You just need to choose according to package type. Package type here is the physical configuration of the unit.


#3

Thanks hermit. It’s LM317T through-hole, but tbh, I want to know how to actually deal with this. Installing KiCad again and choosing a symbol is easier, of course, but I won’t go that way :slight_smile:


#4

Are you talking about the schematic symbol? Are you talking about a SPICE model? I think the developers version has some limited support for SPICE. If that’s the case, I can’t help. I use the stable version.


#5

In reality, there are only 3 separate connections:
a) Input
b) Adjust
c) Output

The 4th physical pin is electrically the same as the output pin.

In your schematic symbol, create one with only 3 pins, and assign the correct name to the correct pin number. It would be good practice to organize the symbol pins by function from left to right, and not numerically from lowest to highest.

Later when you assign a footprint to the symbol, that footprint will have 4 physical pins. However, one of the pins will have one of the pin names the same as the first instance of “output” (as this is the pin that is duplicated on this particular part).

The symbol will have these pins and names:
Pin 1) Adjust
Pin 2) Output
Pin 3) Input

The footprint will have 4 physical pins, one with the same name:
Pad 1 will be pin 1 of the symbol.
Pad 2 will be pin 2 of the symbol.
Pad 3 will be pin 3 of the symbol.
Pad 4 (or the tab) will also be assigned to pin 2 of the symbol.

You can open the footprint browser and check out TO_SOT_Packages_SMD:SOT-223-3Lead_TabPin2 for an example.

Hope this helps.


#6

I didn’t realize till now that I should have added Schematic. Yes it’s a simple schematic symbol from a .LIB text file. Sorry about the confusion.

Sprig:
Yes this sure helps. I forgot to mention that the confusion is in making the schematic symbol, not the footprint (yet!). Assigning pad no. 4 (The tab in SOT package (and the heatsink in the TO packages?) ) to pin 2 was very helpful.

Okay, so one more last thing. For the .SUBCKT body here:

.SUBCKT LM317_TRANS IN ADJ OUT_0 OUT_1
R_R1 VXX IN {RINP}
R_R6 N242982 VYY 10 TC=0,0
R_R5 VZZ VYY {ROUT}
E_ABM1 N242982 0 VALUE { MIN(V(VXX), (V(Vzz)+(ILIMROUT))) }
R_R2 N222524 VXX {PSRR
RINP}
…

If I made a schematic symbol out of that with 3 pins only out of it and ignored OUT_1, would it be OK ?


#7

Have a look at the footprint you want to assign to your symbol.
I would suggest you use TO_SOT_Packages_SMD:SOT-223-3Lead_TabPin2
You will see that for this footprint TAP (pin 4) has pin number 2 (as implied by the name)
So you only need one output pin in your symbol.

You could also use the sot223 4 pin footprint but you will not get more functionality. (The symbol might look a bit strange.)

And if you want, the regul lib has recently been updated and as far as i remember the lm317 should now exist for the sot223 package. (Yes i know you want to learn, i just leave this info here if somebody in the future needs it, or if you want to have a look at these new shiny symbols.)

To get the newest symbol libs you would need to download the kicad-library repo from github and either copy the symbol libs into the correct path. (look at the searchpath in eeshema-> component libraries) Or setup kicad such that it looks wherever you put the lib.


Just a reminder:
In kicad symbols need unique names over all libs. So if there is a symbol in the official lib with the same name this might be a problem. (If it does not yet exist, it could be added in later versions of kicad. Symbol libs are updated with the kicad version.)

To ensure that your symbol is taken make sure you add your libs to the top in the properties->component library dialog:


#9

In your schematic symbol, create one with only 3 pins, and assign the correct name to the correct pin number.

I have to say, I would fundamentally disagree with this. I would create four pins on the symbol otherwise it’s just too confusing when you come to debug the hardware and probe around with a scope or DMM.


#10

LM317

The way I suggested is the way the industry does it.

Any Technician doing testing, troubleshooting, or repair, should be knowledgeable about the different device packages.


Testing a Three Legged Regulator
#11

Like with a lot of things, there are at least two ways to look at things. Having a symbol with all 4 pins might be nicer in the mind of some guys. (It makes it obvious what is going on.)

While others know that two of the pins of that particular package are normally connected and don’t want to see it separated in the schematic.


I personally would go for the 3 pin symbol if the datasheet defines the pins as numbers 1…3 with pin 2 double. If the datsheet contains numbers 1…4 i would go with a 4 pin symbol.


So my suggestion is find what works for you personally and go with that.


#12

Actually, it does not. It would make me wonder what the “function” of the extra pin was for.

The device package is going to label 4 different pin numbers, if there are in fact 4 physical pins.

SOT-223

As shown, pins 2 and 4 share the same function.

Out of curiosity, does the KLC have a preference?


#13

Yes. The KLC would use pins 1…4 in this case as the package has all 4 numbers assigned.

If the second output pin would also have a small number 4 then it would only need 3 pins.

However, one can stack the output pins. (visible one with type power out, invisible one passive)


#14

National_317
Fairchild
ON

Presented are 5 schematic symbols used from 5 major manufactures (including the Ti one above).


#15

I know this comes across as being a bit ranty. It’s not supposed to be, so apologies in advance.

The issue with that is that it is a generic symbol for all packages, some of which only have three pins, so I just don’t see that as an acceptable argument.

If you come to debug this hardware, there are four pins on the PCB and only three pins on the schematic, you’re going to be scratching your head thinking hang on, what is this pin that is not shown on the schematic. It’s the same as these bonkers symbols where they hide Vcc and GND in the schematic. Yeah, if it’s a 74HC you know top right and bottom left are power and ground and you might - even with thirty years’ experience - might - know what all the pins are in what order on an LM317, but there could still be uncertainty. There certainly will be for people who aren’t familiar with it. All for the sake of not putting one extra pin on the symbol which in no way whatsoever makes it less readable, in fact the polar opposite.

If you have a processor with four ground pins and four power pins on it, do you only put one of each on?


#16

I have imported some symbols from SnapEDA and routinely have to unstack the stacked GND pins. It would be safe and recommended to always solder all the GND pins but often it’s more practical to to leave some of them unused because it makes room for other things on the board. For example, I can make a board which is smaller than the module which is soldered on top of it. So, I don’t like even stacked pins, let alone leaving them out.


#17

I don’t know what you mean by stacked pins. I’m really not sure of the point you’re making. Sorry if that sounds rude, it’s not meant to. :slight_smile:


#18

No offence taken! It was just a long “no, I don’t” answer to your question :slight_smile: By stacked I meant put on top of each other so that they look like one. I don’t like even that, let alone pins which are left out. If there would be only one GND pin in the symbol I would have to add there all those which are in the physical part.

But this is going offtopic…


#19

Unless you are talking about a double sided board, I don’t even see how that would be possible. It is simply bad practice to not connect all ground and power pins of complex ICs such as SoCs and FPGAs. Your board might work without all grounds connected but you might have other issues that aren’t immediately obvious.


#20

No.

There are 3 pins and 1 TAB; exactly opposite of pin 2.


#21

These are pins, and not TABS.

I agree that it is bad practice to not connect all power pins to their requirement.

.