Controlling VFD with gcode

Hey there

Got our 1st cuts from MPCNC this weekend, was exciting and satisfying AF!

Now looking to control the spindle VFD from the cnc controller with gcode, in order to start up and shut down spindle as the job requires, especially for longer jobs that might run into the night.

We have an MKS Gen 1.4 controlling the motions, and a H100-1.5S2-1B china VFD. It’s got a whole bunch of control terminals, but no clue here on how to actually utilize them. If this was already addressed elsewhere, I apologize and humble request a link.

Picture of the VFD

Thanks in advance to anyone taking the time to read this!

A quick google found this video. in which they connect it to a Mach 3 and run it.

Also this thread looks to be a similar model.

And this looks to be a manual for it.

Hope that helps.

A

1 Like

If all you want is on/off, then the path of least resistance is to control a relay that turns MAINS power on/off. A number of people on this forum (including me) use this IOT relay for 110V (US) power switching, but any relay that you can control with a 5V or 12V signal will work. Marlin has g-code for turning fan pins on/off (M106/M107) plus an M42 can be used to control the state of arbitrary pins.

If you want to use a signal to control the speed of your VFD, then there are multiple topics on this forum that explore the issues and solutions. The issue is that VFDs expect a 10V PWM signal to control the speed of the spindle. Your MKS Gen 1.4 will either provide 1) 5V PWM signals, or 2) 12V PWM signals (Fan pins) that are highly likely to be ground side switching. Here is one topic that explores circuit diagrams to match the two devices, and here is a link to a module that is reported to do the same.

especially for longer jobs that might run into the night

There is a risk in leaving your machine running unattended. Fire is the big one, and we’ve seen a couple of instances on this forum where a CNC caught a house on fire. Personally, I’ve had a couple of situations where I was very glad that I watched my machine.

2 Likes

Never ever run the CNC unattended, this is not the same as a 3D printer.

1 Like