Example: Creating a fully specified symbol for a voltage reference
This part of the tutorial will show you how to create a symbol by creating one for the LM4132 voltage references. We will design a fully specified symbol with aliases for different output voltages.
The datasheet gives a quite good example of how a symbol for this part can look like.
Collecting the important information
To be able to create a symbol we need to find out what the interface of the part looks like. Meaning we need to know the functions assigned to each pin. This is found on page 3 of the datasheet.
In this case the part only comes in one package. If a part comes in multiple packages then we would need to decide for which package to make our symbol. (This will be handled in later tutorials)
From this we gather that there are at least 4 pins needed in the symbol. It makes sense to also include the non connected pin as it allows additional features to work. (One example would be the pin number filter of CvPcb)
Electrical type of symbol pins.
Detailed information about electrical types of pins can be found in the FAQ
We will assign power input to both the GND and Vin pins. (GND is shared for the input and output side. However power input should take precedence as it has stricter requirements.)
Vout will be of type “power output” and the enable pin of type “input”.
The NC pin wil get the pin type “Non connected”.
Lets get started
As a first step create a new project just for following this tutorial. Create a new symbol library within the project folder and add it to the project library table. A more detailed explanation of how to make a new symbol library is in a different FAQ article
Give the project the name “forum_tutorials” and place the library directly inside the project directory. Give the lib the name “tutorial_symbols” and add it to the project (also known as local) library table.
Symbol name
Give the symbol the name “LM4132-1.8” (We include the voltage as we will add other voltages as aliases later in this tutorial. You can include more parts of the part number if you want the symbol to be a bit more specific.)
The reference prefix
Choosing the correct reference designator prefix can be tricky. If you are part of an organization then check their guidelines. (There are many competing incompatible standards out there. Make sure what you make is aligned to what the reader of your schematic expects.)
If you are not then the wikipedia article about reference designators will be a good starting point. For this tutorial we use “U” as it is the suggested prefix for integrated circuits.
Creating the symbol
Right click on your target library (tutorial_symbols) and select “New symbol” in the context menu.
Fill out the opening dialog with the symbol name “LM4132-1.8” as explained above. Make sure the reference prefix is “U” (Should be the default).
Make sure that show pin numbers and names are selected as well as pin names inside. (This should be the default setting as well.)
The result should look like this
The star next to the symbol name and library name means that there are changes to be saved. Use the save button in the File menu or the top toolbar to save your changes. The stars should vanish once you save.
Adding the pins
Choosing the correct grid for pin placement is important as mentioned in the introduction. For this tutorial we use 100mil grid for placing pins. Use view-> grid settings and select 100mil.
Lets start by adding the voltage input (Vin) pin. This can be done via the Pin entry in the Place menu, via the place pin button of the right toolbar or with the shortcut “p”. You will need to left-click if the pin settings dialog does not open. (Only the shortcut will open it automatically)
We set the pin name to “Vin”, the pin number to “4”, the electrical type to “power input” and the pin length to 100 mil. The position and direction values can be ignored for now as we will be able to move and rotate the pin around before we place it.
Press ok once you are happy with your settings.
The pin will stay attached to your mouse pointer until you place it with another left-click. You can rotate it using the shortcut “r” as long as it is in this mode.
Notice that one end of the pin has a circle around it. This will be the point where you connect your wires in the schematic editor.
Place the pin somewhere on the left side of the origin with the circle pointing towards left. Don’t worry too much about the placement at this point in time. You can always move the pins around later on. (See the screenshot for inspiration. Left-click to place the pin.)
All future pin placements can be started with a simple left click. (As long as you are still in the “add pins” tool.) Next we add the GND pin which is also of type power input and has pin number 2. (Adding pins with similar setups is easier as kicad remembers all settings made in the previous pin placement.)
All other pins can be added in any order.
The only new thing is the non connected pin. This pins setings depend on your preference. I typically add such pins as invisible pins and place them inside the symbol outline to make it near impossible to accidentally connect them. You can leave them out completely or add them as visible pins. (If you add the pin then i would suggest to choose the electrical type “Not connected”.)
Finishing up the graphical look of the symbol
Reduce the grid spacing to 50 mil for everything except pins.
Add an outline to the symbol to make it obvious which pins belong to it. Such an outline is typically drawn in such a manner that the end of the pin (the one without circle) touches the outline and the other end points towards the outside.
For this simple symbol a rectangle as outline will be enough. Select the rectangle tool from the place menu or from the right toolbar. Left-click at your first corner. Move the mouse pointer to the other corner and confirm the rectangle with another left-click.
If you want to fill the rectangle then right-click on it. and choose edit rectangle properties (shortcut e). Select background fill. (Maybe also select foreground fill as an experiment to see what this option does.)
Move the reference and value field outside of the symbol even thought the visible fields will be automatically placed (can be deactivated) when placing the symbol inside the schematic. Doing this will make the symbol more readable in the symbol editor.
Moving any element is done by using the shortcut m while the mouse pointer is on top of it. Or by selecting move in the right-click context menu.
Adding additional information
This symbol would already be usable as is. Fill out the documentation fields and set the default footprint as well as the footprint filters to make it even more useful.
The user interface used in this part of the tutorial looks very different in the used version as compared to version stable 5.0.x and earlier. (Version 5.1 will look similar to this.)
All of this is done in the symbol properties dialog that can be reached from the edit menu -> properties
or via the button in the top toolbar. (In version 5.0.x it is split into the field editor and symbol properties editor.)
Setting the footprint field
Setting the footprint field in the library eliminates one step when using the symbol. This does reduce the points where a user error can occur.
Left-click into the footprint field. A button will appear on the right of this input field. Clicking this button will open the footprint browser.
In the footprint browser select the SOT-23-5 footprint from the Package_TO-SOT library that is supplied with KiCad.
Setting the footprint filter
The footprint filter is used in the CvPcb tool as well in the add symbol dialog (if enabled) to reduce the number of suggested footprints.
We set this filter up such that it results in both the default footprint as well as its hand soldering alternative. (Ideally it should also future proof the symbol a bit)
Switch to the footprint filter tab of the dialog and enter *SOT-23-5*
as the filter. The filter accepts two different wildcard characters. Star “*” stands for any number of arbitrary characters while the question mark “?” matches exactly one arbitrary character.
Adding documentation
Foul out the documentation field in such a way that it makes sense for you. The keyword field is used for in the symbol search features of kicad. For this tutorial we use voltage reference as tag.
Adding a valid link into the datasheet link allows easy access to the datasheet from within the schematic (right-click -> datasheet)
The newly added fields will be placed (by default) in the middle of the symbol. Move them outside to have a clean looking symbol. (Even if they are set to invisible, they are still shown inside the symbol editor)
Adding aliases for other output voltages
Adding aliases allows us to add different output voltage versions of this part without needing to maintain more than one symbol. Aliases are however quite restricted. Only a few fields can be specialized for every alias. One restriction is that all aliases share the footprint field and filters with their parent symbol.
Switch to the aliases tab to add and edit aliases. We add the alias for the 2.0V version of the part. Click the plus button and edit the alias name and documentation fields to fit your needs.
Adding user fields for better BOM output
Custom user fields allow for a more detailed BOM to be created.
Note however that all aliases share these fields. This means that we would need a separate symbol for every output voltage to be able to include full ordering information. For this copy the symbol inside the library instead of adding aliases. This of course increases the effort for maintaining your libraries.
As an example add a new field with name Manufacturer and value “Texas instruments”. Managing user fields is done in the General tab. Press the add field button and edit the field name and value accordingly.
The Result
Note that the alias is listed in the same manner as the symbol. However if you click onto the alias name, the symbol will be set as active. This can get quite confusing if the alias and symbol have very different names and there are other symbols in between them.