Category Archives: Electronics

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.

Reviving a Dead Mains Timer

It is that time of year when one puts electric advent stars and candlesticks in the windows. I usually use timers to control them, but this year I ran into a problem. Some of my timers were of the type “EverFlourish EMT757A”, probably bought at Clas Ohlson:

Back side of timer

Back side of timer

Despite having a notoriously bad user interface (that forces me to google the user manual each time I want to use them), the timers, that had been laying in a drawer since last season, showed an entirely blank LCD display, even when connected to a mains outlet. I guessed that an internal battery just need to be charged, so I left them connected for a day to allow them to be charged up. The display however remained blank.

Hmm. I had encountered similar timers before that needed the internal battery to be replaced, so I decided to have a look inside to determine if this was the case again. It turned out that the screws used to keep the units together had tamper proof tri-wing heads. Fortunately, I happened to have bits that fit this kind of head, so this did not deter me.

Tri-wing screw head

Tamper proof tri-wing screw head

Tri-wing bit

Tri-wing bit

I found that there was indeed a tiny chargeable NiMH battery inside the unit (the green component with white corrosion on the side, close to the center of the picture below). Despite the unwanted corrosion, I found that the battery was actually charged to 1.3 V or thereabout, which is fine for a NiMH battery. Maybe it did not need to be replaced after all?

Opened mains timer

Opened mains timer

But why then was the display dead?

I put the timer back together again and had another look at the front. Pressing any of the normal buttons did not result in any reaction, but there was also a tiny little recessed button marked RESET. I used a pen to press it and voilà! The display came to life!

The timer has been brought back to life.

The timer has been brought back to life.

Stupid me to not try this before I disassembled the unit.

I suppose the reason the timer behaves like this is that the processor controlling the display probably does not have a proper power on reset circuit. So when the supply voltage is ramped very slowly, as it is when it is powered from a battery that is trickle charged from a state of being completely dead, the processor does not jump into action properly, even after the supply voltage reaches its proper level.