Nov 032013
 

Photo by flickr.com/cbrobotics

I’d like to share a neat Eagle hack for all our the people who have taken our Eagle CAD classes (myself included) and our Eagle-using friends.

BOM-EX is nifty little ULP (User Language Program) that extends the functionality of the built-in BOM ULP. BOM-EX not only helps you assemble a coherent BOM (Bill of Materials) right from your Eagle schematic, but it also makes it easy to assemble a database of parts, and associate those parts with parts numbers for DigiKey, Mouser, Newark, etc.

I made a nice little script that lets me build my BOM database without ever leaving the DigiKey website…

My usual process for selecting parts goes something like this:

1) Drop a part in the schematic.
2) Check to see if this part (in this size) exists, is available, is affordable, etc.
3) No? Keep looking.
4) When the project is done, go back and find every part again.
5) Assemble a BOM by hand, or spend time cleaning up the output from BOM.ulp.
6) Punch everything in to DigiKey, triple check to see what I forgot, etc.
7) Place the order, hope I didn’t forget anything, hope I ordered enough, etc.

BOM-EX makes things much simpler; I wish I has been using it from the start:

1) Find the part on DigiKey, etc.
2) Drop it into BOM-EX
3) When the project is done, export a BOM file that can be uploaded straight to DigiKey, Mouser, etc.
4) Order your parts with confidence!

But wait, how can we make this even simpler? How about populating our database straight from DigiKey?

First make sure you have BOM-EX set up. You can download the latest version of BOM-EX from Cadsoft’s webpage. Search for BOM-EX and download the latest version (bom-ex156 as of this writing). There’s a nice tutorial for setting it up here, and also a nice PDF included with BOM-EX itself.

Choose a location for your parts database file to live – it can be inside your Eagle project folder, but I recommend keeping it global, so you have an easy-to-reference library of common components for all your projects.

Next, download our Grab-Bag repository and find the python script in the Bom-ex folder. Open the script and change the PARTSDB path to point to where you keep your parts database file.

You can now add parts to your database file straight from the command line:
python addDKPartToBom-ex.py ATMEGA644A-AU-ND
will add the following line to your parts database file:
ATMEGA644A-AU Atmel DK ATMEGA644A-AU-ND IC MCU 8BIT 64KB FLASH 44TQFP 44-TQFP

Note: you may need to install the BeautifulSoup module for Python. You can install it with pip install beautifulsoup4 or easy_install beautifulsoup4. It’s also available as the python-beautifulsoup4 package in recent versions of Debian, Ubuntu, and Fedora, or you can download it from their website.

For extra coolness, drop addDKPartToBom-ex.py into /usr/local/bin (or anywhere else in your PATH, make it executable (chmod +x addDKPartToBom-ex.py), and now you can run it from anywhere.

But wait, there’s more! If you’re on a Mac, grab the Add Parts To Library.workflow file in the repository and double-click. Select Open With Automator

Screen Shot 2013-11-03 at 2.09.51 PM

If you followed the above instructions, you shouldn’t have to change anything, otherwise update the “Run Shell Script” box in Automator to reflect the correct location for your addDKPartToBom-ex.py script. Close Automator, double-click on the workflow again, and select Install.

Now, when you’re browsing the DigiKey website, just right click on the DigiKey part number, select Services, and select Add Part to Library

Screen Shot 2013-11-03 at 2.13.24 PM

Et Voilà, your parts are appended to your BOM-EX parts database, no manual entry required! Enjoy a few hours saved in BOM-hell on your next Eagle project. See this tutorial for more information on using BOM-EX.

Do you have any slick Eagle hacks? Share them in the comments!

 Posted by at 2:26 pm
  • Jon Fraser

    The python script wont work for me. I used your example of ATMEGA644A-AU-ND and it’s giving “none” for all values aside from that part number.

  • Paul Ryan

    @jon_fraser:disqus Looks like because digikey recently attempted to add some more Javascript which broke parsing you need to use the html5lib parser for this script. To do that get the parser with easy_install html5lib then change the line that reads soup = BeautifulSoup(data) to soup = BeautifulSoup(data, ‘html5lib’).

    Hope this helps.