Options: Alignment for two sided PCB and offsets - pcb2gcode/pcb2gcode GitHub Wiki

Options: Alignment for two sided PCB and offsets

Printing a two-sided PCB has specific challenges because you need a way to reliably flip over the PCB and do the other side while maintaining alignment. The method that pcb2gcode uses is alignment pins. The steps are:

  1. Zero the CNC and place the PCB on it firmly.
  2. Jog the CNC to the alignment holes and drill holes through the PCB and into the wasteboard below.
  3. Put alignment pins into those holes to hold the PCB in place.
  4. Mill one side.
  5. Flip the PCB over and place on the alignment pins.
  6. Mill the other side.

Options

These are the useful options:

Alignment options, useful for aligning the milling on opposite sides of the PCB:
  --x-offset arg (=0)                   offset the origin in the x-axis by this
                                        length
  --y-offset arg (=0)                   offset the origin in the y-axis by this
                                        length
  --zero-start [=arg(=1)] (=0)          set the starting point of the project 
                                        at (0,0)
  --mirror-absolute [=arg(=1)] (=1)     [DEPRECATED, must always be true] 
                                        mirror back side along absolute zero 
                                        instead of board center
  --mirror-axis arg (=0)                For two-sided boards, the PCB needs to 
                                        be flipped along the axis x=VALUE

zero-start

Your PCB might have all the milling and drilling far from the center. For example, there is no milling near (0,0) and all the milling is far away from the origin.

By setting zero-start=true, pcb2gcode will move the project so that the drilling and milling is closer to the machine's (0,0):

If you are using tools that depend on the (0,0) in the gerber file being maintained, you shouldn't use this.

Offsets

If you need a positioning other than zero-start, you can put your own offsets in. zero-start=true essentially adjusts offset-x and offset-y to be at the bottom left of the front side drilling. If you want, you can use the offsets instead or in addition to zero-start to move the board around more.

mirror-axis

The mirror-axis option sets along which line to flip the PCB when milling or drilling the other side. For example, here is a board with copper layers on the front and back. The front side has a trace that says "Front" on it and the back side says "Back". Back is written backwards because we are looking through the board to the other side. When made correctly, "Front" and "Back" are written correctly and not reversed.

After milling one side, the board needs to be flipped over and milled on the other side. With mirror-axis=0 (the default), we need to flip the board over along the zero axis of the CNC to mill the other side. This means that the CNC needs to be wide enough to fit both sides, side-by-side:

If we instead set mirror-axis=35mm, the approximate center line of the board, then we can flip the board along the x=35mm line and the milling area is much smaller so we can work using a smaller CNC. In the image below, we see how the front and back side are more overlapping.

Alignment pins can be placed along the mirror-axis or on both sides of it at equal distances from the line.