One of the fundamental pieces of work that is required to create schematics and PCB layouts is creating library parts. Lots of packages ship with a large library of parts, including EAGLE, and there are numerous resources on the web for downloading parts but often these parts are inconsistent with each other, potentially have errors or are just not quite what you need. Most experienced users will prefer to have their own set of libraries which they use and find it often quicker to create their own parts than search for, check and edit a part from an external source.
Unfortunately this task can seem quite daunting when you aren't familiar with the tools and the methods of doing this efficiently. I plan to create this tutorial series to take you from creating simple packages, symbols and devices through to more complex topics like managing variants and building up an in-house library from scratch. For the first few tutorials I will refrain from using keyboard accelerators and ULP to accelerate and automate any of the process so this is just using EAGLE as-is. Future tutorials will show how the already speedy library creation process can be made even faster using these facilities.
For this initial tutorial we are going to create a package drawing for a Texas Instruments MSP430F22x2 device. The datasheet of which can be found on the TI website here: http://www.ti.com/lit/ds/symlink/msp430f2232.pdf
2. EAGLE Library Overview
The EAGLE libraries (.lbr) consist of three parts. Firstly there is the package which defines the copper placed on the board as well as the silkscreen and assembly drawing information. It is also possible to define keepout and restrict areas to indicate how close other packages can be placed and where routing is not allowed. Secondly there is the symbol(s) which define what is placed within a schematic. Finally there is the device which combines symbols and packages to form a part which maps symbol pins to package pins and defines additional properties, all of which can then be added to a design.
3. Creating a Package
3.1. Obtaining the required data
The usual place to go for package information and recommended PCB footprints is the data sheet for the device or alternatively a dedicated document from a device manufacturer which specifies their package drawings. The information required to create the package is:
- The size of the package body
- The pitch of the pins
- The size of the pads required on the board
- The pitch between the rows
All this information should be easily accessible but sometimes you may need to do a little calculation to ensure you have the centre-to-centre distance for the pitch between rows (sometimes they do the maximum outer edge-to-edge dimension).
3.2. Setting up EAGLE
3.2.1. Configuring EAGLE's grids
EAGLE has two grids available. The main grid which is the one displayed and everything is snapped to by default, and the ALT grid which is not displayed and which everything snaps to when the Alt key is pressed. We'll use the main grid for setting the pin pitch of the device and the body length and the ALT grid for setting the row pitch of the device and the body width. We start with pin and row pitches which are 0.65mm and 7.4mm respectively. Now, we want the device to be centred on the origin so we will divide the row pitch by two. As there are an odd number of pins we can leave the pin pitch at 0.65mm but we'd divide this by two as well if the device had an even number.
GRID mm 0.65 ON; GRID ALT mm 3.7
3.2.2. Setting the font and alignment for text
Text on the silkscreen should always use the vector font and be a suitable size for the package and for neatness centred.
CHANGE FONT vector; CHANGE ALIGN center; CHANGE SIZE 1.27
3.2.3 Grouping tips and accessing group functions quickly
One aspect of EAGLE which is different from many other packages but can make tasks very much quicker is the use of groups. In EAGLE groups are not the same as they are in other drawing packages such as Microsoft Visio or Microsoft Powerpoint. The these packages you select a number of objects and group them and these then become "stuck together" and are operated on as one and you can have an arbitrary number of groups. In EAGLE there is only one group and it consists of the last items you added to a group. Lets think of it more as a selection group feature rather than a proper group. Nonetheless its is a very powerful feature.
You create a group by clicking on the group button or issuing a GROUP command and then either dragging a box around all the items you wish to group or clicking to draw an arbitrary shaped selection box. Once the group has been created you select the operation you wish to perform on the group, e.g. MOVE, COPY, DELETE, etc. At this point you have a few choices on how to apply this operation to the group. The most obvious way is via the right click context menu. Right click on any of the items within the group and there will be an option to perform the group operation, e.g. Move Group...
There is a quicker way though. If you hold down the Ctrl button (Cmd on macOS) and then right click on a group item then the selected function will be applied to the group.
3.3. Placing the pads.
Here is where the use of the grids comes into its own. You want to place the pads in each row at the right pitch relative to each other. This is why we set the main grid to match the pitch of the pins of the part above. In our example this is 0.65 mm. There are 19 pads on each side so we therefore want the middle pad to align with the origin. We want the pads to be 1.8mm wide and 0.3mm tall and we want the pad numbering to be 1, 2, 3, etc rather than the default P$1, P$2, P$3, etc... So we start by issuing the following command:
SMD 1.8 0.3 '1'
Then we click to place the first pad 9 grid spaces above the origin and work our way downwards placing our first 19 pads one grid space apart in the vertical. Once we've got our first row of pads we then use the group button or issue a GROUP command and drag a box to add the entire row to a group.
Note: As of EAGLE v8.2.1 there is a bug which means that after a group has been formed the original command does not reactivate. In v7, if you performed a MOVE, followed by a GROUP, then the MOVE command would automatically activate once the group was made so it was then super quick to perform the group move operation.
Issuing a new MOVE command and right clicking on the group with Ctrl (Cmd) held down to activate the group will now enable us to place the row at the correct offset from the centre of the device. This is where we revert to using the ALT grid by pressing and holding the Alt key. We can now move the row one ALT grid space to the left (3.7mm) which will place it in the right location.
We now repeat the above process with a few modifications to place the second row of pads.
SMD 1.8 0.3 '20'
Then we click to place the first pad 9 grid spaces below the origin and work our way upwards placing our second 19 pads one grid space apart in the vertical. Once we've got our second row of pads we then use the group button or issue a GROUP command and drag a box to add the entire row to a group.
Issuing a new MOVE command and right clicking on the group with Ctrl (Cmd) held down to activate the group, we can now move the row one ALT grid space to the right (3.7mm) which will place it in the right location.
The final result of the above will look lie the following:
3.4. Silkscreen and Assembly Drawing
Now the surface mount pads have been correctly placed we need to draw the silkscreen and assembly drawing information. We'll start by changing the grids again for ease of drawing the package body for these. The body is 12.5mm tall and 6.1mm wise so we'll set the grids using half these values.
GRID mm 6.25; GRID ALT mm 3.05
Now we can change the layer we wish to draw on to tDocu.
CHANGE LAYER tDocu
Now using the LINE command we can draw and initial 12.5mm square centred on the origin. The top and bottom of this accurately represent the top and bottom positions of the package body but the left and right are clearly too wide. Now we will use the MOVE command again to get these in the right place. First we move the left hand side to the centre line using the regular grid and then we move it again back out 3.05mm to the left using the ALT grid. Repeating this process again for the right hand side leaves us with an accurate body outline on the tDocu layer.
The result of the above the the following:
We now need to use the COPY command to copy the top and bottom lines from the tDocu layer. Initially we'll place these copies one grid space above and below the existing body outline respectively. We can now use the CHANGE command to move these to the tPlace layer.
CHANGE LAYER tPlace
Now click on the copies of the lines we placed above and below to change their layers and then with the MOVE command we can move them so they are in the same position as the original lines (but on different layers).
We now need to add a pin 1 marker to both these layers in exactly the same way as we created the package body information above, but using the CIRCLE command and a smaller grid of 0.325mm which is half the pin pitch and allows us to create and place a suitable size circle near the corner where pin 1 is located. As per the body we can now use the COPY and CHANGE LAYER commands to create a circle on the tDocu layer as well and then move it so it is sitting on top of the original.
The result of these additions is as follows:
Finally we need to add some textual information to the package. There are two built in attributes which we can access via placing TEXT fields containing >NAME on the tNames layer and >VALUE on the tValues layer. Setting the grid to 1.27mm allows us to place the >NAME and >VALUE text nicely above and below the package body on their respective layers.
CHANGE LAYER tNames; TEXT '>NAME'
Then click to place it at the top.
CHANGE LAYER tValues; TEXT '>VALUE'
Again click to place this at the bottom.
After you've done this you should have the following:
4. The Completed Package Drawing
The result of everything above enables the creation of a footprint with relative ease. The video below shows how long it took me to create a complete and accurate package for a TSSOP-36 footprint as used by a Texas Instruments MSP430F22x2 microcontroller. In the video, to help clarity and to show what is being done, I don't use any keyboard shortcuts or ULP to accelerate anything and as a result this package takes longer to create than it would when using shortcuts and ULP. I'll cover how to speed the process up even further using these methods in a future blog article.
This concludes the first part of my new EAGLE tutorial series. Let me know what you think in the comments below and if you have any questions please feel free to ask!