My 5-Axis Router Retrofit

This is a summary of my experiences retrofitting an industrial 5-axis router with a simpler PC-based control. Older and sometime broken machines are often available for very little money and it is a shame to scrap them. My hope it that this article will contribute a little to the body of knowledge available online about the process of bringing back broken machines with new control systems.

Warning: I am a hobbyist – not an electrical engineer or CNC controls expert. This article is just here to share my retrofit story. Please enlist the help of a qualified person to make sure your plans are safe if you are new to this. This kind of project can be extremely dangerous!

First off, here’s a video that shows the overall process quickly – the machine, the parts and the process:

The Situation

So I got this router on Ebay.  The ad showed a machine frame with some motors and a stripped out control cabinet.  I planned to make a glue dispenser out of it – using the pre-made 5-axis linear motion platform like a much simpler (and mostly cartesian) robot arm.  Then it arrived on the truck and was in much better shape than I had anticipated!  There were motors and a full control and a spindle – but no drives or VFD and lots of parts were missing.  The control was a Fagor 8070.  Some of the IO modules were missing and there were cut wires everywhere!  I still have no idea what happened.  The whole thing was really nice – the mechanical parts were in great shape and everything seemed smooth-running and square.  My glue-dispenser idea went out the window and I knew I had to repair it to be a router again!  

Several years passed… I had other things to do and it was always a few projects down the line.  Once we closed our factory, this machine (and a few others) became sort of a side project – but one I had to pay to store.  My plan had been to retrofit this and then move it to a new space – but that new space never came.  I did the retrofit here and there as I was able and got it up and running after a few weeks of part-time effort.  The opportunity came along and I made a deal to swap this Quintax for a smaller machine that could be used in a less industrial setting – so she’s going to be put to work, just not for me.  I plan to help out with the final dialing-in and will report back.

Decisions

I decided not to repair the Fagor control.  This may have been a bad idea because I have had other large machines with Fagor controls and they are great.  I wasn’t confident that I could get this up and running given difficulty reassembling the original parts that weren’t easy to find – and the overall complexity of the installation.  The Fagor controls use a fiber-optic SERCOS bus to communicate with the drives and a CAN system to deal with IO.  This isn’t exactly hobby-grade stuff and the 480v servo power had me a little concerned!  

So with the Fagor out, I needed a new control that would give me 5-axis control, plenty of IO for relays and limits and monitoring.  LinuxCNC was a natural choice – but I have zero Linux skills.  I could probably have figured it out, but it would be a challenge.  Mach3 was out because I have used it before and didn’t want it controlling my 1000lb z-axis assembly.  I have had good results with Centroid’s Acorn – but only 4-axis – so no luck there.  WinCNC was familiar because I once owned a Shopsabre router – and I remembered how nice the INI file based parameters were to deal with.  It also supported 6-axis control and had lots of IO.  This was it.

WinCNC is a software plus PCI card control that runs on Windows.  There is an interface board that handles connections.  The hardware card does the timing and communication so Windows isn’t a liability – and it sure makes loading programs easy!  While not an obvious control choice for an industrial 5-axis, WinCNC is a very popular control for mid-range 3-axis machines (Shopsabre, Camaster, CNTMotion, Techno…) and is totally robust compared to some of the more hobby-level controls.  A PC control will always feel different and less “purposeful” than an industrial control like the Fagor that came off this machine – and that’s ok.  It’s also very handy in a lot of ways and much less expensive!

I considered three motor options before settling on DMM Servos.  The cheapest would have been big steppers.  This was something I had used on my big 3D printer experiment and it worked ok, but only for low speeds.  I wanted to have some type of alarm-out feature if the machine lost position – or more likely – crashed!  Clearpath servos are a really nice option and I would have loved to consider them more closely but they didn’t have NEMA 42 frame size and I would have had to do some major bracket surgery to make the larger frames work.  None of the NEMA34 size motors were powerful enough to run the X,Y or Z axes.  I already had three smaller NEMA34 DMM servos from another project and these were going to be fine (I hoped) on the rotary axes.  I tried running the table (Y-axis) with one of these (86M-DHT-A6MK1) but it didn’t have the power to start and stop the heavy table at a reasonable speed – and it would randomly overload.  

New Hardware

So I ordered a WinCNC card and software set and also got the small PC pre-loaded with the PCI card and the software.  I could certainly have set up my own PC but I didn’t have one and wanted to be sure it would work on the first try.  The CN1/CN2 Interface Board seemed like the best choice to break out all the step/direction signals and the IO for limits, inputs and control relays.  It’s a big card and everything is easily accessible.  One great thing about the control cabinet on this machine is that it is huge – I can stand in there!  

So the WinCNC shopping list included:

  • WinCNC low profile PC with PCIe card installed
  • Daughter-board with Analog spindle control
  • CN1/CN2 Interface Board
  • Wireless Pendant
  • WinCNC software with ATC, analog spindle and pump control options.

For the servos, I used:

  • 2 NEMA34 750w Servos (86M-DHT-A6MK1) with the matched DYN4 drives and cables.
  • 3 NEMA42 1300w Servos (A15-DST-A6HK1) with the (different) DYN4 drives and cables.  One motor was ordered with a 24v DC brake for the Z-axis.

I ended up making the connections from the DB25 connectors on the DYN4 drives to the WinCNC interface card with a mix of connectors, but the ones from DMM (sold for Centroid Acorn connections) needed to have a resistor removed and replaced with a small jumper to use the voltage that WinCNC wants.  The others were breakout connectors with screw terminals that I got on Ebay.  In hindsight I would have changed them all to the same thing – probably pre-made connectors from DMM with the modification – because that’s more secure and tidy.  I may still!

Finally, for the spindle I wanted to run the whole thing on 208 three-phase and didn’t want the compressed air-cooled spindle with it’s 460v power and 12hp.  I happened to have a nice used HSD 919 (8kw) spindle from a parted out AXYZ router.  I also had the Commander VFD that had run it in that machine – so I used that.  I needed to add power to the fan but that was not a big deal.  Getting the analog control to work wasn’t totally obvious and I had to ask for help from Kelly at WinCNC.

I reused as much of the old control cabinet gear as possible and even though I reduced the main voltage from 480 to 208, most of the old fittings adapted ok to the new situation.  Relays and wiring and some of the sensors were useful too.  I kept the general layout the same, though my main interface board took up a bunch more room than the original IO boards from the Fagor 8070.  

The Process

Attaching Servos

I had to do some bracket surgery but not much.  The Y,Z, B and C axis motors just bolted right up to the frame because they were the same frame-size.  The original gantry (X) axis motor fit inside the tube, but my new one wouldn’t fit with the DMM plugs being a different shape than the Fagor ones.  I flipped it around and made aluminum brackets after 3D printing a test-set.  The table (Y) axis fit fine but I needed to make new couplers for the timing pulleys.  This involves reaming out for different couplers and buying random things off Ebay and generally making it work.  Not elegant, but effective!   

The Z-axis brake took some guess-work to integrate into the WinCNC “PLC” – and to coordinate with the air-fault system.  If the air balance if off any you release the motor brake – well you can guess what happens!  I did have an oops with that one time but it didn’t fall more enough to do any really serious damage.  If you’re dealing with a similar situation – be careful!

Modifying Electrical Cabinet

The servo drives went in a row across the cabinet where the old (and much larger) ones had been.  These got power hooked up to 110v for the drive and 208v 3-phase for the line-in.  Line-in power came through a contactor that only got switched on when WinCNC was on and in a no-fault condition.  E-stop and servo power went right off.  Servo fault and same thing.  The drives keep their own power on so you can plug in the USB cable or look at the flashing light and find out what’s up.  They do need to be powered down to reset, so I did plenty of switching on and off the main power.  It would probably be a good idea to put the drive power input on a different contactor so it could be reset without shutting off the main line.  

The VFD went in the same place as the old one.  Fortunately the spindle cables from the 3-axis donor machine were just the right length, so I snaked them through and re-usd them here.  This saved me the trouble of making new connections at the plugs.  As it was, I re-worked one of the covers on the head to hold the spindle power, air and sensor connections.

There was a lot of extra wiring that I just ripped out.  I think the original control box was wired on the bench with all the connections made for the standard machine.  There was no tool changer on this machine or safety mats or any of the many other things the standard Quintax control PLC was called on to do.  All the wires were there to break out all the IO module connections.  So figuring out which wires were limit switches or oiler sensors vs those that were just extra took some looking.  Fortunately I had the PLC program from the Fagor control and could look at which pins were doing what.  This helped!

Tuning Servos

So I was in a big hurry to power it up!  I got all the wiring done and set up a basic WinCNC INI file to assign the axes to the right interface card ports and pins.  I had the screw pitch and “gear ratios” for each axis so I could estimate the steps per inch – I used inches because I’m used to them – because American!  Each axis got run through the “auto tune” routine on the DMM servo interface application.  This connects to individual drives with a USB cable.  

The auto-tune failed on the C-axis (the one that rotates around a vertical axis) because it went right into a Wittenstein Alpha Gear and then to two huge gear-gears.  The inertia of this… well I have no idea.  I ended up estimating and using something that was similar to the B-axis.

The B-axis is timing-belt driven to a big harmonic (I think) drive gearbox that is about 30:1.  This auto-tuned fine and I went with it.  

For the other axes, the auto-tuning worked ok but it gave very different results.  I tried this at first but there were major chattering issues with the cutting and the general coordination between the axes.  I had some e-mail correspondence with Michael at DMM and he guided me toward a more evidence-based approach to tuning.  Each of the three main axes is ball-screw driven (rotating screw) with a reduction via timing belt.  The calculated inertia of each is not the same – but close-ish – at least compared to what the auto-tune said!  I ended up having the best results by setting them all the same.  The main, speed, and integration gains are the same for all three axes and this seems to give the smoothest results.  

There is some confusion (still) about how the smoothing/lookahead function in WinCNC actually works.  I went back and forth between adjusting servo tune and parameters in WinCNC and finally had the best results by making sure that all the axes were behaving the same, even if the loads were not the same.  The servos don’t seem to mind!

WinCNC

The configuration of inputs and outputs and machine configurations is done through a text file called “WINCNC.INI”.  This is like a “parameters” that you’d find on an industrial control – but all in one file and in a more readily readable format.  The manual documents this very well.  

Here’s what an axis definition looks like:

[B Axis]

axisspec=p3 r734.319 o1 e1 t4 a1600 f2000

axisvel=r1600 f1600 s200 m600 h1200 c10

axislo=p0 b3 o0 d4

There is no PLC functionality in the normal sense – you could set this up outside the control if you wanted to – but I didn’t.  Instead, the control offers the option to read inputs “auxin” and then to use the “enab” function to control and output (“auxout”) and flag a message.  For things like servo or air faults this is fine – sort of an “If… Then:” logic.  For the tool changer or for probing or custom routines, you use “macros.”  These are individual text files – which are G and (WinCNC specific) M-codes combined with some logic and monitoring “L” codes which are also built into WinCNC.  Macros can be called using custom M-codes defined in the “CNC.MAC” file.

This is the WINCNC.INI file section that shows how I handle air and servo fault logic:

[Aux Outputs]

auxout=c1 p4 b0 s1 e0 x1 w1 [Servo Power]

auxout=c2 p4 b1 s1 e0 [Servo Enable]

[Aux Inputs]

auxin=c1 p1 b0 o1 [Servo Alarm]

enab=c1 t1 m”Servo Fault”

auxin=c2 p0 b5 o0 [Air Fault]

enab=c2 t1 m”Air Fault”

So servo faults shut power to the 3-phase input to the drives via a contactor.  An air fault only removes the enable to the drives.  This also causes the z-axis brake to lock up (controlled by the drive itself) so that if there is no air, the z-axis doesn’t come crashing down if an air hose breaks.

This took me some time to figure out.  Still not sure I have the best way to do this, but this is what seems to work.  The WinCNC manual should give more in the way of examples here!

Spindle Speed

In this situation, with this VFD, I used an analog 0-10v output to the vfd and a return signal from the VFD to the interface board.  The interface board has three spindle speed control terminals.  The first is the common, followed by the AVI (analog voltage in) and then the 0-10V control voltage.  Once these are connected to the VFD (depends on the VFD – I had the manual to mine and it became obvious how to set this up.  My VFD had been running this spindle before so I had a minimum of reprogramming to do.

In the INI file, my spindle was set up like this:

da=t1v10

spindle=t1r18000

Calibrating the spindle speed to the analog voltage took some doing.  There is a little pot on the daughtercard that connects to the WinCNC PCI card – so you have to open up the computer to get at it.  Using the Calibrate DA Card function in WinCNC and a RPM measuring device with a reflector on an empty tool-holder.  Starting with the highest spindle speed I wanted to use (here 18,000rpm) I set the 10 volt DA calibration value to 511 and turned the little pot until I had 18,000rpm – which was 400hz on the VFD.  Then I worked my way down the speed range setting each speed to a corresponding frequency on the VFD.  The pot only needs to be turned for the initial setting at the top of the voltage range.  

G09 and Accelerations

Kelly at WinCNC was extremely helpful and spent at least an hour or two helping me understand the somewhat obscure lookahead and acceleration settings through several e-mails.  The upshot (or my understanding of it!) is that the accelerations for G1 moves (f# in the “axisspec” line) is very important.  This is how my X-axis looks:

axisspec=p0 r7843.48 o0 e0 t1 a1200 f600

The G09 setting is more about what happens as direction changes.  It isn’t look-ahead in the sense you’d expect from an industrial control – but it kind-of is.  I tried G09 from 5 to 100 and ended up in the middle – around 30.  This is where I was told to set it initially by Kelly at WinCNC!  More important was the servo tuning when it came to making the machine move smoothly – before I tuned the X,Y and Z servo drives using the same settings, the motions were a bit choppy.  

The other thing that was suggested is to use more decimal places for the numbers output in the G-code.  My post initially was set up for XXX.XXX (3 decimal place) style number output.  Kelly suggested I use six decimal places instead of three and this seemed to help.  

Tool Changer

This machine never had a tool changer.  I decided to build a simple rack-style one across the back of the table.  It uses some 8020 extrusion so I can adjust it and bought-off-Ebay ISO-30 tool forks.  WinCNC allows you to program in the physical position of the tools in the tool changer and then use macros to run the tool load and unload operations. 

 I also made a manual change macro (M6) that allows me to manually swap tools, but I have to update the tool number manually to get the offsets to switch.  These M codes are part of WinCNC, allowing some basic logic:

M17C5 [WAIT SPINDLE STOPPED – C5 is the input from the rotation sensor]

M17C6 [WAIT BUTTON – C6 – input for the button the the spindle – so hold down C6]

M11C3 [DRAWBAR OPEN – actuates the drawbar solenoid – output C3]

M11C4 [CONE AIR ON – actuates the solenoid for cone clearing air – C4]

M18C6 [WAIT BUTTON RELEASE – when you let up spindle button C6]

M12C3 [DRAWBARR CLOSE – C3 close drawbar solenoid]

M12C4 [CONE AIR OFF – stop cone blow air – C4]  

WinCNC has a table for tool offsets that use the same tool numbers as the tools themselves.  

Getting the tool change macro to work took a few tries, and I had to be sure that G92 positions were off or it would do some unpredictable stuff (like moving on an angle through the tool bar!) – so watch out!  WinCNC has some unusual handling of work offsets (like G54,G55, etc.) and instead uses positions as work offsets (and work offsets to control separate spindle positions) – not obvious.  

Calibration

I had a pretty good idea of the X,Y and Z calibrations but I did a careful calibration using a Haimer 3D probe and a precision level with an accurate length.  I confirmed this with the actual table measurements – the original machine setup probably included milling the face and perimeter of the aluminum table.  These two things helped me get the X,Y and Z dialed in.  

For the rotary axes I started with a precision square and dialed in plumb close enough and then with a precision rod in a tool holder and a dial indicator.  It is easy enough to get -90 and +90 on the B-axis by just making the rod parallel with the table by jogging small increments until it reads the same all along the length with an indicator.  For the C-axis I used the rod in the spindle horizontally and jogged the table back and forth.  WinCNC’s manual gives an example of how to calculate the steps per unit given an error.  

The biggest issue with the rotary is the accuracy of the limits switches.  I am going to look into converting these to a reference pulse homing.  The DMM servo drives give a reference pulse (ZRI (+) and (-) on JP5 DB9 – see page 20 in the manual) so that should be able to be used as a secondary home switch after the machine has homed to the limits switches.  I think this would have to be done with a separate command after the main homing routine has been completed.  

Conclusions

Don’t do it!  I’m not sure I’d take this one on again – or maybe I’d have tried to hire somebody to repair the Fagor installation.  The problem was that I had a good idea of what the machine would be worth in the used market – and I had an idea how much it would cost to have a professional retrofit done.  The numbers didn’t really add up in my favor.  And I already had a working 5-axis with a bigger envelope so this would have been nice but not necessary.  Maybe a retrofit option like MachMotion or Centroid would have been better – certainly more expensive – but maybe a better investment overall.

The more positive perspective is that for very little money (as these things go) I got a working 5-axis with completely current electronics.  If you have (or can find) a broken machine that might be going to the scrapper and you don’t want to spend much money but want a project – this could be a great way to breathe new life into it. 

My goal with this write-up and video is to show one method that one person used to get ok results.  I did a lot of research and made some not-so-great decisions and wanted to share what I have learned so hopefully it will help somebody else out.  It should be obvious now that I am no expert CNC repair guy – so don’t quote me on any of this – and don’t be mad if you try to do what I do and things go “pop” or “crash”!  Please be very careful – but have fun with it too!