====== KiCad Footprint Management ====== The stuff here was written for versions of KiCad preceding 4.0. The latest versions of KiCad have introduced new library management features, rendering some of what follows obsolete. ===== Footprints, modules, libraries ===== KiCad places footprints into **footprint libraries**. Footprint libraries use the ''.mod'' extension. One ''.mod'' file typically contains definitions for several (usually related) footprints. KiCad uses the term "module" interchangably with "footprint". There are two kinds of libraries in KiCad: **footprint libraries**, which are stored in ''.mod'' files, and **component libraries** (i.e., schematic symbol libraries), which are stored in ''.lib'' files. Our concern here is with footprint libraries. Individual footprints can be stored in ''.emp'' files. Footprints in ''.emp'' files are typically used for exporting and importing footprints between libraries; they are not typically used directly in designs. ===== System footprint libraries ===== KiCad ships with a large set of predefined footprint libraries. The locations of these footprint libraries will depend on your operating system, but they are typically installed in a system level (rather than user level) subdirectory. PCBnew and CVpcb by default let you use these system footprint libraries automatically. You can also (and often need to) supplement the system footprint libraries with third-party and user libraries. ===== Third-party footprint libraries ===== Third-party KiCad footprint libraries are available from many sources.((Examples include http://www.kicadlib.org/ and http://library.oshec.org/. You may [[https://bugs.launchpad.net/kicad/+bug/872315|have to manually add]] ''$EndLIBRARY'' to the end of some/most/all of these files to prevent a parsing error.)) These are often provided at no cost (i.e., [[wp>gratis]]) but may or may not have limitations on usage (i.e., they may or may not be fully [[wp>libre]]). You should always confirm that your intended use is consistent with the creator's licensing. ==== Adding a third-party footprint library to a project ==== To use a third-party footprint library in your project, you must first make the library available to the project.((There is probably a way to configure KiCad to include access to additional libraries in new projects by default, but I have not yet looked into this.)) The procedure is as follows: - Place the ''.mod'' file in a location that makes sense.((It might make sense for you to create a file system outside your project for libraries, for example a folder called "kicad-libraries" that contains two additional folders: "third-party" and "personal".)) - Open your project. - Inside CVpcb, select //Preferences -> Options// or inside PCBnew select //Preferences -> Library//. - Use the top part of the resulting dialog to //Add// or //Insert// the additional ''.mod'' file you wish to use in the project. - Click "Ok". - You will be prompted to apply the changes to the current project's ''.pro'' file or to select another project's ''.pro'' file. Go with the default---the current project's ''.pro'' file. You should now be able to access the third-party library's footprints in CVpcb and PCBnew. ==== Adding individual third-party footprints to system and third-party libraries ==== In addition to distributing collections of footprints in libraries (stored in ''.mod'' files), it is also possible to distribute individual footprints using ''.emp'' files.((Many/most/all of the footprints downloadable from http://www.kicadlib.org/ are packaged as .emp files.)) However, to use a footprint stored in an ''.emp'' file, it must first be //imported// into a library. You should add new footprints only to user footprint libraries. See [[#User footprint libraries]] and [[#Adding existing footprints to an existing user library]] below. **Even though you can import footprints into system and third-party libraries, you are strongly advised against making any changes to system and third-party libraries.** This is because when you update KiCad, there is a good chance that the system libraries will be overwritten, and you will lose any changes you have made to them. Similarly, if you download an update to a third-party library, you will lose the changes you have made to that library. ===== User footprint libraries ===== While footprints contained in predefined system and third-party footprint libraries will be enough to create many designs, at some point you will probably need to create a new footprint or edit an existing one. For creating new footprints and for making changes to footprints in system or third-party footprint libraries, it is highly recommended that you use only libraries you have created yourself---what we will call //user libraries//. In other words, you should create new footprints only in user libraries, and footprints in system and third-party libraries that you wish to change should first be copied to a user library and edited there. **Even though you can create/add/edit footprints in system and third-party libraries, you are strongly advised against making any changes to system and third-party libraries.** This is because when you update KiCad, there is a good chance that the system libraries will be overwritten, and you will lose any changes you have made to them. Similarly, if you download an update to a third-party library, you will lose the changes you have made to that library. ==== The Module Editor ==== Library maintenance and the creation and editing of footprints is done with KiCad's Module Editor. To open the Module Editor: - Open a project and open PCBnew. - Click the //Open module editor// icon in the top toolbar. Unless stated otherwise, the processes described below all happen in the Module Editor. The processes below do not exhaustively describe all of the functionality in the Module Editor; rather they describe what I consider to be the most important. ==== Creating a new user library ==== As far as I can tell, there is no GUI-driven way to create a new and empty library. To create a new library you must save a footprint into it. ==== Creating a new footprint in a new user library ==== The basics of adding a new footprint to a new library is summarized below: - In the Module Editor, click on the //New Module// icon in the top toolbar. - In the dialog that appears, enter the name that you will use to identify the footprint.((The Module Editor refers to this as the "Module Reference." The use of the term "reference" here might be the source of some confusion. The "Module Reference" is the name of the footprint and has nothing to do with the reference designator of the part.)) Choose the name carefully to prevent name clashes with footprints in other libraries and also to help you identify and distinguish the footprint. You might consider a ''{library-id}-{footprint-id}'' name format because otherwise it will be difficult to determine the library from which the footprint came. - Use the //Add pads// icon on the right toolbar to add, format, and size the footprint's pads and lands. Use the graphic and text icons to add silkscreen elements. Use the //Place the footprint module reference anchor// icon to set the "zero" reference point for the part (typically the center of pad 1). If needed, change the layout grid using the drop-down below the top toolbar. - When you are finished creating the new footprint, click the //Create new library and save current module// icon in the top toolbar. Set the location and name of the new library and click "Save". The new library will //not// be available to your project by default. To make the new library available to your project, follow the process described in "Adding a third-party footprint library to a project" above, selecting your new library as the one to add. === Creating a new footprint in an existing user library === First, make sure that the library to which you want to add the new footprint is available to the project. Then, the process is the same as "Creating a new footprint in a new user library" except that when it comes time to save the new footprint, you need to: - Click the //Select working library// icon in the top toolbar and select the library to which you want to add the new footprint. (This sets the "working library.") - Click the //Save Module in working library// icon in the top toolbar. (Note: You can actually //Select working library// at any time before //Save Module in working library//.) === Copying an existing footprint to an existing user library === First, make sure both the footprint's source and destination libraries are available to the project. Then, - Click the //Select working library// icon in the top toolbar and select the library where the footprint you want to copy is located (i.e., the source). - Click the //Load module from lib// icon in the top toolbar and in the resulting dialog click the "List all" button (to be safe) and select the footprint you want to copy from the presented list. (The list should only contain footprints defined in the "working library" you set in step 1.) - To save the footprint into the destination library, first click the //Select working library// icon in the top toolbar, then select the library to which you want to save the footprint, then click the //Save Module in working library// icon in the top toolbar. Alternately, you may first //export// the existing footprint from the source library and then //import// it into the target library. To add an existing footprint that is in a ''.emp'' file to a library, you only need to import it. Importing and exporting is described below. === Editing an existing footprint === First, make sure that the library that contains the footprint you want to edit is available to the project. If you will be saving the edited footprint into a different library, then that must be available to your project as well. To open a footprint for editing: - Click the //Select working library// icon in the top toolbar and select the library where the footprint you want to edit is located. - Click the //Load module from lib// icon in the top toolbar and in the resulting dialog click the "List all" button (to be safe) and select the footprint you want to edit from the presented list. (The list should only contain footprints defined in the "working library" you set in step 1.) - Edit the footprint as needed. - To save edits back to the original library, click the //Save Module in working library// icon in the top toolbar. To save your edited footprint into a different library, first click the //Select working library// icon in the top toolbar and select the library to which you want to save the edited footprint, then click the //Save Module in working library// icon in the top toolbar. //Note that you are discouraged from making changes to system and third-party libraries. You should save changes to user libraries instead.// === Exporting footprints === Exporting a footprint creates a file with an ''.emp'' extension that contains a copy of the data describing a //single footprint//. A footprint exported this way cannot be used directly in KiCad---it must first be //imported// into a footprint library. However, creating footprint exports is a convenient way to distribute individual footprints and can also be used to copy and move footprints between libraries. To export a footprint, - Click the //Select working library// icon in the top toolbar and select the library where the footprint you want to export is located. - Click the //Load module from lib// icon in the top toolbar and in the resulting dialog click the "List all" button and select the footprint you want to edit from the presented list. (The list should only contain footprints defined in the "working library" you set in step 1.) - Click the //export module// icon in the top toolbar and select the location and name of the ''.emp'' file. === Importing footprints === Individual footprints described in ''.emp'' files cannot be used directly in KiCad designs; they must first be imported into an existing footprint library. To import a footprint, click on the //import module// icon in the top toolbar and navigate to the ''.emp'' file you wish to import. To save the imported footprint into a library, first click the //Select working library// icon in the top toolbar and select the library to which you want to save the imported footprint, then click the //Save Module in working library// icon in the top toolbar. (Note that the library must be available to the project in order to select it.) To import a footprint: - Click on the //import module// icon in the top toolbar and navigate to the ''.emp'' file you wish to import. - Click the //Select working library// icon in the top toolbar and select the library to which you want to save the imported footprint. (Note that you will only be able to select from libraries that are available to your project.) - Click the //Save Module in working library// icon in the top toolbar. ===== Additional resources ===== ==== footprintbuilder ==== Creating pad groups for multi-pin packages in KiCad's Module Editor is a tedious and error-prone task. Much of the tedium and potential for error can be eliminated by using Robert Fitzsimons' [[http://cyclerecorder.org/footprintbuilder/|footprintbuilder]], a GUI-based Java program that automates footprint creation. You should use KiCad's Module Editor to check that the ''.emp'' footprint files made with footprintbuilder are as you expect and to make any needed adjustments that are not possible from within footprintbuilder.