Printed Circuit Board Milling



Introduction



Creating Gerber Files


from KiCad

You can export Gerber files from the KiCad PCB editor by using the GUI. The process is called 'plotting', in accordance with traditional nomenclature. For workflow automation, however, you want to make use of the Python scripting interface. Here is an example script from the official code repository.

I wasn't able to find documentation for the pcbnew Python module and ended up using pydoc to create an HTML documentation page.

from Eagle



from Fritzing



Creating G-code from Gerber Files


pcb2gcode

Building From Source


Usage

There are a bunch of command line arguments for pcb2gcode. For example,

pcb2gcode --metric --front My_PCB.gbr --zsafe 20 --zchange 10 --zwork -1 --offset 0 --mill-feed 10 --mill-speed 800

The alternative (and more elegant) way is to write the settings to a file called millproject, which will be picked up by pcb2gcode by default.

Sending G-code to the Milling Machine


LinuxCNC

LinuxCNC (linuxcnc.org) is a command-line tool for sending G-code to a CNC machine. G-code can be sent over the parallel port of a PC or via a PCI extension card installed in a desktop PC.

Building LinuxCNC from Source

Installing the dependencies on a Debian Linux distribution like Ubuntu:

sudo apt-get install libudev-dev libmodbus-dev libusb-1.0-0-dev bwidget libtk-img tclx8.4 

Getting the source code:

git clone https://github.com/LinuxCNC/linuxcnc.git

Building the source:

cd linuxcnc
./autogen.sh
./configure --with-realtime=uspace --enable-non-distributable=yes
make


Using LinuxCNC with AXIS

AXIS is the standard graphical user interface for LinuxCNC. To start LinuxCNC with the AXIS GUI you need to edit the .ini file that you provide to linuxcnc as parameter. Add the [DISPLAY] section if it is missing, and add the line DISPLAY = axis like shown below.

[DISPLAY]
DISPLAY = axis


Post-processing

You can use a scouring pad or the rough side of a kitchen sponge to enhance the board visually and, more importantly, to remove copper chips that may have stuck inside the milled tracks and cause short circuits. Use a dab of ammonia for better results.