Hello Guest it is March 06, 2021, 06:41:01 AM

Author Topic: Mach3 2-sided pcb milling. Centering with Y-axis width from G-code pattern.  (Read 1968 times)

0 Members and 1 Guest are viewing this topic.

Hi all. I've been using Mach3 with fantastic results for milling of one-sided printed circuit boards (PCB). Some near-success with 2-sided boards, but not quite there yet.
I'm not quite there with 2-sided pcbs due to 'slight' misalignment issues of the circuit patterns on the two sides of the board. I quote 'slight', since 0.3 mm misalignment could be considered as slight, or could be considered as huge by others.

I've done the best I can to try pin down the source of misalignment. But haven't found it yet. So just looking for recommendations to try, or hints from some people that have been down this path.

I have attached two associated G-code patterns, one for top of the board, and one for the bottom of the board. Due to the software I use to generate the G-code circuit patterns for the two sides of the board (using PCB-GCODE software), the origin for the g-code pattern for the top side of the board has the origin on the LOWER-LEFT, while the pattern for the bottom side of the board is on the UPPER-LEFT.

For both g-code patterns, the WIDTH of the job is 48.857mm, which is provided in the g-code pattern viewer. I use the mid-level of this y-axis width as the line of symmetry.

For my actual board, I drill alignment holes (for 3mm diameter metal dowels) at y = 35 mm and y = 99 mm. The distance between these holes is 64mm.
I also drill an extra small 1mm diameter alignment hole right at the mid-point, at Y = 67mm. This smaller hole is not drilled too deep into the waste-board, so that I can use a fine tipped marking pen to put red ink into that hole in the waste board. The idea is that if I flip the circuit-board over, then seeing a red dot (when I shine a light down that hole), then everything should be good.

When it comes time to use Mach3 to mill my circuit, I use the mid-level (Y=67mm) line .... half-way between the large alignment holes as my reference line. For my top-side PCB pattern, the y-axis width was mentioned to be 48.857mm. Half of this width is 24.4285mm. So, for top-side milling, I simply set my Y-axis milling origin for Mach3 milling to be at Y = 67mm - 24.4285mm = 42.5715mm.  This basically sets the origin of the top-side g-code pattern, which is inherently on the lower-left of the top-side circuit pattern (due to software).

For milling the other side of the board (ie. the bottom side), the milling origin is set to Y = 67mm - 24.4285mm = 91.4285mm, which is the upper-left side of the bottom-side circuit pattern.

So, the TWO origins that I set for each side of the board should theoretically or hypothetically allow the patterns on both sides of the board to be nicely aligned after milling (and drilling). However, I'm consistently getting approximately 0.3 mm misalignment in the y direction. No problem with the x-axis alignment (which is typicall expected).

Obviously, the fast fix is to purposely (deliberately) compensate for this y-axis offset misalignment by deliberately using Mach3 to off-set the origin on one side of the circuit board (when just before milling one side). But it would be nice to figure out where the source of misalignment is in general.

I can add that .....when I use Mach3 to manually drill the very small 1mm extra hole into the board (at exactly mid-way between the two large alignment holes) at Y = 67 mm, and I then flip the board over, I find that the drill bit remains nicely aligned with that small hole. So I know that the drill bit actually gets to the correct spot all the time.

The software I'm using is 'eagle' for generating the circuit board, and I use PCB-GCODE software for converting the eagle circuit to G-CODE format. If anyone has some nice recommendations for me to nail down this misalignment offset issue in the y-direction, then definitely let me know. I'll be super grateful. Thanks in advance! In the meantime, I'm still continuing to think of what tests to try out.....to find out where the offset is coming from.

I've uploaded a few files.... top side g-code, bottom-side g-code, and a diagram of my milling arrangement, and also a screenshot of the top-side circuit pattern from the 'pcb-code viewer software) showing job width of 48.857mm.

Thanks all!
« Last Edit: August 12, 2018, 08:18:42 PM by SouthPark »
I use Eagle and PCB-GCode and have done for several years.

I follow the same general idea you do however I flip the board in the X axis not the Y. You can setup PCB-GCode to do either.

One thing I've got in the habit of doing is defining an outline with a zero width line, both in the dimension layer (20) AND the milling layer (46).
When I draw the outline I set the grid at 5mm. This means that my boards all come out in 5mm increments, this makes it easier to manipulate
so that the top and bottom layer coincide. The pic attached shows that the 0,0 point is at the lower left hand corner Note also that once you
have drawn the frame around your board you can shift the entirety of the traces by highlighting all and using MoveGroup (at a suitably fine grid)
to shift within the frame.

I have also attached a pic of a piece of circuit board blank. Note how the two registration holes (1.6mm, as I use short lengths of 1.6mm welding wire for pins)
are outside of my intended finished board. I stick the board down with double sided tape, it works so much better than any other technique with Autoleveller,
jog to my anticipated 0,0 point and zero the X and Y axes.

Then MDI G0 Y-5 to drill my 1.6mm hole and put in a pin through the board and into the baseboard
Then MDI G0 X100 and drill the second 1.6mm hole and put a pin in it.

Now you can run the top etch file.
When you go to flip it:
G0 X0 Y0 and retract Z out of the way. Flip the board on the pins.
Then G0 X100
Now <zero X> This has now effectively redefined the 0,0 point at the lower right hand corner and now the bottom etch file can be run.

The only real difference between you method and mine, aside from flipping in X rather than Y, is choosing a defined frame with a nicely rounded
number, and the corner of the frame is the 0,0 reference for the board.
« Last Edit: August 13, 2018, 03:44:11 AM by joeaverage »
My wife left with my best friend...
     and I miss him!
I haven't used PCB-GCODE but I have used LineGrinder, and that relies on alignment pins to relocate the PCB when it's flipped over.  It worked perfectly.  LG is free, but bit of a steep learning curve.
I use Eagle and PCB-GCode and have done for several years.

Hi Joe! Genuinely appreciated your time for helping me. I had been at this for quite a long time trying to find the source or cause of my y-offset. It's likely due to my assumption of knowing an accurate y-axis distance between between my g-code pattern's origin and the edge of my copper boundary on the other side...... a distance of 48.857 mm according to the PCB-GCODE viewer. But in the 'board layout' screen of Eagle, the distance between the eagle origin and that same edge is 48.26 mm. I didn't know which distance to trust. So, for now --- I'm going to ignore both of those distances, and try those excellent steps that you mentioned.

Previously, I only had my white-coloured frame on the dimension layer. I didn't put one on the milling layer. I have to try that. Your extra technique, involving using a 5mm grid, with frame locked to the grid points ------ is excellent. I will try that excellent method, which I would not have thought of.

I have now turned on the grid in the Eagle board screen, and I've set a grid of 5mm (following your lead). The very nice thing about your method is that I now have some accurate dimensions to work with, such as distance between origin and the far edge of the polygon/copper/ground-plane.

I'll do some milling with this approach, and will also try some milling with the board flipping about the vertical axis instead of flipping along the horizontal axis.

For your Eagle board, I can see that you have the white frame around your circuit. There is no polygon (copper) perimeter in your board view. Is the copper pour polygon part of your white perimeter?

Thanks again Joe. Thanks very much for your time again. Greatly appreciated.

Hi Joe,

The time limit for modifying my previous post (for adding some images) expired, so I'll add the images in this post here. I'm going to use width of Y = 55 mm (or rather Y/2 = 27.5 mm) for setting my y-axis milling origin value, relative to the half-way mark between my two y-axis alignment holes (at y = 67 mm). So when I make the flip, I might get some good results this time. Fingers crossed. Thanks again!!!
« Last Edit: August 13, 2018, 06:23:52 PM by SouthPark »
I haven't used PCB-GCODE but I have used LineGrinder, and that relies on alignment pins to relocate the PCB when it's flipped over.  It worked perfectly.  LG is free, but bit of a steep learning curve.

Hi John. Thanks for mentioning LineGrinder. I will take a look at that software. Very much appreciated.
you need to outline your board in layer 46, the milling layer. That will give you a Gcode file for outline

I used to follow the same idea, that is to say the mid-line approach, but I gave it away with the simple
expedient of re-locating the 0,0 point the width of the board when flipping it, so much simpler.

My wife left with my best friend...
     and I miss him!
I used to follow the same idea, that is to say the mid-line approach, but I gave it away with the simple
expedient of re-locating the 0,0 point the width of the board when flipping it, so much simpler.

Thanks Craig! I'm going to follow your method, setting origins based on board width rather than mid-point approach.

And thanks for your help in letting know about putting the outline on the milling layer.

Until this evening, the PCB-GCODE pattern widths seen in the pcb-gcode's 'viewer' software had me wondering what settings would allow the pcb-gcode output pattern to perfectly match the Eagle dimensions. Only finally figured out a moment ago how to get PCB-GCODE to make a test g-code pattern that matches the Eagle board dimensions ....  by setting a few things to zero. This wouldn't be done in practice of course. Thanks again Craig. You helped me a lot. I'll show others what you showed me.

Kenny     (my real name is actually this)
Hi again Craig,

Today, I performed a test along the Y-axis, and found that the tiny 1 mm diameter alignment hole that I drilled from the TOP side of my circuit board is out by about 0.3 milliimetre when I flip the board over. The board flip is still in the same way that I originally flipped it (ie. flip along the Y-axis). I'm still going to change my style and do flips along the X-axis as you do. But this issue has me stumped for the moment.

The tiny 1 mm hole that I drill from the TOP-side of the board is supposed to be exactly half-way between my two large 3 mm holes. I have one 3 mm diameter hole at Y = 35, and one 3 mm diameter hole at Y = 99. So half-way in between is Y = 67, which is where my 1 mm diameter hole lies. The small 1 mm diameter drill bit is able to consistently get back to that Y = 67 point, even when I drive the spindle back to the home location (where the limit switches are).

But now I find that when I flip the board over, the 1 mm diameter hole sits at 67.3 mm.

Did you encounter this sort of situation before? It's got me stumped right now, because my 3 mm diameter dowels fit nicely into the large 3 mm holes. I can see some red ink down the 1 mm hole when I shine a light down the hole. Obviously the hole (when the board is flipped) isn't spot on. The drill bit manually moved right over the hole, is reading around 67.3 mm.

And when I flip the board back over to the TOP side again, the drill bit lines up perfectly over the hole again. This is certainly challenging my apparently limited knowledge of geometry. I was assuming that if my x-axis and y-axis movements are relatively square to each other, and assuming my spindle drill bit angle is relatively square to the board (and the board is relatively thin....about 2 mm thick only), then the 1 mm alignment hole should theoretically lie at the same spot once the board is flipped over. But 0.3 mm out is fairly significant.

The nice thing is that manually offsetting the origin for the bottom-side milling dealt with that offset quite well. I found that when I deliberately add about 0.4 mm (rather than 0.3 mm), it allows the milling patterns on both sides of the board to line up reasonably well. I might have to add maybe 0.5 mm to get a near-perfect match. But at least a fix (by deliberate offsetting by a certain amount) is my temporary workaround.

I don't know what's going on to cause that sort of described hole-alignment offset though. I always like to work things out for myself. This has me out-of-ideas for now. I'll keep thinking about this one. If you have any ideas that I try ---- that could possibly help me figure out what this offset could be due to, then I certainly welcome any ideas.

I'm using a 3040 CNC. I can later show some pics of my setup. I will take some photos.


« Last Edit: August 15, 2018, 01:35:36 AM by SouthPark »
I will be taking photos of my milling setup. Just showing the most recent result that required me to add 0.4 mm in the Y-direction just prior to setting the origin for the bottom mill.

For my next attempt, I'll add 0.5 or 0.6 mm instead of 0.4 mm. The 0.5 or 0.6 mm offset will definitely get the two sides of the board to match up very nicely. At this time, the TOP drill holes are slightly off, because I drilled from the BOTTOM after milling the bottom circuit. What I do is I set up the top side for milling first. Then I auto-level, followed by milling. Then I flip the board, then auto-level, then mill the bottom side. Finally, I drill the pad holes from the bottom side.

And my next task will be to figure out what the offset in the y-axis is due to. So far, I don't think it's due to the spindle not being square enough to the 2mm-thick board. I'm thinking that - for a 2 mm-thick circuit board, a drill-bit coming down at an angle of around 4.5 degree (to the vertical) would lead cause the hole at the top of the board and the exiting hole at the bottom of the board to have their hole centres offset by around 0.15 mm. So, when the board is flipped, maybe that initial error 0.15 mm could result in a 0.3 offset of holes. But that's only if the spindle was out by 4.5 degree along the y-direction. And the alignment dowels would probably be hard to slot in (due to angle error) if hole alignment were really bad. I haven't had issues with the alignment dowels slotting into the holes when the board is flipped.

So far, I'm not even sure whether squaring the spindle to the board is necessary for relatively thin (2mm thickness) circuit board milling. I wouldn't be surprised if it's important.
« Last Edit: August 15, 2018, 03:43:08 AM by SouthPark »