Duet CNC Controller – Part 5

VFD Wiring and Programming

So in this video I’m going to connect the variable frequency drive which is that thing over there, to the spindle using it cable. Luckily someone who has already built a moot one CNC machine happen to already use one of these style invertors and has left me some notes so I can hopefully programme it a little more easily.

The notes didn’t make a great deal of sense at first, but I eventually worked out the right settings which I’ll share as a PDF document on my Patreon page. But before I start programming the VFD I have to connect the spindle to it.

The wiring order between the VFD and spindle is arbitrary – if it spins the wrong way just swap any two wires around at one end.

I went to use the cabling that I had from the previous machine, but later realised I had made some mistakes. In the new VFD manual there are clear instruction about doing this – well sort of clear.

It’s like a weird Christmas decoration.

1 – I’m using the base of the VFD as the earth conductor. Plus I have a backing plate.

2 – The backing plate is galvanised so it won’t rust and provides a common contact point for all the components and will help protect them from electromagnetic interference.

3 – I have the ferrite core – but you only had to coil the three motor cables and not the earth.

4 – I don’t have a metal clamp for the armour which I’m using as shielding – but I can either drain that to the backing plate or earth terminal on the VFD.

5 – I’m using SY cable which has braided screening although foil is meant to be better, but I’m not sure why it says to use 4 core cable here when there’s only three in the diagram.

6 – I hadn’t separate the protective earth cable from the three motor cores. Although it does say: “this is the preferred method specially for large output cables and long lengths. Multi-core screened (3 core & protective earth) can be used for small power and short length. I think using 4 core is ok, but it’s not clear what is a large output cable and long length.

7 – This is where all the advice on shielding cables from one end only, on all the CNC forums in contradicted. As it’s required to connect the shield with a good 360-degree termination to earth at the spindle as well as clamping in section 4.

8 – And that protective earth goes back to the terminal on the VFD outside the ferrite core.

To edit the different functions in the various groups you first need to press mode button several times until you see the function numbers. You can then change the digits with the up and down buttons and use the left arrow button to move between the individual digits. A long hold on the left arrow button – which also functions as an enter button, reveals the mode value, which you can aso change with the up and down arrows. Once those are changed, a long hold on the enter button ends the editing and sets the new values.

I think what I’m going to do, is crack on with this and implement what I’ve got here and see whether it works for my setup. And then I’ll get this stuff into an excel document which I can go over on camera a little more easily.

Ok so this is the excel document I’ve written up. These are the various groups and they have different settings. So group four is the Analogue Signal Input, which I didn’t actually change much here. What I did change was the Multi-Function Digital Inputs/Outputs, so that I could create the sort of behaviours I wanted to have on the CNC machine, such as number 14 which is rapid stop. And that particular termina, S4 – is connected to my emergency stop.

One thing I did do on this machine which I didn’t do on the old VFD, was to change the motor rating – even though my spindle had an etching on the side to say it was 8 amps, I specified it’s rating to 80% of that and the no load current to 10%. I also dropped everything down to 20% for the slip compensation gain. I might change that to 10% – I just don’t think it needs to be as high as it was set before. Oh and I didn’t notice this bit before – so you can actually change the way the signal works by making it either normally open or normally closed.

That’s interesting because it means I can set up an external switch trigger, such as the e-stop so that if disconnected it will read as triggered – which provides an additional failsafe which is what I’ve done with other buttons directly to the duet. Although that’s only a true failsafe if the estop alarm can alert the duet board and prevent a job from actually running.  So many things to think about.

Ok so I am in the process of programming the VFD and you can see I’ve got some cables coming through it. And they are coming to this section here (buttons) as well as to the 24v to 10v pwm adaptor.

The important initial settings were 00-04 – Operation Mode For External Terminals, which is set to 1. This makes the S1 inputs start and stop the spindle, and S2 input define the direction, which is either reverse or forward. S1 is wired via the PWM converter from the duet, but I’ve not wired S2 as it’s very unlikely that I’ll ever run a tool in reverse. To control the speed, the signal and ground from the PWM to analogue convertor is wired into AVI and AGND on the VFD.

And I’ve also been able to select between two different speed inputs so I can go from the controller, and then by flicking a switch use a potentiometer on the VFD.

I then set S3 to 13:Main/Alternative Frequency Command select, which is wired to a latching two position selector switch. While option 00-07 is set to 0:Main Or Alternative Frequency, one switch position select the main input mode via 00-05, which is option 2:External AVI Analog Signal Input and the second position for now utilises option 1:Potentiometer on Keypad, but I’m planning to install a signal generator and use option 3:External ACI Analog Signal Input.

So at the moment if I try to move the potentiometer it doesn’t do anything but if I flick the switch you can see you can set the speed based on this, and it ignores the input coming from the controller. Back to zero. I’ve also wired in an estop directly to the VFD so that it would stop a little bit quicker when it’s pressed but what I found was you need to use a latching style estop – like this one here. So when it’s pressed it clicked into place and then you have to twist to reset.

S4 is connected to the emergency stop which is now a latching type, and performs option 14:Rapid Stop (Deceleration to stop) – the speed of which is defined by option 00-17 and is set to 5 seconds. Under a normal stop, option 00-15 sets the speed and this is 9 seconds.

S5 is unused.

If I send an M3 S20000 command, the spindle turns on. And you can see the potentiometer doesn’t do anything. And when I turn this switch, you can see I can adjust the speed. And if I press the estop, it shuts off in four seconds and I get an emergency message on the screen plus I am asked to reset the controller. If it is press and I try to reset the machine, it’s going to think it’s disconnected, and I won’t be able to move on from there.

Until I address the issue – although later I will wire the estop to trip the NVR switch so this message will only ever turn up if one particular wire becomes disconnected.

Question is what will happen to the spindle during a power outage – so if the NVR switch was pressed. So we’ll do the same thing, M3 S20000 and let it come to speed. And I suspect it might coast –  so we are at max speed. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14… 20.

There are some issues with the spindle stopping that I need to sort out – such as the spindle coasting to a stop if the main on / off button is pressed or if power is lost. And that the virtual e-stop in the web interface and on the panel due does not behave the same as the physical one.

I’m going to turn this on again and see how much time it takes for the spindle to stop if I use the emergency stop in the web interface, or on the touch screen. Powered up and connecting to the controller – M3 S20000, send. And I’m going to press this one over here.

I’ve requested on the duet forum if the M112 command be amended to also switch a pin which could be used to trigger the VFD but we’ll see if any of the programmers bite on that one. I suspect there’s probably a way of using variable expressions to create this behaviour in relation to that command, but I just don’t have the time at the moment to learn something new.

The last few things I did, included sorting out the earth wire from the spindle which I forgot to film so here, a photo, exposing a bit of the cable braid and connected it to the backing plate. Wiring an RCD plug end to the CNC power cable. And to connect the live wire before the NVR using a couple wago connectors, in series to the normally closed and common terminals of two channels on a relay module. I then connected their inputs terminals to the Estop and PS_ON pin so that I could shut the entire system down by tripping the NVR either during an emergency stop or by sending an M80 command.

I’ll let it come up to speed. I think that worked. Basically if this (Estop) is pressed it won’t turn on, but I think you got to be careful in that situation because it could cause a short or fry something. So I think this video has reached a natural end – there was again a bit too much information there but I hope it will help make wiring and programming the VFD a little more simpler. You may have noticed some wiring illustrations in this video and those will be available via my patreon page in drips and drabs while I still make sense of everything.