Topics

Guide pins on smd solder mask.. #pcbgcode

peterg1000
 

In order to properly locate a stencil over an etched circuit board I have placed circular smd pads at appropriate places on the board.  Holes to accommodate guide pins are placed centrally on this pad.  When the matching stencil is generated it is  square and slightly larger than the original smd pad.  Two questions arise, firstly - is it possible to generate circular holes in a stencil, and secondly - is the oversize intended?

After a lot of checking it would seem that in the case of my circular pad, the final hole ends up half a tool diameter larger than the original pad size.  Viewing the cutouts for other devices on the board, they would appear to be similarly oversized as well.

For example I placed an smd pad 0.05" diameter on the circuit board and the coordinates on the stencil for the sides of the matching square hole Gcode turn out to be 0.04413 in length.  With a tool diameter of 0.01182" (3mm ) I would have expected this to be 0.050" -  0.01182" (i.e.0.03818" ).  Curiously enough this is almost exactly half a tool diameter smaller than the actual value. Is this intended, an error in calculation or just co-incidence ?

Peter Harrison

John Johnson
 

If I follow your question: pcb-gcode doesn't do any tool offset for tool diameter (other than when creating track isolation/etch files). If there is a line to be cut in the milling layer, the center of the tool will follow that line. One workaround is to create lines on the milling layer that are offset when you lay them down. The easiest way is to set the line width to the tool diameter, and use that as a guide.
It might be possible to create custom components based on the ones you have, with any cutouts offset to compensate for tool diameter.


Regards,
John

On 31 Jul 2020, at 5:46, peterg1000 via groups.io wrote:

In order to properly locate a stencil over an etched circuit board I have placed circular smd pads at appropriate places on the board.  Holes to accommodate guide pins are placed centrally on this pad.  When the matching stencil is generated it is  square and slightly larger than the original smd pad.  Two questions arise, firstly - is it possible to generate circular holes in a stencil, and secondly - is the oversize intended?

After a lot of checking it would seem that in the case of my circular pad, the final hole ends up half a tool diameter larger than the original pad size.  Viewing the cutouts for other devices on the board, they would appear to be similarly oversized as well.

For example I placed an smd pad 0.05" diameter on the circuit board and the coordinates on the stencil for the sides of the matching square hole Gcode turn out to be 0.04413 in length.  With a tool diameter of 0.01182" (3mm ) I would have expected this to be 0.050" -  0.01182" (i.e.0.03818" ).  Curiously enough this is almost exactly half a tool diameter smaller than the actual value. Is this intended, an error in calculation or just co-incidence ?

Peter Harrison

peterg1000
 

Hi John

Thanks for your reply - and your comments about milling the outline.  I have for some time been doing just what you suggested and
place the milling paths half the tool diameter outside the dimension lines.

You did however set me thinking about the calcs needed to create the stencil tool paths.  After a lot of searching I found an
isolated rectangular pad which was part of library footprint and extracted the co-ordinates of the corners as defined in a .brd
file using that library part and the associated tool path from the stencil file. I've analysed the situation below.

The chosen pad has dimensions (x,y) of 2.5mm by 3mm as defined in the "smd name" in the library file - this same information is
also present in the associated Eagle ".brd" file.  The coordinates of the corners of the smd pad as defined in the board file are
as follows:-

Upper right   X39.6691 Y5.5259
Lower right   X39.6691 Y2.5259
Upper left    X37.1691 Y5.5259
Lower left    X37.1691 y2.5259

Having run "pcb-gcode"  with a tool diameter of 0.3mm declared I checked the gcode produced in the "stencil.txt" file.

G00 Z2.0000
G00 X39.5941 Y5.4509
G01 Z-0.1250 F250.00
G01 X39.5941 Y2.6009 F500.00
G01 X37.2441 Y2.6009
G01 X37.2441 Y5.4509
G01 X39.5941 Y5.4509
G01 X39.5941 Y2.6009
G00 Z2.0000

This shows the calculated tool path to lie inside the smd pad corners, and the differences are equal to (tool diam)/4. This means
that the actual stencil size is correctly centred, but larger, in the above case, by 0.075mm in each dimension (0.3mmtool).
Using an smd pad for a location pin for a stencil produced as above would allow a potential error of +-0.25 x tool diameter.

Was this discrepancy intended, because I would much prefer the sizes to match exactly so as to minimise registration errors. Can
the calcs be easily modified to modify the stencil tool path to be 0.5 x tool diam inside the smd outline?

Sorry this is rather long winded but when dealing with the smallest smd components every fraction of a mm counts!!

Regards,
Peter.

Jerry Lee Marcel
 

On Mon, Aug 3, 2020 at 11:00 PM, peterg1000 wrote:
This shows the calculated tool path to lie inside the smd pad corners, and the differences are equal to (tool diam)/4. This means
that the actual stencil size is correctly centred, but larger, in the above case, by 0.075mm in each dimension (0.3mmtool).
I'm not proficient at pcbgcode, so maybe that won't be relevant, but, with the dxf-to-G-code converters I use, there is the choice between outside, inside or on-the-line.

peterg1000
 

Finally I have tracked down the code in "pcb-gcode.ulp" that does the calculations for tool diameter compensation.  Note that tool diameter ends up being divided by 4  in hx and hy !!!!! Hence my problem. 

                        // Tool size compensation
                        dx -= tool_dia / 2; dy -= tool_dia / 2;                                      // My note  - divided by 2

                        // Carve out the pad
                        if (dx > 0 && dy > 0) {
                            int hx = dx / 2, hy = dy / 2;                                                //My note - divided  by ANOTHER 2 !!!!

I think if the last line is modified to be :-

                           int hx = dx , hy = dy 

then the resulting smd stencil cutout will be exactly as defined in Eagle.

peterg1000
 
Edited

I tested the change described in my previous post and to my surprise the stencil cutouts were MUCH larger - I clearly haven't understood the software very well !!

Fortunately the following change DOES work and stencil sizes are exactly as defined by the Eagle footprint.

                        // Tool size compensation - modified 06/08/20 to correct compensation calculations
                        dx -= tool_dia ; dy -= tool_dia ;   //    Division by 2 removed

                        // Carve out the pad
                        if (dx > 0 && dy > 0) {
                            int hx = dx / 2 , hy = dy / 2 ;

Peter