Using M4 or M3 GCODE commands to turn on/off the spindle motor

Anyone find a way to turn on/off the spindle motor with M3/M4 gcode commands? Have done this with Mach3 on another CNC machine.

Hi,
On the Nomad if you open Carbide Motion, there is a command prompt labeled MDI.
There are two ways two send code. M3 by itself to start spindle at lowest speed or S5000 M3, for example to start at 5000 RPM. M5 to stop spindle. I don’t know what M4 does. Also, if you place / before code, it supposedly sends code directly to GRBL and bypasses Carbide’s parser?
Hope this helps.
Jerry

Helps some but what is the mechanical setup to turn on/off the router? Mach lets you put a board into pc to access a relay.

I’m assuming you have a Shapeoko, which as far as I know doesn’t come with a motor controller board or even if that would work with a router and the Carbide electronics. Usually people are using VFD spindles with speed control boards which are plentiful on eBay. The motor is wired to and receives power from the board and can receive PWM commands from the g-code file. I actually have the Nomad which uses a stepper motor as the spindle and am curious how this actually works. I don’t know much about routers, but I thought they just plug into an outlet and don’t have provisions for software control. I personally believe you would be better off with a spindle since the speed range is much more useable for a larger variety of materials than a router. I never used Mach 3, so I am not sure if it is different from Carbide Motion in regards to how it interfaces with the electronics.

Anything here which helps?

http://www.shapeoko.com/wiki/index.php/Spindle_Control

I have AC relay boards that were connected to a PC with Mach 3. The issue is how to interface with the controller board and have the GRBL command processor support M3/M4. If you can connect limit switches to the controller then you should be able to connect external devices there also.