While sometimes quick and dirty works fine for footprints, if you ever have to deal with enclosures or particularly dense boards, you'll soon find out that accurate footprints can make your life much easier.

There are some really nice, detailed and accurate footprints in the default Eagle libraries, but there aren't a lot of resources out there on how to create them.  This guide will hopefully serve that purpose, highlighting what works for me making connectors and similar types of footprints.

What You'll Need

  1. Cadsoft Eagle
  2. An accurate mechanical diagram of the part in question
  3. A decent image editing program (Gimp, paint.net, Photoshop, etc.)
In order to make an accurate footprint, you need a mechanically accurate reference image.  Thankfully, most datasheets contain accurate mechanical drawings for at least the top and side view, which is enough in our case to produce an accurate 2D outline of the part.

As an example, we'll be working with the following image from a datasheet for a surface-mount push-push micro-SD connector:
Once you've located an accurate top view of your part, you need to get a decent-sized copy of the image into your favorite photo editing program.  With most PDFs you can just zoom in on the PDF so the image area in question is full screen, take a screenshot and then paste this image into your image editor, removing everything except the top view (you might need to use a white paint-brush for example):
It's important to have measurements in the image at first since we'll need these to create a properly scaled image.  In this particular image, the connector is 14mm across the X axis.  Using this number, we'll measure the actual width of the image in pixel across the X axis, which turns out to be 643 pixels from one edge to the other.
The way you do this changes in different editors, but often you can use the rectangular selection tool and see how many pixels wide/tall your selection is.
Since we now know that the bitmap image is 643 pixels wide for a real-life width of 14mm, it's easy to figure out how to scale the image to a useful size.  Simply divide the mechanical part width in mm*100 by the actual image width of the same segment.  In this case (14mm*100) / 643 pixels = 2.177.

Resize your image using this ratio.  The total image above is 1047 pixels wide, so 1047*2.177 = 2279 pixels wide.  Once resized, you need to convert the image to a 1-bit bitmap image and save is somewhere.  (As a sanity check before saying, this conversion should give you ~1400 pixels across the 14mm section for 1 pixel = 0.01mm).

Again, the way you do this will change from one image editing program to the next, but any decent image editor should support this.  You should end up with a bitmap image like this:
Save this 1-bit Windows bitmap (.bmp) image somewhere memorable, and open up Eagle.
Once you're inside Eagle, create a new 'Package' and give it an appropriate name (Library > Package ...).  From here, you need to run the 'import-bmp.ulp' user language program.  The quickest way is tp simply type the following command anywhere in the package editor:
run import-bmp.ulp
Once you run the ULP you should be presented with the following dialogue box, which you can click OK on to continue:
You'll be asked to select your source bitmap image, and you need to point to the 1-bit BMP you created earlier:
Next, you'll be presented with a box showing all of the colors available in the image.  Select the 'white' pixel box, and click OK:
The most important step is in the following dialogue, where you need to change two values:

  • Set the 'Unit' radio box to 'mm'
  • Set the 'Scale' factor to 0.01mm, the same scale we used when resizing our bitmap image earlier (remember mm*100?).
Click the OK button, which will present the following screen, and then click the Run script button.
This should give you something similar to the results below with the imported bitmap placed on layer 200 (the default value, but it can be changed in the import settings dialogue box above):
With all of the done, we can start making our footprint
The most labour intensive part is here, since you need to trace the image out on an appropriate layer (I use layer 51 for this kind of information, but some people may prefer layer 21 for certain parts).

There's no real shortcut (that I've found) to just zooming in and starting to trace the image out using the different variations of the line tool to draw angles, arcs, etc., where appropriate.  Obviously the level of detail you need will vary, but at the very least be sure to create an accurate mechanical outline of the outer-most borders since those are the most important.
Set the line width to something appropriately 'fine' like 0.05mm or 0.1mm for fine-pitch details.
A lot of the outline can be done with the line options (curves, angles, etc.):
Some more complex angles, however, may need to drawn as straight line segments, and then you'll need to do a bit of guesswork with the curve option, which you can see by right-clicking on a line segment and clicking 'properties' in the popup dialogue box:
After about 25 minutes of work (again the level of detail you need or want depends on how severe your OCD is), you should end up with something similar to this:
Next you need to delete all the garbage left over on layer 200 (or whatever you selected during import) to only leave your outline ... importing bitmaps is incredibly wasteful since there are hundreds and hundreds of lines versus a couple dozen for even a reasonably complex part traced during this method.

Go into your 'Display' options by clicking the display icon the the top-left corner (three filled squares) and disabling layer 51 (or 21 if you used that) as follows:
Click OK, and then select everything on the screen using the 'Group' tool (dotted rectangle):
Then select the 'Delete' tool (an X), right click on your group and select 'delete group':
Now if you go back and turn layer 51 back on, you should see only a reasonably efficient part outline (in terms of data stored in the library) that is a very close approximation of the part in question.  Now you simply need to add in your pads as you would for any other footprint, save the part, and you'll have a far better sense of the mechanical boundaries of your parts and connectors.
One of the biggest advantages of the extra effort put into creating detailed footprints is that you can disable every layer on your PCB except layer 51 and the dimension layer, and save the results as a PDF. This gives you a highly detailed, and very accurate board outline for technical illustrations, documentation, etc.

OK, nice outline .. but what about the pads?

The actual pads for your part should still be defined solely from the footprint suggestions in the datasheet, and not based on the graphical outline used here since this is only a graphical representation and may have some segments exaggerated for illustration purposes.  Be sure to follow the datasheet exactly to place the pads, based on numerical entry for size and position, and then align the part outline created above as accurately as possible over the pads.
There's a good hours work in making an accurate footprint like this once you get the hang of it, but the effort will pay for itself later on during documentation, layout, and just that warm fuzzy feeling when you show your files to someone and get that inevitable 'wow ... are you taking your medication, cause that footprint is nuts!'

Aside from great looking documentation, though, the biggest benefits really are on the mechanical side.  Need to know exactly how to align part of an enclosure to a button or a trimpot?  The extra hour you spent making that footprint will seem like time well spent when you can quickly determine with excellent accuracy where the screw head on the SMT trimpot is!

This guide was first published on Sep 14, 2012. It was last updated on Sep 14, 2012.