h1

Crazy-accurate PCB stencils via Silhouette Cameo

2013/04/05

Wow, I haven’t posted anything here in way too long.  This might help.

Right now I’m working on getting accurate PCB stencils out of my Silhouette Cameo desktop cutter.  People have been doing this for a while now, but they’ve been plagued by various complications with the data workflow and physical cutter settings.  The process involved transforming your artwork through several formats, importing into a proprietary application (you can buy SVG support for $50…), and hoping you have everything set right.

My initial work on the process was to change the data flow, allowing me to work from Gerbers rather than exporting a different format from Eagle.  It was a cumbersome process that involved using gerbv to write SVG files, then loading those into Inkscape in order to save them out as “R14” DXF, then switching over to my Windows VM to import the file into Silhouette Studio, dragging it to the right spot, and then cutting.  This at least allowed me the possibility of cutting an entire panel as generated by gerbmerge, but took waaay too long.

Now, I’m well on my way to having a radically superior process in place.  First off, I found that there are several projects capable of talking to the Graphtec engine that the Cameo is based on.  These gave me the foundation to write my own simple code to control the cutter, although there are still a lot of “magic commands” that need to be figured out the hard way (I’ll have to set up USB sniffing and exercise Studio a fair bit to figure them out, if I care).  That got me a Python script that could cut whatever I wanted programmatically.

The next step was to try to clean up the physical results.  Ever since I started cutting stencils, I’ve been plagued with strange shapes instead of nice rectilinear openings.  Well, this turns out to be a function of the design of the Cameo blade.  Inside the cutter is a vertical shaft with a very small triangular knife blade that spins freely.  The shaft is centered on the nominal X,Y of the cutter head, but the tip of the blade is not.  It drags roughly 0.5mm behind the center of the shaft.

This means that when you make a hard corner with the cutter head, the blade will not make the same corner.  As the center of the head (black) makes the sharp corner, the knife (red) lags behind and eventually ends up where the head wants it.  The result is a shape that roughly approximates the original, but only mostly.  Even worse, because the blade never actually reaches the start point, it leaves a little un-cut corner.

Cameo drag cutter     Not square!

My initial thought was to basically over-shoot the corner, then come back to the target line.  A simple method uses a single angled return path, but really it should be an arc of the same radius as the blade lag.

Initial compensation attempt

That mostly worked, but then I ran into another problem with blade-dragging: the blade drops with whatever rotation it had for its previous cut.

Drop misalign

In this case you can see that the blade was aligned from a previous upward cut when it dropped, then slowly made its way towards the right cut it was supposed to make.  The solution I came up with was to do a “pre-cut” off to the side before any lines of a given angle.  This leaves the blade pre-set at the right angle to make sure the beginning of the cut is straight.

The final trick was to cut each line in half, and actually force the blade to make two cuts starting from the center towards each end.  This avoids any question of exactly where the blade drops at the corners, and leaves and overshoot at every corner.  At least for rectilinear openings (all I care about just for now), this results in a perfect opening:

The Fifth Millimeter

That’s a millimeter ruler up against an 0.2mm square hole.  Not only is it nearly perfect (to the limit of my ability to actually see the thing!), but it lifted clear of the adhesive cutting mat exactly as you see: the fragment was 100% detached from the sheet.

At this point I’ve got a minimal codebase that reads actual stencil data, albeit the long way around: gerber -> gerbv -> Postscript -> pstoedit -> .pic(troff) -> myscript.  I’m hoping to fix that in the long run by reading Gerbers directly.

I have all sorts of transform functions in place to allow me to implement these techniques then send the resulting cut paths to the hardware.  I’m still tweaking a few things (I don’t have the cut-from-center trick written yet, but I do have a “repeat last line” to make 5 cuts around a rectangle) and getting period odd results (my last test left every single fragment still attached well enough to peel off with the main sheet…), but it won’t be long before I can take a Gerber file straight from Eagle CAM and generate a nearly perfect stencil on my $300 cutter!

Advertisements

9 comments

  1. Great! Work.

    What would be the cost to create a stencil once you have perfected your solution?

    Right now we can get nice laser cut stencils for under $200 dollars.

    Date: Fri, 5 Apr 2013 19:28:29 +0000 To: escobedomoises@hotmail.com


    • If I can get things working solidly, I’m thinking of doing a stencil service to go along with OSHPark’s PCB service. I know he was looking into doing it himself, but that was months ago and I don’t think he went beyond driving the cutter with the stock software.

      I’m thinking something like $1 postage&handling and $1/sqin not counting a ~1″ ‘frame’ around the design. I haven’t done any research to know if that’s reasonable from my point of view yet, but I would expect it’s not far off the mark.

      The difference between these stencils and laser-cut stencils won’t be much at all unless you’re talking about metal stencils. See the picture at the top of the second link. These are cheap Mylar film and so they won’t likely hold up very long. Then again for the prices above, that’s ideal for prototyping anyway.


  2. Looks like it already happened. oshstencils.com They’ve got some great pricing and work with OSH Park already.


    • Yup, and at their prices there’s no reason for me to try to set up anything large-scale. At some point I still want to finish working on the code for other people to use, however. oshstencils.com uses laser-cut kaptop, which is theoretically better anyway.


  3. Did you ever get your software working happily? I’m going to order a Silhouette for our lab anyhow for other things, and would love to try your toolchain on it for stencil cutting. Is there a repo somewhere I could contribute to?


    • It’s “working” but never did give me quite the results I was after. It’s rather a mess of code right now, but I can definitely send you what I’ve got and answer any questions you have about how it’s structured. ATM I don’t have the time to continue development on it ;-(


  4. Sounds awesome. Can you share more of what you’ve built? You should start a tip jar :)


  5. Peter Monta’s gerb2graphtec software does what you want – produces great stencil output on the Graphtec Cameo cutters from gerber file input:

    https://github.com/pmonta/gerber2graphtec

    Here’s an article I wrote about it – I use it to cut SMT stencils, they work great:

    http://adamfeuer.com/notes/2013/08/06/building-an-orone-mini-part-2-solder-paste-stencils-using-gerber2graphtec/


  6. I know you said you don’t have the time to continue development on this project, but do you now? I would be willing to pay you for your time as some extra incentive if you’re interested! shoot me an email and we can talk details. Thanks
    makeller1@utexas.edu



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: