Controlling VFD with gcode

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