SMD Stencil Creation
1 Required Software
I am using Ubuntu but I am sure those or similar packages are also available in other distros/package managers:
- Eagle (free edition is enough)
- Python version 2.4 or later
apt-get install python
- SimpleParse version 2.1.0 or later
apt-get install python-simpleparse
- gerbmerge 1.8 or higher
- gerbv (a Gerber File Viewer)
apt-get install gerbv
We created our own fork of gerbmerge that adds some SMD stencil related features:
https://github.com/apertus-open-source-cinema/gerbmerge
2 Introduction
We want to fill an SMD stencil with as many PCBs to make optimal use of the space.
The top and bottom cream layers together with the board outlines are exported through Eagle as CAM job and then processed with gerbmerge and manual absolute placement to create one combined gerber file that can be sent to an SMD stencil manufacturer.
3 External Manuals & References
http://www.gedasymbols.org/user/stefan_tauner/tools/gerbmerge/doc/index.html
4 1. Export Gerber Files from Eagle
Eagle CAM Job to create required gerber files (plus a few others that we don't need for the stencils):
File:OSHPark-4layer silk.zip File:OSHPark-4layer silk.cam.xz
Note: Make sure the bottom cream side has the "mirror" checkbox checked when running the job.
The three essential files/layers we need are:
- Cream Top (*.tcream.ger)
- Cream Bottom (*.bcream.ger)
- Board Outline (*.boardoutline.ger)
5 2. Create gerbmerg configuration files
We want to merge 3 gerber files here for demonstration purposes (later we want to fill one stencil with as many boards as possible to not waste space): The general stencil frame with holes for fixing the stencil with screws and one PCB with top and bottom sides.
create an empty file called empty (gerbmerge requires a drill file or will throw an error - but is happy with an empty one)
create job.cfg with the following content (file names are left in for demonstration purpose):
[DEFAULT] projdir = . [Options] AllowMissingLayers = 1 PanelWidth = 12.9 PanelHeight = 18.5 [DummyTop] BoardOutline=axiom_beta_interface_dummy_v0.12.dimensions.ger Drills=empty *topcopper=axiom_beta_interface_dummy_v0.12.tcream.ger [DummyBottom] BoardOutline=axiom_beta_interface_dummy_v0.12.dimensions.ger Drills=empty *topcopper=axiom_beta_interface_dummy_v0.12.bcream.ger [StencilTemplate] BoardOutline=stencil02.gtp Drills=empty *topcopper=stencil02.gtp
Create a file called stencilplacement.txt with the following content:
StencilTemplate 0.500 0.500 DummyBottom 5.000 2.000 DummyTop 2.000 2.000
For rotating certain boards use a syntax like this:
StencilTemplate*rotated 0.500 0.500 DummyBottom*rotated90 5.000 2.000 DummyTop*rotated180 2.000 2.000 DummyTop2*rotated270 2.000 2.000
Our gerbmerge fork also takes additional parameters together with the coordinates:
To define the origin of each board:
X Axis:
l = left c = center r = right
Y Axis:
b = bottom c = center t = top
Another letter can follow to define the relative position from the panel:
X Axis:
L = left C = center R = right
l = left obeying insets c = left obeying insets r = left obeying insets
So for example this line places the board exactly in the center of the panel:
board 0cC 0cC
</nowiki>
The gerbmerge automatically creates boundary rectangles of each board to simplificy placement. As the StencilTemplate has no BoardOutline the first hole on it will be moved right at the original of the output gerber file so we have to manually offset the stencil template by half an inch in X and Y axis.
5.1 3. Run gerbmerg and Inspect the results in gerbv
python gerbmerge.py --place-file=stencilplacement.txt job.cfg
gerbmerge will ask you to agree to its warranty notice and output a few lines with board dimensions and the output files it created.
For our config:
../gerbmerge.git/gerbmerge/gerbmerge.py -s --no-trim-gerber --place-file=placement_0001.txt job_0001.cfg
Look at the resulting files in the gerber file viewer gerbv:
merged.topcopper.ger merged.boardoutline.ger