Vacuum automation

Can g-code turn on and off my vacuum for my machine, if so, how? I have a relay already but I am not sure if it is the g-code or the mach 4 software that turns it on, can I do both. I am using ethernet smooth stepper with a breakout board on port 1.

I have seen a lot of people that use the same spindle on/off signal from the Grbl to also start/stop the vacuum.

The gcode M03 will start the spindle and M05 will stop it.

Just be sure your 110V breaker can handle the surge of the spindle and vacuum starting at exactly the same time.

Below is what I bought for that application:
http://smile.amazon.com/gp/product/B0087ZTN08?psc=1&redirect=true&ref_=oh_aui_detailpage_o07_s00

I haven’t finished the box and setup yet but this will be triggered by the spindle on/off line.

This is what I bought for my smooth stepper
http://smile.amazon.com/gp/product/B00KTELP3I?psc=1&redirect=true&ref_=od_aui_detailpages00
The relays are for a water pump, vacuum, and some other stuff. Though I am not sure how to configure it with g-code or mach 4. My breakout board is this.
http://www.amazon.com/gp/product/B0093Y89J8?psc=1&redirect=true&ref_=oh_aui_detailpage_o05_s00
The relay on this board is for the spindle inverter I have.

Your configurable outputs can trigger those relays from your breakout board. If you want everything to turn on when your spindle turns on, you can chain the single output pin (like pin 10) to multiple relays on your board. You set it up in the ports and pins menu in Mach 3 - Port 1, Active High. I believe if you designate the desired output pin as “coolant” it in Inputs/Outputs it should cycle on and off with your spindle.

On your relay board, VCC gets 5V from your BOB. Connect the ground. Then, connect the output you choose from your BOB to an input pin and that relay will turn on and off (if you connect to COM and NO) with your spindle.

If you are connecting the output pin (like pin 10) to multiple input pins on your relay board, you need to make sure you have a good 5 volt power supply to your BOB. Not sure how much current is required to trigger those relays - you could measure it. Just make sure the total draw on your USB port is under 500 ma - especially if using a laptop or older computer without USB 3.0.

Alternatively and depending upon your setup, you can wire your relay to power outlet(s) instead of a single machine. I wired mine like this last night:

:: Power cable to “always live” 2-socket outlet (good for the computer / laptop power and other random power tools)
:: “Always Live” outlet to paddle-style eStop switch
:: eStop to new 2-socket outlet (where I plug in the Arduino) - this outlet and everything else downstream is killed by the eStop
:: eStoppable 2-socket outlet to relay
:: relay to new (eStoppable) 2-socket outlet that gets turned on when power supply spindle control is turned to logic. This is where I plug in the Dewalt 611 and vacuum.

Would it possible to use this technique to trigger an adhesive dispenser? The dispenser has a switch to control the flow and that could be replaced by a relay contact. I would need to move the dispenser into position (Z,Y,Z) then trigger the relay, then move the dispenser (X,Y), then stop the dispenser and move the dispenser (Z,Y,X)

I figured it out. I hooked up a relay switch to another port on ESS and have it on mist while the water pump is on coolant.
Thanks for the help!