Transform Kicad Design To Patchwork For Isolation Routing

Tuning a desktop router and your board designs for isolation routing can be a bit tricky, with thin traces usually being the first victim. For simple prototype boards you usually don’t need tightly packed traces, you just want to isolate the nets. To do this with a minimum amount of routing, [Michael Schembri] created kicad-laser-min, a command-line utility that takes a Kicad PCB design and expands all the tracks and pads to their maximum possible width.

Laser scribed PCB with maximum track widths

The software takes one layer of the PCB layout, converts it to black and white, and then runs a C++ Voronoi algorithm on it to dilate each track and pad until it meets another expanding region. Each region is colourised, and OpenCV edge detection is used to produce the contours that need to be milled or etched. A contour following algorithm is then used to create the G-code. The header image shows the output of each step.

Full source code is available on GitHub. [Michael] has had good results with his own boards, which are scribed using a laser cutter before etching, but welcomes testing and feedback from other users. He has found that OpenCV doesn’t always completely close all the contours, but the gaps are usually smaller than the engraving width of his laser, so no shorts are created.

This is basically “Scribble style” prototyping with CAD and CNC tools. If you prefer scribe and etch, you might consider building a simple PCB shaker for faster etching. If you have a router but want to avoid the dust, you can use a carbide scribe to scratch out the tracks without needing to etch.

13 thoughts on “Transform Kicad Design To Patchwork For Isolation Routing

  1. >converts it to black and white
    sure sounds good

    >and then runs a C++ Voronoi algorithm on it to dilate each track and pad until it meets another expanding region
    yeah still sounding good

    >Each region is colourised
    okay…

    > and OpenCV edge detection is used to produce the contours that need to be milled or etched.
    say what?!

    That cannot be the best way to carry out this process… Doesn’t kicad have a built in pour functionality? It seems like a script to put a pour on each net would have been way easier and not involve running computer vision on your board layout

    1. Kicad does not do voronoi pours. The first pour it processes will fill as much space as possible and restrict the size of the neighbouring ones.

      OpenCV is just a set of image processing algorithms, it’s not some giant machine that’s overkill for trivial tasks. Using a contour tracing function from it is no different from using one from any other source or writing your own, except that it’s probably better.

        1. You might want to look up how Voronoi is implemented; generally it’s done with only images as input and output. You *don’t* know where the edges are until you do an edge-finding step.

  2. Gotta be honest, buying a desktop PCB mill that I’m currently trying to sell was one of my bigger regrettable purchases. If you really, truly, for real only need exactly one, there’s probably some expensive off the shelf solution that’s going to involve a lot less hassle, and might even be cheaper overall when you factor in shipping costs for parts, time, broken end mills, etc.

    If this is purely a DIY excercise for the fun of it, there’s always etching. If you work for a big company that does this stuff, you can probably afford quick turn fab, or a really high end conductive ink printer or something.

    For everything else, there’s OSHPark! Subtractive manufacturing was kind of shocking coming from 3D printing, I was surprised at how relatively unfun it is.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.