PCB Milling: Difference between revisions
imported>Rmarko debug, adjusting depth size |
No edit summary |
||
| (12 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{Project | {{Project | ||
|founder=[[user:rmarko]] | |founder=[[user:rmarko]] | ||
|status= | |coops=[[User:Lubko|Lubko]] | ||
|status=operational | |||
|shortdesc=Milling and drilling PCB's on LinuxCNC | |shortdesc=Milling and drilling PCB's on LinuxCNC | ||
|image=Millingatbase.jpg | |||
}} | }} | ||
Tutorial for milling PCBs on the [[Small CNC]]. | |||
= | == Prepare the GCode == | ||
This part is done on your computer. The objective is to get GCode files for milling, drilling and outline cut and copy them to the controlling machine. | |||
== | === Export from KiCAD === | ||
Up to date versions of KiCAD provide a command line tool to conveniently export Gerber and drill files. | |||
{{cmd|code= | {{cmd|code= | ||
kicad-cli pcb export gerbers --layers F.Cu,B.Cu,Edge.Cuts MyBoard.kicad_pcb | |||
kicad-cli pcb export drill MyBoard.kicad_pcb | |||
}} | }} | ||
== | === Generate GCode === | ||
Use [https://github.com/pcb2gcode/pcb2gcode pcb2gcode] to produce the GCode. | |||
Below is an example of a single-sided board drilled from the back side. It uses speeds, distances and feed rates that are known to work well with out machine and utilizes auto-leveling to compensate for deformation in clamping and the slight bent in Y-axis. | |||
Consult pcb2gcode manual to tune details or use utilize other features of the tool such as double-sided milling or tiling. | |||
= | One-sided board (called "MyBoard") drilled from back: | ||
{{cmd|code= | |||
kicad-cli pcb export gerbers --layers F.Cu,B.Cu,Edge.Cuts MyBoard.kicad_pcb | |||
kicad-cli pcb export drill MyBoard.kicad_pcb | |||
pcb2gcode \ | |||
--back=MyBoard-B_Cu.gbl \ | |||
--drill=MyBoard.drl \ | |||
--outline=MyBoard-Edge_Cuts.gm1 \ | |||
\ | |||
--drill-output=MyBoard-drill.ngc \ | |||
--front-output=MyBoard-front.ngc \ | |||
--back-output=MyBoard-back.ngc \ | |||
--outline-output=MyBoard-outline.ngc \ | |||
\ | |||
--software=linuxcnc \ | |||
--metric=true \ | |||
--metricoutput=true \ | |||
--zero-start=true \ | |||
\ | |||
--al-probe-on='(MSG, Probe on)' \ | |||
--al-probe-off='(MSG, Probe off)' \ | |||
--al-back=true \ | |||
--al-x=5 \ | |||
--al-y=5 \ | |||
--al-probefeed=50 \ | |||
\ | |||
--zchange=20.0000 \ | |||
--zsafe=2.0000 \ | |||
--extra-passes=3 \ | |||
--mill-feed=450 \ | |||
--mill-speed=24000 \ | |||
--offset=0.1500 \ | |||
--zwork=-0.1000 \ | |||
--drill-feed=250 \ | |||
--drill-side=back \ | |||
--drill-speed=12000 \ | |||
--zdrill=-3.0000 \ | |||
--bridges=0.8000 \ | |||
--bridgesnum=4 \ | |||
--cut-feed=200 \ | |||
--cut-infeed=1.0000 \ | |||
--cut-side=back \ | |||
--cut-speed=24000 \ | |||
--cutter-diameter=3.1750 \ | |||
--zbridges=-0.0500 \ | |||
--zcut=-1.7000 | |||
}} | |||
If pcb2gcode prints warnings, look into the *.svg files generated in working directory. They will contain visual indication of what is the problem. | |||
=== File upload === | |||
Upload folder to LinuxCNC machine: | Upload folder to LinuxCNC machine: | ||
{{cmd|code= | {{cmd|code= | ||
| Line 63: | Line 83: | ||
}} | }} | ||
= Machining = | == Machining == | ||
The following steps are done at the CNC milling machine. | |||
You will be operating machine a machine that spin things very fast, moves with a lot of power and doesn't stop for meat. Avoid complacency and double-check things. | |||
== | === Safety essentials === | ||
* The '''big red button''' is an E-stop | |||
* E-stop cuts power to motors when idle and in emergency | |||
* F1 in LinuxCNC also acts as an E-stop | |||
* Erroneous Z-axis movement or failed probe will break and eject the sharp tip of the tool | |||
* '''Safety goggles are needed to protect eyes from flying debris''' | |||
* Errors happen. Double-check commands and have an emergency plan! | |||
Make sure to clamp PCB blank as good as possible as it's critical for the outcome of the leveling and milling. | === Clamping === | ||
Make sure to clamp PCB blank as good as possible as it's '''critical''' for the outcome of the leveling and milling. | |||
* Clamp PCB blank on top of piece of wood with at least 4 clamps | * Clamp PCB blank on top of piece of wood with at least 4 clamps | ||
* | * Attach the RED probe crocodile clip is attached to the PCB | ||
* Double-check the proble clip. '''The tool will break during probing if there's no contact!''' | |||
== | === Starting up === | ||
* '''Find the E-stop and make sure it's pressed''' | |||
* Find a pair of safety goggles | |||
* Power on the extension cord | |||
* Make sure you hear the spindle cooling water pump operate | |||
* Power on linuxcnc machine (the PC, reachable at linuxcnc.base48.cz) | |||
* Power on machine controller | |||
=== Starting CNC control === | |||
* Start LinuxCNC by running base_mill shortcut on the desktop | * Start LinuxCNC by running base_mill shortcut on the desktop | ||
* Enable | * '''Put on the safety goggles''' | ||
* Position the machine with arrow keys to a starting point (bottom left corner of your future | * Depress the E-stop | ||
* Enable power (F2) | |||
* Position the machine with arrow keys to a starting point (bottom left corner of your future PCB) | |||
=== Homing and preparing to mill === | |||
* Pick a V-shaped tool from the box and install it | |||
* Home each axis of the machine, don't forget to home A axis as well | * Home each axis of the machine, don't forget to home A axis as well | ||
* Load | * Load mill file (e.g. ''MyBoard-back.ngc'') | ||
* Try moving machine around displayed job to make sure it can actually reach all sides of the job without collisions | * Try moving machine around displayed job to make sure it can actually reach all sides of the job without collisions | ||
* Switch to MDI tab (F5) (all the required commands in the following section should be present in the history) | * Switch to MDI tab (F5) (all the required commands in the following section should be present in the history) | ||
| Line 92: | Line 128: | ||
** Go back to manual tab and '''re-home Z axis''' | ** Go back to manual tab and '''re-home Z axis''' | ||
== | === Milling === | ||
* Make sure you're wearing eye protection | |||
* | |||
* Start job with blue arrow button | * Start job with blue arrow button | ||
* Hope for the best, abort with F1 if stuff goes wrong | * Hope for the best, abort with F1 or E-stop if stuff goes wrong | ||
* When asked to install or remove probe, just continue. Probing will run with the V-shaped milling tool | |||
== | === Drilling === | ||
* Load drill file (e.g. ''MyBoard-drill.ngc'') | |||
* | |||
* Install correct drill bit | * Install correct drill bit | ||
* To re-establish Z height again | * To re-establish Z height again | ||
| Line 137: | Line 143: | ||
* Start drilling job | * Start drilling job | ||
== Outline == | === Outline === | ||
* Load outline file (e.g. ''MyBoard-outline.ngc'') | |||
* Load 3.175mm endmill | * Load 3.175mm endmill | ||
* Go to manual tab a re-establish Z height again by positioning tool slightly over the board | * Go to manual tab a re-establish Z height again by positioning tool slightly over the board | ||
| Line 144: | Line 150: | ||
* Start job | * Start job | ||
= | == After milling == | ||
* '''Find the E-stop and make sure it's pressed''' | |||
* Shut off the controller, PC and extension cord | |||
* Vacuum the debris | |||
* Clean your board with sandpaper and alcohol | * Clean your board with sandpaper and alcohol | ||
* Use flux spray | * Use flux spray | ||
* Leave a board on a warm place for a while | * Leave a board on a warm place for a while | ||
* | * Take pictures | ||
* Solder components | * Solder components | ||
* Profit | * Profit | ||
Latest revision as of 14:43, 17 September 2026
Tutorial for milling PCBs on the Small CNC.
Prepare the GCode
This part is done on your computer. The objective is to get GCode files for milling, drilling and outline cut and copy them to the controlling machine.
Export from KiCAD
Up to date versions of KiCAD provide a command line tool to conveniently export Gerber and drill files.
kicad-cli pcb export gerbers --layers F.Cu,B.Cu,Edge.Cuts MyBoard.kicad_pcb
kicad-cli pcb export drill MyBoard.kicad_pcb
Generate GCode
Use pcb2gcode to produce the GCode.
Below is an example of a single-sided board drilled from the back side. It uses speeds, distances and feed rates that are known to work well with out machine and utilizes auto-leveling to compensate for deformation in clamping and the slight bent in Y-axis.
Consult pcb2gcode manual to tune details or use utilize other features of the tool such as double-sided milling or tiling.
One-sided board (called "MyBoard") drilled from back:
kicad-cli pcb export gerbers --layers F.Cu,B.Cu,Edge.Cuts MyBoard.kicad_pcb
kicad-cli pcb export drill MyBoard.kicad_pcb
pcb2gcode \
--back=MyBoard-B_Cu.gbl \
--drill=MyBoard.drl \
--outline=MyBoard-Edge_Cuts.gm1 \
\
--drill-output=MyBoard-drill.ngc \
--front-output=MyBoard-front.ngc \
--back-output=MyBoard-back.ngc \
--outline-output=MyBoard-outline.ngc \
\
--software=linuxcnc \
--metric=true \
--metricoutput=true \
--zero-start=true \
\
--al-probe-on='(MSG, Probe on)' \
--al-probe-off='(MSG, Probe off)' \
--al-back=true \
--al-x=5 \
--al-y=5 \
--al-probefeed=50 \
\
--zchange=20.0000 \
--zsafe=2.0000 \
--extra-passes=3 \
--mill-feed=450 \
--mill-speed=24000 \
--offset=0.1500 \
--zwork=-0.1000 \
--drill-feed=250 \
--drill-side=back \
--drill-speed=12000 \
--zdrill=-3.0000 \
--bridges=0.8000 \
--bridgesnum=4 \
--cut-feed=200 \
--cut-infeed=1.0000 \
--cut-side=back \
--cut-speed=24000 \
--cutter-diameter=3.1750 \
--zbridges=-0.0500 \
--zcut=-1.7000
If pcb2gcode prints warnings, look into the *.svg files generated in working directory. They will contain visual indication of what is the problem.
File upload
Upload folder to LinuxCNC machine:
scp -r project/ base@linuxcnc.base48.cz:<your_nick>/
Machining
The following steps are done at the CNC milling machine.
You will be operating machine a machine that spin things very fast, moves with a lot of power and doesn't stop for meat. Avoid complacency and double-check things.
Safety essentials
- The big red button is an E-stop
- E-stop cuts power to motors when idle and in emergency
- F1 in LinuxCNC also acts as an E-stop
- Erroneous Z-axis movement or failed probe will break and eject the sharp tip of the tool
- Safety goggles are needed to protect eyes from flying debris
- Errors happen. Double-check commands and have an emergency plan!
Clamping
Make sure to clamp PCB blank as good as possible as it's critical for the outcome of the leveling and milling.
- Clamp PCB blank on top of piece of wood with at least 4 clamps
- Attach the RED probe crocodile clip is attached to the PCB
- Double-check the proble clip. The tool will break during probing if there's no contact!
Starting up
- Find the E-stop and make sure it's pressed
- Find a pair of safety goggles
- Power on the extension cord
- Make sure you hear the spindle cooling water pump operate
- Power on linuxcnc machine (the PC, reachable at linuxcnc.base48.cz)
- Power on machine controller
Starting CNC control
- Start LinuxCNC by running base_mill shortcut on the desktop
- Put on the safety goggles
- Depress the E-stop
- Enable power (F2)
- Position the machine with arrow keys to a starting point (bottom left corner of your future PCB)
Homing and preparing to mill
- Pick a V-shaped tool from the box and install it
- Home each axis of the machine, don't forget to home A axis as well
- Load mill file (e.g. MyBoard-back.ngc)
- Try moving machine around displayed job to make sure it can actually reach all sides of the job without collisions
- Switch to MDI tab (F5) (all the required commands in the following section should be present in the history)
- To get to the starting point run G0 X0 Y0
- To home Z-axis use G38.2 Z-100 F30
- Go back to manual tab and re-home Z axis
Milling
- Make sure you're wearing eye protection
- Start job with blue arrow button
- Hope for the best, abort with F1 or E-stop if stuff goes wrong
- When asked to install or remove probe, just continue. Probing will run with the V-shaped milling tool
Drilling
- Load drill file (e.g. MyBoard-drill.ngc)
- Install correct drill bit
- To re-establish Z height again
- Go to Manual tab (F3) and position a head outside of the milled PCB near clamp with probing wire attached so probing is possible, then few millimeters on top of the spot but don't try to make contact
- Go to MDI tab (F5) and issue probing command G38.2 Z-100 F30
- Go back to manual tab and re-home Z axis
- Start drilling job
Outline
- Load outline file (e.g. MyBoard-outline.ngc)
- Load 3.175mm endmill
- Go to manual tab a re-establish Z height again by positioning tool slightly over the board
- re-home Z axis
- Start job
After milling
- Find the E-stop and make sure it's pressed
- Shut off the controller, PC and extension cord
- Vacuum the debris
- Clean your board with sandpaper and alcohol
- Use flux spray
- Leave a board on a warm place for a while
- Take pictures
- Solder components
- Profit