Printed Circuit Board Milling
- 1 Introduction
- 2 Creating Gerber Files
- 3 Creating G-code from Gerber Files
- 4 Sending G-code to the Milling Machine
- 5 Post-processing
Creating Gerber Files
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.
Creating G-code from Gerber Files
Building From Source
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
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
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.