As usual with most of my projects, as soon as I get started I completely forget to take any "in progress" pictures but hopefully this will still be helpful to anyone else wanting to set up spindle control.
There are two pins on the grblShield that we're interested in, the ground pin and D12 pin which supplies +5V when the spindle enable command is sent.
Unfortunately, there aren't actually any pins or other headers on the grblShield so we're going to need to add some. You could certainly solder wires directly to the grblSheld, but I wanted something a little more flexible and professional looking (especially given my less than stellar soldering skills ) so I opted for a set of female arduino headers for my connections. The other nice thing about using the headers is that it should make wiring up limit/homing switches much easier down the road since they use this same row of pins.
We'll need to solder one of the 8 pin arduino headers into the extra set of through-holes in the board (see image below). You could also de-solder the existing male pins and replace them with arduino passthrough headers so that you could stack another shield on top later. It seemed like a lot of extra work to me so I just used the extra set of holes.
Power Switch Tail Relay
Next we need a relay that will take the low (5V) voltage output from the arduino and use it to switch on our mains power devices (spindle, dust control, etc.). There are a couple of different options for this that I considered but ultimately I decided to go with a Power Switch Tail II relay http://www.powerswitchtail.com/Pages/default.aspx. It's pretty affordable at $26 and saves me having to build something that uses voltages that could kill me if I do something wrong (did I mention my lack of soldering skills?? ).
Wiring the device is dead simple: attach the ground pin from the arduino to the negative terminal on the Power Switch Tail and attach pin D12 to the positive terminal and you're good to go. You can test to make sure everything is wired correctly by firing up your favorite g-code sending program and sending the M3 (spindle enable) command which should cause the red LED to light up. Send command M5 (Spindle disable) and the light should turn back off.
The other main option I considered for my relay was this kit offered by SparkFun https://www.sparkfun.com/products/11042. This is definitely a much cheaper option, but a number of reviewers expressed concerns about the design and that was enough to steer me toward the Power Switch Tail. That said, plenty of people have built the kit with great success so go with whichever option you're comfortable with. A full tutorial on building a relay controlled outlet is provided by SparkFun here https://www.sparkfun.com/tutorials/119 if you want any additional details.
Now that everything is all wired up, you just need to make sure that whichever program you're using to generate your g-code is correctly inserting the M3/M5 commands to start and stop the spindle. I've been using CamBam primarily these days and it inserts these by default but you'll need to double check whatever CAM tool you're using. If the commands are missing you can just edit the g-code file by hand in any text editor to add them in at the beginning and end of the file. Below is a sample program that cuts a 20mm square just as an example.
Code: Select all
( Made using CamBam - http://www.cambam.co.uk ) ( Untitled 3/14/2014 12:46:53 AM ) ( T0 : 3.15 ) G21 G90 G64 G40 G0 Z3.0 ( T0 : 3.15 ) T0 M6 ( Profile1 ) G17 M3 S1000 G0 X0.0 Y-1.575 G0 Z1.0 G1 F300.0 Z-0.5 G1 F800.0 X20.0 G3 X21.575 Y0.0 I0.0 J1.575 G1 Y20.0 G3 X20.0 Y21.575 I-1.575 J0.0 G1 X0.0 G3 X-1.575 Y20.0 I0.0 J-1.575 G1 Y0.0 G3 X0.0 Y-1.575 I1.575 J0.0 G0 Z3.0 M5 M30
Hopefully this will be useful to other ShapeOko owners out there. It ended up being a relatively simple modification, and it really makes running long jobs a lot more convenient.