Wednesday, June 20, 2018

Creating a New Device in an Eagle Library--9mm Pot

(Advanced warning: If you don't use Eagle CAD as your EDA (Electronic Design Automation--schematic capture/PCB/gerber creation), this post will mean nothing...skip it! You have been warned....

I bought some dual concentric pots from Small Bear Electronics and needed it in the PCB for a few projects. I couldn't find an existing Eagle library (Alps?  Bourns? Adafruit?  Anyone?) that already had this part--it's simple, an array of 100 mil traces and PCB silkscreening and a component I use all the time in my designs.

Time to create my own....

Eagle libraries provide us with "devices": electronic components represented in software ready to use. Right out of the box, Eagle provides most of the devices you'll need: passives, semiconductors, integrated circuits, thru-hole as well as SMD footprints, and so on.

The purpose of this post is to help you (well, me, really) remember how to create these custom parts for things that don't come with the software, and cannot be easily found online.

"Let's get started"

First: some Eagle terms--the original designers of Eagle could have called these things, but this is what they chose to call them.
  • Library: a set of devices.  In Eagle on Windows these are .lbr files.
  • Device: the entire component--the IC, header, switch, whatever; ready to use in your layout.
  • Footprint: the representation of the component that goes on your PCB. So-Pads/drills/silkscreening and so on. Just to make this confusing, Eagle's UX also calls a footprint a "Package".  Arrg!!  In some cases, you will see both terms used in a single window!  C'mon, man!
  • "Footprint" is used in the software's UX more often, so that's what I will use in this post.
  • Symbol: the representation of the component as it will be shown on your schematic.
  • 3D package: 3D graphics that represent your device--use 3D to make sure your part fit in your stompbox or whatever. I am not going to talk about 3D packages in this post.
There are many web resources about creating and editing Eagle libraries and devices; for example, this webpage link; here is a good video.  Another blogger's entry, based on older versions of Eagle is here.  

OK let's start with the basics: editing any damn device in Eagle at all.....

Why can't I edit a @$%^ library?  And I do mean @$%(#@$

The libraries that come with Eagle are "read only". You knew that right? (I didn't).  It's in the docs right?  Kinda, sorta, yeh, but.....not easy to find. Nice! Okay....

You have to make a copy of the source .lbr file or the device you want to modify and copy it somewhere else first. Only then can you edit the library or new device.

It's described here and here--yes, you have to do all this. 

I got confused when I read that you "import" Eagle libraries to get them to a new location--OK, but how?  Where is the import button?  There isn't one. 

Copy the library somewhere else--then you can file > open > library to open the library in its new location to edit it.

OK fine, but, Where are the %#@&$^ libraries that come with Eagle?

For Windows 10, as of the date/time I originally wrote this post, they are here:

C:\Users\[username]\AppData\Roaming\Eagle\lbr. You may have to enable hidden files and folders in Windows to see this at all. Search for the library you want in there and create the copy somewhere else.  

You knew that right?

For other OS's?  No idea. I am pretty good with Linux and Mac but have never gotten round to using Eagle in either. If you know comment below.

Once copied, there are lots of things you can edit with your libraries:

  • You can duplicate an existing device, symbol, or package, then edit it.
  • You can create alternate packages for a single device (so you can, for instance, choose between a SMD version of an IC or a PDIP version, when only PDIP was available before you edited the device)
  • You can add new devices to an existing library.
  • You can copy a device from an existing library to a new one you create.
  • You can create managed libraries that allow other users to edit whatever devices you are using.
  • Lots more things....
I commonly edit an existing library to change a device, footprint, and/or symbol. That's what I will cover here.

OK, first, you open libraries in Eagle same as you'd open anything else--from the "Eagle Control panel"--the small window you see when you first open the program--File > open > Library

Choose the Library you want to edit. Can't edit?  See above--you can't edit the default Eagle libraries so copy the library or device somewhere else, but hey--you already know that.

For v. 9.5.1 and earlier (hopefully later as well) you see a screen with 5 sections: Device, footprint, 3D package, and symbol:

First thing I always do is find something that's close in look and feel to the new device I need to create, then duplicate the original.

So right click on the device and left click on "Duplicate". Call the new device something unique, say


You can duplicate a symbol (using the add symbol icon from the left column or the command below), or footprint in the same manner: Right click > Duplicate.

Then right click on the new item and left click on EDIT.

Good news: after making a copy, editing footprints and symbols is pretty much the same as editing schematics and boards. If you know how to edit schems and boards in Eagle, you are a long way to creating custom parts.  

However, when working with libraries, there are a few special icons you need to know about:

These three icons are used to edit devices, footprints, and symbols respectively.  

How do you add a pin to a symbol? A "pin" is where a trace will be connected to the component. To create one of those, edit your symbol then click this icon: 

Use the icon circled in blue to create a PIN.  You knew this too right?

And--of course--make sure to always save your work after editing.  A library is saved the same as any other object in Eagle. If you forget to save, well, you will lose your work and feel stupid.

DEVICE MANIA: "Devices"--that's where you join a package and symbol and how everything connects--it uses a UI you've not seen elsewhere in Eagle; its own strange thing.

You can resize the different elements of this view, click on the vertical or horizonal lines and wait for the double headed arrow, then expand or contract....

In the screenshot above, The FOOTPRINT is in the top left, it's this thingy:

 The SYMBOL is to the right of it that, looks like this:

CONNECTING IT UP: The "device" UX is a bit painful, but even after using Eagle for years, I still get stuck on the same thing: I have edited a device and its footprints, but when I go to test out the new device, my new package/footprint doesn't show up, it's the original one, or the wrong one.

How do I make the device recognize the footprint/package I want?

here's how:

  • Click on group, left click and lasso the FOOTPRINT you want to get rid of, click on DELETE (garbage can icon) then delete the group. The old footprint is gone!
  • Now go to Edit > add and  Add the new footprint. When you edit > add in this context the UI shows you any footprints you have for the device including new/duplicated ones. You knew that already, right?  THIS ONE GETS ME EVERY TIME! Remember that adding a footprint (aka "Package") is like adding a component to a schematic:  EDIT > ADD.  The other elements in library management are not like this as far as I can tell!
  • Another way to do the same thing: in the new device, click on the "NEW" pull down in the lower right.  Select "ADD LOCAL PACKAGE" from the drop down and create a new "package variant" for your new footprint.   
ANOTHER "DEVICE" GOTCHA: Where is "ground zero" for your symbol or package/footprint? If you look at the editor for these, on the blank canvas, you will find a plus sign.  Move your creation so it's close by the + symbol.  That's where you grab your part to move it around once it's done. Took me a bit to figure that one out.

OK once all of that is sorted, you need to make sure things are CONNECTED correctly.  Click the CONNECT button in the device UI:

This allows you to connect your symbol's pins to the footprint's pads. 

The process of connecting symbols to footprints is pretty straightforward although obviously you can make mistakes. So always test your component before using it in production--for instance, for a resistor array create a new Schematic and board, wire it up, print it out, and see if it makes sense.


When editing a device, you can also use command line commands for this:

Create your new device and then issue this command:

ADD [packagename] and the package pops into the device, ready to connect.


ADD [symbolname]

CONNECT and then make sure you connections look OK.

After having used Eagle for a few years I have learned the hard way: NEVER TRUST A NEW DEVICE YOU GET ONLINE. Or maybe never even an old one that came with Eagle. 

Especially ones you download from some unknown source.

Update: to remind myself of this, I just got a PCB back with a  stock 74HC595 from the Eagle 74xx library. Shift register--really common CMOS part right? Sorry the device for the 74HC595 was completely butt (for non US-English speakers "butt" in this context means "totally useless"--pins labeled wrong. Device laid out incorrectly. the entire board is useless. Throw it in the dust bin!!!!)

I have seen devices and LBRs I have downloaded with all manner of stupid mistakes: unwired pins, footprints that don't match the part at all, footprints that don't have enough pins, symbols that are upside down, etc.

I usually print out the PCB 1:1 before sending off to fab and make sure any new device I am incorporating, that I've not used before, looks reasonable, the drills are big enough, the name is showing correctly, and so on.

One more trick: to use a new library, you can click on Library > use but it won't be visible. You have to close and reopen Eagle sometimes to see your new parts.


….with all of the blah blah ginger blah blah in hand it's time to do a Proof of concept board.

Again I am creating a new device for a dual 9mm concentric pot. I followed all the instructions above,
so I did a quick layout for 3 concentric pots spaced 850 mils apart. I watched the vids I mentioned, reread my own notes, and poof--new device.

You can find the files for this  PCB on my website. I've now used this pot on a few PCBs, the result--yep it worked.

Now what?

You can get the clone pot library from my GITHUB page.  As always if you find mistakes, have problems, etc. please let me know and I'll fix it.

OK that's it for today. Comment below if you need an Eagle device I use in a design but you can't find, I should be able to help you out. Eagle allows exporting all libraries for a given design into a single new lbr file, so sharing libraries is pretty easy.

Or maybe you have some cool ones or a nice LBR file you want to share.

And (literally) above all: if an Eagle flies over, don't look up, because them Eagle turds are big ones.

Have fun!

No comments:

Post a Comment

Bluetooth Bench Mixer

Readers: If you want to build the project featured in today's post, please go to PCBWAY's Community pages--gerber files (front panel...