Mill Electronics

There are numerous hardware and software combinations that can be used to control a mill.  LinuxCNC and Mach3 are probably the most popular, but there have been many new entrants in the space so choosing a controller can be difficult.

Efficiently operating a CNC mill is much more complicated than sending programs to a 3d printer.  Many features that I consider essential for a mill are not available on multi-purpose controllers, such as tool tables, work offsets, pendant control, probing, canned cycles, and conversational programming.  There are also many quality of life features that a good controller should provide, such as MDI, instantaneous overrides, and modal command display.  A more specific complication is that reprap g-code conventions have diverged from the original g-code specification, which can lead to surprising behavior on a mill.

I have chosen to use Mach4 with a Pokeys54CNC control board for a few reasons, the main one being that I am familiar with Mach3 which should make the transition easier.

I started by fastening the main components to an aluminum panel.  From left to right you can see the power inlet, two 48V power supplies, one 12V power supply, three servo drives, and the Pokeys54CNC control board.

I generally acquire my wire by stripping lengths of multiconductor cable.  A length of multiconductor cable is almost always cheaper than equivalent lengths of color-coded hook up wire, and leaves you the option of using it in cable form as well.

I found the PoKeys + Mach4 combination to be unexpectedly intimidating, but this was mostly because I started by reading the various manuals and datasheets (of which there are several hundred pages).

Naming conventions are not always consistent between the datasheets so I brought out an oscillioscope to double check my wiring.

After actually powering everything on I quickly realized that 95% of the configuration is performed automatically or given workable defaults, and only small sections of the manual are truly necessary.  Configuration was very smooth and everything worked as expected.

I could have connected the servos directly to their drives, but I decided to keep things neat and print some plates for connectors.

Using non-conductive plastic to mount the connectors is a potential electrical noise problem, but I'm not overly concerned as this side of the electronics is fairly low power.

Here is a peek at the back of the electronics showing all the power wiring in place.  The first milestone has now been reached - the control board is successfully communicating with the servos.

The next step is the get the limit switches and probes connected.  Unfortunately I made the decision to purchase PNP limit switches and NO probes, but the PokeysCNC57 board is wired to accept NPN switches and NC probes.

Luckily the switches and probes can be converted to their alternate types with simple circuits, but it adds another step to the project.

I breadboarded the converter circuits for testing, and quickly prototyped an adapter.

I find that bridging pads with solder can be quite annoying, so I used the trimmed resistor leads to make longer connections.

The Pokeys57CNC board uses terminal blocks with 0.1 spacing.  This is incredibly convenient since it will directly accept a row of header pins.

The limit switches connect directly to header pins, and probe inputs are broken out to connectors on the printed panel.

With the limits and probes in place I can power up the system for another round of testing.  Over time I've learned that testing as frequently as possible saves time in the long run.

The final component of the mill electronics is the spindle motor drive.  I am using a 1.5KW Sensorless Vector VFD to power the spindle motor.

VFDs are very high power devices (this one requires a dedicated 240V circuit) and generate a disgusting amount of electrical noise.  Sensitive devices can fail merely to due proximity with a VFD so I will have to be much more careful about grounding and shielding this component.  You will notice that the VFD is located far from the controller and servo drives, this was done intentionally to help isolate the controller from the VFD noise.

I took apart a USB cable to make my VFD wiring.  USB cables are a great source of cheap shielded cable.  The standard cable contains both a foil and braided shield, and often contains two 28ga signals plus two 24ga power conductors.

As usual, datasheet diagrams describe how the components should be connected.

The Pokeys57CNC is designed to interface to a VFD, so unlike my probe and limit switches no converter circuits are necessary.  These cables simply provide point-to-point connections.

The power cables were also stripped and terminated.  I left a section of exposed shield on one end of the motor cable to make it easier to ground.

The power cables connect to the lower terminal block, and the various grounds are all connected to a directly to the aluminum panel below.  The various cable shields must also be connected to ground, but I'm not sure if I will do it with wire, tape, or braid; so I've left them unconnected for now.

A printed bracket provides strain relief for the cables and keeps the tray looking reasonably professional.

The signal cables, like the power cables, need their shields connected to ground, but I've also left that task for later.  This completes the assembly and wiring of my mill electronics.

In the next post I'll be fully configuring the software and hardware so it will be ready to connect to the mill.


jbeck said...

Very nice! As usual...

Are you using an online service to do your sheet metal, or a local provider?

Ryan said...

I send Solidworks files to a local sheet metal fabricator ( and they deliver finished parts. They're the only place I've worked with for sheet metal - the work is flawless and fairly priced so I haven't felt the need to experiment.



Email *

Message *