Wednesday, June 20, 2018

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

(Advanced warning: If you don't use Eagle for schematic/PCB/gerber creation, this post will mean zilch....You have been warned....)

 I bought some dual concentric pots from Small Bear and needed it in the PCB for a few projects.  I couldn't believe I couldn't find an existing library (Alps?  Bourns? Adafruit?  Anyone?) that already had this part--this is super simple, just an array of 100 mil traces with proper spacing and some kind of tName silkscreening that works….but I couldn't.  Time to roll my own....

To summarize the very basics: Eagle libraries have all different components and variations that all have to be created and linked properly to work in a useful library that you can use in your designs.

Screw it up?  The part won't work, or worse yet, when you get your PCB back it will be butt because your custom part is butt.

So you have to know all of this.

First some Eagle terms--they could have called all of these things anything, but this is what they chose to call them:

  • Library: a set of devices.
  • Device: the entire component--the IC, header, switch, whatever; a joining of a Footprint and Symbol 
  • Footprint: the representation of the component that goes on your PCB. Pads/drills etc. must be right or your part won't lay onto the PCB correctly after you fab. Just to make this confusing, I have also seen this called a "package", not to be confused with a 3D package.
  • 3D package: So you can make sure your part fit in your stompbox or whatever.  I am not going to talk about 3D packages at all here.
  • Symbol: the representation of the component that goes on your schematic.

There are already many web resources about creating and editing Eagle libraries and devices; I won't go into it all of it here. Here is a good webpage link; here is a good vid. But I figure it might be worthwhile to mention what I got stuck on, what I seemed to be able to do (and not) maybe it will help you, or maybe it will help me in 4 months when I forget all of this.

OK let's start with the basics: editing any damn thing 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).

Assuming you're modifying library content that came with Eagle--it's often easier to modify something vs. starting from scratch--you have to make a copy of the source .lbr file and copy it somewhere else. Then point your Eagle prefenences to the new library location. Only then can you edit the library.

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

Note: I got somewhat confused when I read that you "import" Eagle libraries--OK, but how?  Where is the import button?  There isn't one. What web tutorials really mean is just copy the damn library somewhere else--then you can edit it.

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

For windows 10 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. Now you can edit the latter.

You knew that right?

For other OS's?  No idea. I am pretty good with Linux and Mac as well, but have never gotten round to using Eagle in either. Sorry.

What order do I need to do to make this work?

There are lots of ways to make this work, since there are lots of things you can do surrounding libraries:

  • You can duplicate an existing device, symbol, or package, then edit it to change it.
  • You can create alternate footprints for a single device (so you can, for instance, choose between a SMD version of an IC or a DIP version)
  • You can add new devices to an existing library.
  • You can create a new library from scratch and add new devices that you create from scratch
  • You can create managed libraries that allow other users to edit whatever devices you are using.

The most common thing I find myself doing is to 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 that live in their default locations, but by now you already know that.

For v. 9.5.1 and earlier (hopefully later as well, but Eagle has been known to move around the furniture) you see a screen with 4 sections: Device, footprint, 3D package, and symbol:

First thing I always do is duplicate whatever I want to work on.

So right click on the device (if that's what you want to edit) and say "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), in the same manner, same thing with a footprint: Right click > Duplicate.

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

Good news: editing footprints and symbols is the same as editing schematics and boards--it's all the same tools. So if you know how to edit those, you are a long way to creating custom parts already.

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 might feel stupid and angry.

DEVICE MANIA: Devices editing--again that's where you join a package and symbol and how everything connects--is done using a UI you've not seen before--editing a device is not like editing a schematic ("footprint") or a symbol ("board"); it's its own strange thing.

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

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

The device edit UI is a bit painful, but i always get stuck on the same thing: I have edited a devices and a footprint, and then connected things up with the CONNECT button, but once it's time to use it, the new device doesn't recognize a given new footprint.

When I go to test out the new device, my new footprint doesn't show up, it's only the original one.

How do I make the device recognize the new footprint?

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.  Poof!  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 too, right?
  • 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 GOTCHA: Where is "ground zero" for your symbol or 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. 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:

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 Schem and board, wire it up, 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. Or maybe even an old one. Especially ones you download from some unknown source.

I have seen devices and LBRs I have downloaded that have all sorts 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 looks reasonable, the drills are big enough, the name is showing correctly, and so on.


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

Again I am created a new device for a dual 9mm concentric pot. I followed all the instructions above,
I did a quick layout for 3 concentric pots spaced 850 mils apart.

You can find the files for this  PCB on my website. The result--yep it worked. I can see a lot of uses for this going forward.

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.  If an Eagle flies over, don't look up, because them turds are big ones.  Have fun!

No comments:

Post a Comment

Analog Devices 5254: Quad Pot IC--Arduino Controlled--How to Make this Go!

Hello again!! This is a continuation of the post started here --way back in April 2019--working on modding a Lunetta Noise! Oscillator cir...