There are several ways to create circuit boards for prototypes:
- use something like our special prototyping board (see here)
- pro: easy to use relatively standard components
- con: comes in an unwieldy size, hard to scale to a final product and make a nice enclosure for
- use a standard perfboard
- pro: cheap, fast, easy to cut to size
- con: wire and solder mess, hard to scale to a final product
- etch a board
- pro: can use almost the same design as a final product board
- con: chemical mess – hard to keep consistent board quality if you don’t do this often enough and keep the tools set up.
- order a board
- pro: perfect quality of the exact same design you could use to scale up
- con: expensive when you need them fast, or about 10 days delivery for a decent price
- mill a board from plain copper-covered FR-4 (the raw materal PCBs are made from) using a tiny v-carve bit (the same type of cutter that is used to engrave marble tombstones, but a lot smaller)
- con: the low detail level of contouring means you might have to produce something more suitable for throughhole parts instead of SMD
- pro: relatively fast/clean production of boards
I have options 1 to 4 already, but 5 was new to me because I didnt have the machine. Luckily – there is Makeblock.
Makeblock had only just released their linear-bearing packs, so I set out and built this:
This is a four axis (= two z-axis for different drill/mill tools) CNC mill. The copper board is mounted on to a platform that can move in two directions (x-axis and y-axis). This allows the machine to position a drill very precisely. Either of the two z-axes can then be used to move a drill/mill down and carve away material. There are two z-axis so that the machine can do hole drilling and groove carving in one go by sliding the whole platform from the mill to the drill. Manually switching tools would have been an option to save building one z-axis, but this would also mean building a system to recalibrate the drill-length for every tool switch.
There are three Makeblock stepper drivers mounted on the top bar, and one mounted to the X-axis (hard to see). These are all connected to a standard Arduino running a serial command receiver with a system that can smoothly accelerate and decelerate the stepper motors (Google S-curve acceleration – second order continuity allows for very stable speed changes).
Makeblock enthusiasts will probably wonder what I used to attach the stepper motors to the frame. I used my lasercutter to cut some extra parts:
The blue plate in the bottom right shows the part I constructed to connect standard nema-17 size steppermotors to the end of a linear stage. The top right image shows a backlash-compensator unit I designed to couple the X and Y axes to the carriage. This allows you to tighten the screw enough so the internal slack of the nut wont accidentally move the PCB.
To get the mill to work as intended, I had to write some software to generate workable toolpaths. I know there are existing tools out there, but this seemed like a nice piece of software-archeology. Did you know the Gerber file format still defines paths in terms of dia-exposure trails? I didn’t. These machines are still out there – they project a small dia shape on to a photosensitive plate and then move around to draw circuit-trace-trails. I guess modern machines could use something like SVG or DXF directly, but Gerbers are here to stay (for now).
Developing the software
To test the software I needed to write, I first designed a simple PCB in Eagle and exported it to Gerber files. I added some SMD stuff and some things with holes and weird outlines to make sure I had a decent testcase. IIRC these were some headerpins, caps and a WS2812 6pin LED, but the exact parts are not very relevant – it was only meant to test the software. Here is what GerbV tells me it should look like:
I started out with some older C# code I had used to drive 2D CNC machines – which already had a path-optimizer running between segments. Some remnants can be seen in the following screenshots in the shape of the red lines – these lines show how the mill will move between segments with the drill away from the material.
Step 1: Naive rendering of paths
These are the coordinates that connect the centerpoints of all the traces. See all the black lines:
Step 2: The archeology begins.
The trails need to be “exposed” using dia-shapes. The Gerber file lists a set of the used shapes somewhere in the beginning. These range from standard circle/square/octagon shapes to custom-defined polygons (no idea how they used these in the old days). The first shapes I decoded were the octagons. As you can see, they are oriented quite incorrectly – something with radius and diameter and rotation.
Step 3: Orientation and brute force extrusion.
The orientation and size of the octagons was easy to fix. This seemed like it would almost be “complete enough” to start combining shapes and optimizing the path. But before I wrote the real “correct” way to extrude a shape over a line, I wanted to see if I was actually getting closer to the target. I did a small test, I “stamped” the exposure shape 10 times over each segment:
Step 4: Correct extrusion of the shapes.
After the previous step turned out fine, I wrote some actual shape-sweeping code to convert a line and a shape in to a closed polygon. This image shows all the generated pillbox-shaped polygons:
Step 5: Intersecting the generated closed curves and calculating an offset curve around them.
With the correct polygons to start from – I used some random C# library (google… ) to combine the polygons in to the largest possible intersection polygons, and calculate a toolpath at a small distance from this set. The drill needs to go -around- the shape, not cut on the line itself. There are some amazing offset-curve libraries out there these days. Getting to this stage from the previous screenshot took maybe five minutes of coding time.
Step 6: Milling the thing.
I dont have any pictures of milling this particular curve, because it was quite obvious that this design would not be millable. Look at the offsetcurve in the bottom left corner – the drill would be too wide to get between the traces.
I do have some pictures of another design that did get as far as milling it:
Milling a PCB is not an easy task, but quite doable. After trying to mill several simple boards, I found out that the biggest problem for machines like these is the fact that your cutting surface is nowhere close to flat. This pretty much means you have to do a two step process – scan the surface of the board with some probe and then mill the board while compensating for the scanned height. Building this machine would be fine for a more permanent setup, but in this case I would rather use my Makeblock parts for other robot-prototypes as well. It makes little sense to spend a week calibrating such a setup only to deconstruct it the day after.
I might at some point obtain a dedicated machine for this, or mount a probe to the CNC-converted Proxxon-MF70 to allow it to carve small boards.
Recently, specialized 3D printers have become available that can print a silver-compound. These can print circuit-traces directly on to a carrier board. Next experiment?