kicad

In this recipe, you will learn how to create a custom symbol. You use symbols in schematic diagrams that you can create in Eeschema. Much of what you will learn in this recipe you will be able to reuse for modifying existing symbols. There is a separate recipe in this book that explains how to do that. Most likely, you want to create a custom schematic symbol because you have a physical component but can’t find an existing symbol to represent it. Perhaps you have searched through the symbols that come with KiCad, and Googled for suitable third-party symbols, but couldn’t find any. It is also likely that you will want to associate your new symbol with a footprint. If your physical component has a standard package, like DIP, for example, then you will be able to associate an existing footprint with your custom symbol. If not, you will also need to create a custom footprint. You can learn how to do this in the relevant recipe, also available in this book. In this recipe, you will learn how to create a custom symbol by creating a symbol for the 555 timer integrated circuit. There are plenty of libraries for KiCad that contain this symbol, but for the sake of learning, let's pretend that we can’t find it. What we want to create is a symbol like the one in Figure 35.1.

Our objective is to create a symbol that complies with the convention. In regards to IC symbols: 1. We arrange pins around a rectangle. 2. We group pins according to function (like inputs, outputs, power etc.) 3. We place the Vcc pin on the top of the rectangle. 4. We place the GND pin on the bottom of the rectangle. 5. We choose an appropriate name and designator for the symbol. Symbol designators are standardised; you can learn more about them here. The physical component that we are working with is in Figure 35.2. This component comes in a standard DIP package with 8 pins. Figure 35.2: The physical component is a 555 timer in a DIP package with 8 pins. Because we are working to create a symbol, we don’t need to know anything about the physical characteristics of the physical component other than the total number of pins that its package contains. You need to know details about the physical characteristics when you are working on the footprint of the component. However, it is beneficial to have access to the data sheet of the component. The data sheet contains information that you need: The names, numbers, and roles of each pin, whether they are input, output, bidirectional, power, signals, etc. All this is useful information, and the more you have on hand, the better. The data sheet for the example component is available from its manufacturer. The information you need is on page 6, and I have included it in Figure 35.3 for your convenience. Let’s start the process of creating a new symbol. In the main KiCad window, click on the Symbol Library Editor button (Figure 35.4). Figure 35.4: Start the Symbol Editor. You must store each symbol inside a library file, so before you start creating the symbol create a new library. Create a new library by clicking on the 'New library' button ( ), or through the File menu. Figure library; I have placed mine in a directory named 'Custom libraries’. KiCad will ask you if you would like this library to be available to all projects ('Global') or only to the current project ('Project'). Choose the most appropriate one for your circumstances (I chose 'Global'). You are now working in the new library, and you will store the new symbol in it. You can confirm this by looking at the header of the Editor window. The path and name of the library you just created must be showing there. Next, click on the 'Create new symbol' button in the top toolbar ( ). A prompt will ask you to select the library in which you will store the symbol. The library you just created should be listed. Click on it to select it and click 'ok' to continue. The Symbol Properties window will show up. The most important values that you need to complete are the symbol name and designator. The name typically consists of the physical component’s model name and any other information that helps to identify it. When you use it later, you have to search for it in the symbol library and having a good name will help you find it quickly. In my example, because I want to differentiate my 555 symbol to those that exist in other libraries, I add my initials 'PD' at the end of the name. For the designator, you should not guess. Visit Wikipedia to see the Reference Designators table (https://en.wikipedia.org/wiki/ Reference_designator). You can see a section of this table in Figure 35.5. The designator for integrated circuits is 'U,' so type this in the Default Reference Designator field. For an authoritative discussion on designator and standards, please refer to a series of articles written by Lawrence Joy at https://txplo.re/ 96bc7.

Figure 35.6, shows the values I have entered in the Symbol Properties window. Other than the symbol name and the designator, everything else remains as per the default.

Click Ok to commit and continue. KiCad will place the designator and symbol name in the middle of the sheet, on top of the other. Use the 'M' hotkey to relocate the two blocks of text. You should have something similar to the example in Figure 35.7. Figure 35.7: An empty new symbol. Continue by drawing the outline of the symbol. You can either use the polygon tool ( ) or the rectangle tool ( ) to do this. Your outline should look like the example in Figure 35.8.

Add the background colour that is consistent with other IC symbols by opening the drawing properties window for the rectangle (place your mouse pointer on the rectangle line and type 'E'). Under 'Fill Style', check the 'Fill background' radio button (Figure 35.9). Figure 35.9: Fill the rectangle background. Next, work on the pins. Keep the datasheet open because you need the information in it. For your convenience, refer to the excerpt in Figure 35.3. Click on the pin button in the right toolbar ( ). Place the 8 pins around the perimeter of the symbol outline, as in the example of Figure 35.1. The thing to remember here is that the convention is to group similar pins together and place the two power pins to the top and bottom of the rectangle. Let’s start with the Vcc pin. According to the datasheet, the Vcc pin is number 8, and according to the convention, it should go to the top edge of the rectangle. Click on the pin tool, and then click in the middle of the top edge. The Pin Properties window will come up. Fill it as you can see in the example in Figure 35.10.

In Figure 35.10, the fields inside the box are the ones that you need to focus on. The pin name is arbitrary, but of course, you should use a name that is appropriate. I usually use the same name that I see in the documentation for this pin. The Pin number, on the other hand, is very important. The Pin number is how schematic symbols and footprints can associate physical and symbolic pins. When you design the custom footprint for this physical component in the 'Creating new footprint' recipe, it is the number that you put in the Pin number field that dictates which net in the schematic diagram connects to the correct pad in the footprint. Take the pin number for the Vcc pin from the documentation ('8') and type it in this field. In the orientation drop-down, select the option that matches the side of the rectangle where you are attaching the pin. The Vcc pin should go on the top of the rectangle and should have its circular connector pointing away from the rectangle. The horizontal line of the pin orientation icon represents the rectangle. If you wanted to place the pin on the left of the rectangle, you would choose the icon with the circular connector printing towards the left. Finally, because the Vcc pin is a power pin, I have selected the 'Power input' electrical type. You should choose the same type for the GND pin. Click Ok to commit the changes. Place the pin in the middle of the top side of the rectangle, as you can see in Figure 35.11. I have moved the text block so that they don’t overlap with the pin.

Follow the same process to add the GND pin (pin 1) in the bottom edge of the rectangle. Copy the pin name and number from the datasheet, and mark it also as a Power Input. Continue with the left side of the rectangle where you should place the input pins. According to the datasheet, the input pins are RESET, THRES, TRIG. There is one bidirectional pin, 'CONT,' which you can place either on the left or the right of the rectangle. I have placed it on the left. Your symbol should look like the example in Figure 35.12.

The pin attributes for the input pins on the left of the symbol look like the example in Figure 35.13. Remember that pin 5 is bi-directional so its electrical type should be 'bidirectional'.

Continue in the same way to create the last two pins. Those are output pins, as per the datasheet. Use the pin names and numbers as those appear in Figure 35.3 for pins 7 and 3. When completed, you should have a symbol that looks like the example in Figure 35.14.

The last thing to do is to add the URL for the real-world component datasheet to the symbol properties. This will be useful to you for future reference. It will be surely useful when you go ahead to create a custom footprint to match the symbol. To add the datasheet URL, click on the Symbol, 'Fields…' to bring up the Field Properties window. Click on the Datasheet row to select it and then copy/paste the URL in the Field Value field (Figure 35.15). Click Ok to commit the changes.

Your work is complete. Save the symbol to the selected library by clicking on the Save Current Symbol button ( ). Then, test that you can use it in Eeschema. Open Eeschema. Go into Symbol Libraries from the Preferences menu and add the new library (read the relevant recipe if you don’t know how to do this). Place your cursor on the Sheet and type 'A' to add a new symbol. Search for the name of your library by typing part of its name in the filter field (Figure 35.16). The library should appear. Double-click on the symbol to drop it on the sheet.

The custom 555 symbol should now be in place inside Eeschema, and you can go ahead to use it as you do with any other symbol (Figure 35.17). Figure 35.17: Your new custom symbol in Eeschema. In this recipe, you learned how to create a brand-new symbol. What if you have found a symbol that is close to what you want, but could be perfect with a bit of tweaking? In other words, what if you want to modify an existing symbol? You can learn how to do this in the '36. Modifying an existing component (symbol)' recipe.