Tools of the Trade #1

Posted by: Dave Vandenbout 9 years ago

(0 comments)

We all have 'em: tools that let us do things easier and faster. Some we buy, others we make. This is my first entry about one of my favorite tools: an Eagle ULP I wrote that lets me do cost estimates on boards I'm designing using real-time prices fetched from Digi-Key.

I've used Eagle for schematics and PCB layouts since it was in version 3.x. I've heard "serious" PCB designers laugh at Eagle, but it's always been a solid, low-cost performer for me. (As for serious PCB tools, I used a "professional" version of PADS back in the 90's and it had a bug where the autorouter would draw a trace at right angles across an entire bus, shorting them all out. I paid $500/year for maintenance, never received a single maintenance release over the course of several years, and this bug was never fixed. I guess professional == sucker.)

The Eagle feature that I really like is the ability to write your own ULPs (user language programs). ULPs use a C-like language with simplified access to the schematic and PCB data structures. I've written ULPs to do things like BGA fanout and step-and-repeat of sections of a PCB. But my most useful ULP addresses the most mundane of tasks: ordering parts for assembly.

Now, Eagle has always had a BOM (bill of materials) ULP. It generates a list of the unique components in a schematic while showing how many of each are needed. But there are no manufacturer part numbers in the list, much less the associated ordering codes for distributors like Digi-Key or Mouser. The BOM ULP does have a feature to use an external database to hold such information, or you could export the BOM to an Excel spreadsheet and key in the part numbers there. But databases and spreadsheets are not directly tied to the schematic, and they always get out of sync when you start changing the schematic. 

The need for an external database was eliminated when Eagle 5.x came out with generic attributes that could be attached to any item in a schematic or layout. Now you could attach to each part the name of the manufacturer, the manufacturer part number, and the ordering code for distributors like Mouser or Digi-Key. I modified the original BOM ULP so it could output an extended BOM that showed this information. An example screen from my BOM ULP is shown below.

By clicking on the Manf radio button and then clicking the View button, I can generate a text, HTML or CSV list of the part manufacturers, part numbers and needed quantities that I can send to a distributor like Arrow or Avnet. Even better, if I select the Digikey or Mouser buttons, I can get a part list that I can cut-and-paste directly into the BOM import fields on their websites. That means I can place an accurate order in seconds.

Even better, I implemented a real-time pricing function. By clicking the Prices button, the quantity-based pricing for all parts with Digi-Key part numbers are scraped from their web pages and displayed along with the total price for the whole board. That gives me an accurate assessment of the board price for varying sizes of a production run. (It isn't as easy to get this information from the Mouser website, so I can't do real-time Digi-Key/Mouser price comparisons, yet.)

But even a pretty girl can have warts and my BOM ULP is no exception: it's a real chore to enter the ordering codes for all the parts in your schematic. To assist with this, I wrote another ULP to copy the attributes from a single part across all identical parts. This really helps when I have a lot of decoupling capacitors in a design.

To save even more effort, I could also add these attributes directly to the parts in the library. But this won't work if it's a generic part like a resistor whose resistance value will affect it's part number. It also won't work for ICs that have multiple package options (for example, SOIC and TSSOP) since those also affect the part number. Perhaps there's something I can do using regular expressions, but I haven't found a method that works for all cases.

If you're an Eagle user and want to try this, I have a link to the archive of these ULPs below. And here's the manual page that gives more details about how to use it.

 

Currently unrated


Comments

  • There are currently no comments

New Comment

required
required (not published)
optional

Recent Posts

Archive

2016
2015
2014
2013
2012
2011

Categories

Authors

Feeds

RSS / Atom