The process of creating a custom part in Eagle is far more complicated than it needs to be, and the user interface is quite buggy. Here I will share some of the essential tips I leaned while creating my own parts in Eagle and describe the full process of creating a new part and/or modifying an existing one
Before I begin, some essential background information is in order. So far I have been using the term part, but in fact there are three kinds of components in Eagle, and understanding what they are and how they are related is ciritical for understanding the rest of the tutorial. The three kinds are Symbols, Packages, and Devices.
Symbol refers to the schematic representation of a part. We work with symbols when designing a circit schematic. Eagle allows us to create our own symbol designs.
Package refers to the actual geometric footprint of a part. We work with packages when designing the PCB for a circuit. Eagle allows us to create our own package designs.
Device refers to the component as a whole, and the relationship between its symbol and package. Strictly speaking, a device is merely a relationship; it does not actually include the symbol or the package. To understand this subtlety, suppose we have 2 symbols for a Mosfet and suppose we have 5 Mosfets with different properties each. Then we can define as many as 10 distinct devices.
The second piece of essential background information is that Eagle's library editor actually consists of three kinds of editors. As you may have guessed it, there is a Symbol editor, a Package editor, and a Device Editor. We will encounter each of these editors throughout the tutorial in the same order.
First I would recommend watching this YouTube video, which walks you through the process of creating a new part in Eagle based on an existing part.
The method presented in the video is the most common method I have seen people use, but I found a much less painful way of achieving the same. For this tutorial, lets suppose that we want to create a 4-pin header based on the "FTDI-SMD-HEADER" from the "fab.lbr" library. If you open Eagle, expand "fab.lbr", and right click on "FTDI-SMD-HEADER", you will see that the only available option is "Open in Library" which is not going to be very useful for us. There is also however, a grayed-out option called "Copy to Library". To enable this option, you first need to have opened the library file to which you want to copy the part (super intutive, I know). Thus, what we will do is create a new library by going to File>>New>>Library. Save the file as "myFab.lbr". Without closing the file, go back to the Control Panel window, and now the "Copy to Library" option in the context menu will be available. This trick is also useful for creating a personal library of the parts used most frequently.
Having copied "FTDI-SMD-HEADER" to our personal library, lets proceed to editing this part. Right click on it and choose Open in Library. This will open the part in the library editor's symbol editor.
Let's open our symbol by double clicking on FTDI from the Table of Contents and try editing it. As soon as we try deleting one of the pins, however, we are greeted with an error saying that you cannot delete the pin, because it is connected to a pad. It would have been hepful if the message gave information about what to do in that case, but it does not.What the error is basically saying is that the pins on the symbol are connected to the pads on the package and therefore no pin can be celeted. What we must do in that case is go to the device editor and manually break all the connections between the symbol and the package. Only after that we can come back to the symbol editor and start deleting pins. To do this, click the "Table of Contents" button again and double click the device "FTDI-SMD-HEADER" to open in the device editor. Press the "Connect" button, then click "Disconnect" several times until all the connections are broken, then click OK. Now we can go back to the symbol editor and start deleting pads until only 4 remain. Change the names of the remaining pins to be '1','2','3','4'.
NOTE: Three other buttons on the Actions toolbar people often use are Device, Package, and Symbol. They do nothing more than that what the Table of Contents allows you to do; and are one of the most unintuitive and buggy parts of the software, thus I don't recommend ever using them. If you click on any of them, the Edit window will pop up showing you a list of Devices, Packages, or Symbols - depending on the button you clicked. If you then click on an item from the list and select OK, that item will open in the appropriate editor. However, the nonintuitive and buggy part comes from the options near the bottom of the Edit window. If you enter any text in the box, then a new part will be created - regardless of whehter you have selected one from the list. Then there are also 3 buttons which should not in fact be buttons at all but tabs instead which should be at the top where tabs actually belong, and they let you switch between the list of symbols, packages, and devices. The even stranger thing is that if you click the "Pac"
button tab and select one of the packages, then that package will open for editing (at that is only if you did not enter anything into the text box). This begs the question then what is the point of having the 3-buttons on the Actions toolbar when you can still change what you want to open/create from the edit window.
The editing tools are also quite unfriendly and unintuitive to use, so here are some helpful tips.
Once you have finished editing the Symbol, proceed to editing the package. Hit the Table of Contents button on the Actions toolbar and double click on 1X06SMD from the list of packages. Delete the pads until only four are left. Then click the "Name" button on the side toolbar and change the names to be '1','2','3','4'. Always ensure that the names and order of the pins/pads is the same the both the Symbol and Package.
Note that the name of the pads is not displayed. Thus, what I like to do for my parts is put names on top of each pad, so that I don't have to guess what each pad is when designing the PCB traces. I create a new layer titled TEXT and put the name labes on that layer. To position the labels exactly at the center of the pad, the grid resolutions needs to be increased to 0.05 or smaller value.
The third part of the process is to create a device that connects the symbol to the package. Click the Device button on the toolbar, enter a name for the device - "4PinHeader", then click OK. This will create a new empty device and open it in the device editor. Here we specify the package and symbol that we want to use for our device. To select the symbol, click the Add button on the left toolbar, then choose the correct symbol. To select the package, click the New button then choose the correct package. (It doesn't make any sense why the processes of choosing a symbol and a package are so different.)
The only thing left is to connect the symbol to the package. Click "Connect". In the window that opens, you are expected (although there is absolutely no information to indicate that) to choose a name from the Pin column and a name from the Pad column to which you want to connect the pin, and then click "Connect". If you used the same names for pins and pads as suggested above, this should be trivial. Do this for all names until there are no items remaining in the first and second columns.
Lastly, we may wish to change the names of our package, device, and/or symbol. We can do this from the Table of Contents once again. If we right click on an item we will see Rename as one of the options. Other options that are available from the Table of Contents include, Edit, Duplicate, Remove, and Edit Description.. After renaming, save everything and close the library editor. To be able to use this library in your schematic, go to the Control Panel, right click on myFab.lbr, and check "Use". If you expand myFab.lbr, you will see that there are three categories of items - Symbols, Packages, and Devices - although the devices are not labeled as a separate gategory, which is another feature that needs fixing.
Certain tasks are too time-consuming or impossible to do through the graphical user interface. In such cases, it is more pragmatic to edit the library file directly. An eagle library file (.lbr) contains XML conent, and is therefore easy to read and understand. See my tutorial XML Structure of an Eagle Library File to learn how to edit the XML your Eagle Libraries directly.
When creating a new symbol and/or package, pay close attention to how you position it relative to the cross in the origin. As you know, when you want to move a component when designin a cicruit, Eagle is very picky in requiring to you to click on the origin of the component. Thus it is extremely important that when designing the symbol and/or package, you set the origin near the middle of the component, where you would normally click if you wanted to drag the component.
When designing symbols and packages, it is crusial that you a grid size that is consistent with all other components. You want to use a 0.1 inch grid and place all pins at the corners of the grid boxes. Note that those corners will be present if you use a grid zise of 0.1in,0.05in,0.025in,0.01in, etc. However the opposite is not necessarily true. On a 0.05 inch grid, there will be corners that are not present in a 0.1 inch grid. Thus, make sure to align all pins with the corners that are present on a 0.1 inch grid. That way you will not face any routing problems when desiging your schematic. Note that this point applies only to the placement of the pins. If you want to draw finer features in symbol or package, you can use as fine a grid as you wish. But when placing the pins, stick to a 0.1 inch grid.
If you change the design of a Symbol or a Package that you have used in a chematic, the changes will not automatically be reflected in the schematic. To rebuild the schematic so that it uses the updated desing of the existing components, go to the Add button and select the part you wish to refresh. As soon as you try placing the part anywhere on the schematic, you will see a message asking you whether you wish to use the updated version in all instances of your schematic.
One of the most annoying bugs in Eagle is that if you delete a part from your schematic, then the part as well as all traces connected to that part will be deleted from the corresponding board file. I have found a workaraound that allows you to remove a part yet maintain the traces. The trick is to place a new part connected to the same wire wire to which the part you want to remove is connected. Then, remove the old part first, then remove the new part. If you now go back to the board view, the traces will be preserved.
Eagle automatically creates backup data of schematic, board, and library files. Those backup files are saved in the same directory where your design files are saved, and they have modified file extentions. .brd becomes .b#1, .sch becomes .s#1, .lbr becomes .l#1. There can be a maximum of 9 backup files. It is also possible to have Eagle files saved in a certain time interval, in which case the files get the extensions .b##, .s##, .l## . To reuse the backup files, you need to change their extensions back to their original extensions. These two backup options can be changed from Options>>Backup...