All posts by Per Magnusson

Depanelizing PCBs with the CNC mill

One use for the CNC mill I wrote about in the previous post is to depanelize PCBs, i.e. to mill out individual printed circuit board from a larger panel.

Panel before depanelization

My first attempt att doing this was with a panel of PCBs that were already almost completely routed out from the panel. Only a small tab remained that held each board to the panel. I had designed the panel with “mouse bites” (a row of small holes) along the board edges towards the tabs, but due to an error on behalf of the PCB manufacturer, these holes were never drilled. (I did later receive a new set of panels with this error corrected, without extra cost.)

Based on the CAD files for the panel, I made a drawing in DraftSight with a center line for the mill through each tab. I imported the resulting DXF file into Fusion 360 (via the Upload feature) and created gcode using the 2D contour method with compensation set to Off to make the tool follow the center of the line. Using Fusion 360 for this is severely overkill, but it works.

2D contour setup with compensation set to Off.

I put the origin of the gcode in a place that was easy to locate on the board so that I could zero the coordinate system of the mill properly. I also took care to align the edge of the panel with the edge of the mill table. Since the panel was taller than the working area of the mill, I could not make a single program that would depanelize all boards. Instead I made a program that cut out three of the five rows and ran it twice with the panel appropriately moved on the table between the runs.

I did run into a couple of problems though:

Uploading the small DXF file to Fusion 360 took a long time (several minutes). I later realized that there is a menu alternative under the Insert menu that might have worked better.

Another and more serious issue is that Fusion 360 decided to silently interpret the DXF file as if the units was cm (who in their right mind draws in cm???). My drawing was of course in mm, so the resulting gcode instructed the CNC mill to move ten times longer than intended. I did not discover this until the mill started to move in unexpected ways that might have easily broken off the tool, had I not been quick enough to stop it and figure out what was going on. The Insert/Insert DXF function allows the user to select the unit, so this seems like a much better option to get DXF into Fusion than  the Upload function. I will use that method in the future.

Once the mm/cm issue was resolved and new gcode was created I successfully depanelized the PCBs:

The program has been run to depanelize three rows of PCBs.
The final two rows of PCBs have been separated from the panel.
The resulting small boards. Some manual filing is necessary to remove the burrs.

An artifact that is obvious on the individual PCBs is that a pointy remnant of each tab is still present. This is because the PCBs are only held in place by the tab, so when the tab is almost cut through, it bends and the board is pushed away so that the final part of it is not removed. The way to prevent this would be to somehow hold the PCBs in place independently of the tabs, but this is tricky, especially with the very small PCBs in this panel.

Initial impressions of a small CNC mill

I recently bought a used Taig desktop CNC mill, primarily to use if for making front panels in aluminum and plastics and for learning how to use a CNC mill. It can also be useful for milling PCBs from copper clad boards.

A special use is for depanelizing PCBs ordered from cheap hobbyist friendly PCB manufacturers in China. I recently learned that you need to pay a lot extra if you put several PCB designs within the board perimeter and ask the factory to mostly separate the designs using mill lines. If instead there are few or no internal mill lines within the board files sent to the manufacturer, you just pay the advertised price for that size board and avoid the extra multi-design charge.  But then you need to saw the boards apart, or better yet, use a CNC mill to do the depanelization.

Taig CNC mill

It has been great fun learning how to use this thing and I am very happy with the purchase so far. There were lots of things I did not know about the process of using a CNC mill before I got started. A major thing is to figure out a “tool-chain” to go from design idea to making the mill move.

DraftSight, CamBam and Mach 3

Initially I used the 2D CAD program DraftSight to create DXF files, which I then imported into a program called CamBam. Inside CamBam, parts of the geometry of the DXF drawing is selected and one instructs the program what to do with it, like mill a pocket inside a closed contour, drill a hole inside a circle, engrave a contour or mill around the outside of a contour. There are many parameters to set up, like what mill tool to use, at what speed to move the tool, how deep each cut should be, how to transition to deeper levels and so on. The output of CamBam is gcode, a simple language similar to gerber that instructs the mill how to move. The gcode is then read into a program called Mach 3 that controls the mill. An old computer running Mach 3 was included with the mill and it was properly set up, so I did not need to configure it to fit this particular mill.

This process worked out pretty well, until the demo version of CamBam – that was supposed to work 40 times before one needed to buy a license  – refused to work after about 10 runs. I was very close to buying a license for €108, but then I found on Youtube (I think) that there were other options…

Fusion 360 and Mach 3

Autodesk offers a 3D CAD program called Fusion 360 and it is free, at least for a year, for hobbyists and small companies. Not only is it a CAD-program, it also includes CAM (computer aided manufacturing) functionality, so that it can generate the gcode directly. It also seems more capable than CamBam in terms of CAM features. The CAD part feels less powerful than SolidWorks (which I have recently started using at my daytime job), but it seems to be more than capable enough for what I want to do with the mill.

Screenshot of Fusion 360

Learning enough of Fusion 360 to be able to produce gcode for a few reasonably simple objects was fairly quick. I probably was a little helped by having done a bit of 3D CAD in SolidWorks, OnShape and other programs, but I had to learn the specifics of Fusion and especially how to do the CAM part. I did this mostly through googling and watching a few Youtube videos.

Lessons learned

For practice, I have made a few parts out of wood. There seems to be a lot of experience required to make the perfect CAM processing specifically for different kinds of wood, but I am getting there. It is easier to get good results requiring little manual post processing (like sanding and trimming) when using hard wood (like beech) than when using soft wood (like pine or spruce).

I found out that by running a finishing pass on most surfaces, milling higher levels after lower levels (when possible) and finally facing any flat top surfaces, one can minimize the amount of manual work required.

Another issue that is critical is work holding. It is very easy to set up the work piece in a way such that it moves a little (or a lot…) during the milling operation. This of course ruins the result. Quite a bit of ingenuity can be required to figure out how to secure the stock to the moving table.

Sample project

Below are a few pictures of a stand I made to hold the collets for the mill. It is made of some kind of quite soft wood, but by running finishing passes on some of the surfaces (inside the tapered holes and on the top surface), not too much sanding was required.

Below is a series of pictures showing how this piece was made.

The starting stock. It is attached to the OSB board from underneath by screws in the corners. The OSB board is held to the XY-table by the visible screws and T-nuts.
The decorative diamond shaped pockets have been milled by a 3 mm end mill and now the tapered holes are being milled by a long 6 mm end mill.
The finishing pass of the holes is in progress. The three holes to the right in the upper row have received their finishing pass.
The outside contour is half finished and the top surface facing is in progress.
The finished piece. The remaining tabs that held it to the sacrificial outer parts towards the end of the milling have been sawed off and sanded down. The part has also been oiled.
The engraving on the bottom was done using a 2.5 mm ball nose mill.
The collet stand; finally with collets.

The Christmas Tree Mystery

Today I noticed something peculiar. In our garden, we have a spruce in which I have put a string of LED lights. The lights are powered via a switch mode AC/DC power supply that creates the low voltage required by the LEDs from the mains voltage. This power supply is connected to an extension cord and a timer inside the garage and I have set the timer such that the lights are on only while it is dark outside. However, the LEDs were mysteriously glowing dimly in the middle of the day when they were supposed to be off.

Hmm, that is odd I thought.

Dimly glowing LEDs
Dimly glowing LEDs.

I did not think too hard about this at first, but a while later I realized what could cause this behavior. If the timer happens to be connected such that it breaks the neutral wire of the mains voltage instead of the live wire (phase), there could perhaps be enough capacitive leakage via the Y-capacitor going from neutral to protective earth inside the AC/DC supply such that the supply gets enough power to dimly light up the LEDs.

Y capacitors are present in virtually all switch mode AC/DC supplies. They are connected between phase and earth as well as between neutral and earth. Their purpose is to limit the amount of unintended radio frequency noise generated by the switch mode supply that is radiated back onto the mains network. There is usually also an X capacitor for the same purpose connected between phase and neutral.

In addition to the Y capacitor, there will also be leakage via the capacitance of the cable from neutral to earth as well as from neutral to the external world which currently consists of a quite wet lawn. But I would guess the leakage via the Y capacitor is much larger than the leakage via the cable capacitance.

The equivalent circuit for the case when the timer breaks the neutral line is shown below.

Equivalent circuit of timer breaking the neutral wire.
Equivalent circuit of timer breaking the neutral wire.

The dashed arrow shows the flow of current from the phase wire, via the AC/DC circuitry in the dotted box, the CY2 capacitor and back via protective earth. There will also be some current from from the neutral (disconnected) wire of the extension cord and the cable capacitance to the earth wire, CcableNE as well as a little current flowing in the capacitance from the cable neutral wire to the outside world (which as of this writing is a wet lawn). This capacitance is not shown in the figure above.

So, a hypothesis about what is happening is fine, but how could I test this? Well, that is not too hard. Just rotate the timer 180 degrees in the wall outlet so that it breaks the other wire, which according to the hypothesis would be the phase.

Timer breaking the phase (live) wire instead of the neutral.
Equivalent circuit of timer breaking the phase (live) wire instead of the neutral.

The rotation of the timer changes the equivalent circuit as shown above. Now the phase is stopped in the timer and no leakage can occur.

Timer before rotation
Timer before rotation
Timer after rotation
Timer after rotation

 

The LEDs are completely off!
The LEDs are completely off!

After this maneuver, the LEDs in the tree were completely off, so the hypothesis seems to be correct.

I would guess there are numerous similarly mysterious cases of LEDs powered via AC/DC converters connected to protective earth that light up dimly even when they are supposed to be off. The remedy is to make sure that the live wire is interrupted by the circuit breaker, rather than the neutral wire. In installations connected to wall outlets, this can be done by rotating the plug (if you are in country where plugs with protective earth can be rotated). In fixed installations, it is necessary to swap which wire is connected to the light switch, which probably requires the intervention of an electrician.