Upgrade Name: AC Spindle control
Description: Shield that allows turning an AC spindle on-off through gcode.
A logic-level device like the Arudino that the CM controller is based upon cannot switch large Alternating Current (AC) loads by itself. In order to do this a device known as a Relay must be used. A relay is a sort of switch that allows a small DC voltage (like the 5V from the CM Controller) to turn on and off a much larger load on a different power source (like a router).
Since the pin that is used (Digital 10) in the stepper shield configuration can be used for PWM, this shield can support in the future spindle rotation speed control. Speed control is not supported currently by GRBL.
The shield is single sided to allow easy milling with the ShapeOko. Optionally the top side of the board can be used as an additional heatsink for the triac but it must be milled to isolate the main voltage from the circuit. The triac was put in a horizontal manner to save space and allow this to be stacked below the Stepper Shield. It also includes a screw terminal connected to the reset line to allow adding an external reset button to an enclosure.
Link to schematic and board in Eagle format, bill of materials, and optimized Gcode.
A fully enclosed, plug-n-plug relay solution: Iot Relay - Enclosed High-power Power Relay for Arduino, Raspberry Pi, PIC or Wifi, Relay Shield  --- discussion of installation: https://www.facebook.com/groups/unofficialshapeoko/permalink/285680405173259/?hc_location=ufi (requires membership in the unofficial Shapeoko Facebook group)
A more DIY Solid State Relay w/ heatsink: https://www.amazon.com/dp/B01MCWO35P/ref=cm_sw_r_cp_ep_dp_LM5Xzb44NGJSH
Forum discussions and examples
- http://community.carbide3d.com/t/can-you-control-router-power-using-gcode/3079/16 --- example from the Carbide 3D forums which shows an annotated image of the board and wiring details.
- Spindle Control
- PID Closed Loop Spindle Speed Control for Quiet Cut Spindle --- includes a graph showing non-linear nature
For single-speed routers/cut-out tools, some users have used a router speed control unit, such as the MLCS 9400 Standard Duty Router Speed Control to slow it down. Forum discussion: Re: DW660 Mods. Note that such units are simply a resistor which reduces the current, reducing torque --- only suitable for single speed motors (they will damage the speed control circuitry of variable speed trim routers such as the DWP611 and RT0701. The VFDs actually tie into the electronic speed control, include a device to measure the current RPM, and will adjust current to maintain the desired RPM as torque requirements fluctuate when cutting.
Complete DIY Solution
If you're looking for an end-to-end guide on adding spindle on/off control to your S3, this is your stop.
GRBL 1.1 and the Shapeoko 3 Carbide Motion control board are both capable of turning a spindle on and off at the command of gcode. However, this is not OOB functionality. In order to do it, we need to use the CM board to fire a relay and use the relay to turn on or off the routers that most of us use for spindles.
In addition to parts below, before getting started ensure that you have:
- A CM controller upgraded to grbl v1.1 (This may not be needed, but it's all I had to test on)
- CAM that is outputting spindle start/stop commands in gcode.
- Carbide Create does this by default.
- vCarve can do this using 3rd party post processors (see below)
- A knowledge of how to work safely with electricity
A Relay is the central part of this show, so… What’s a relay? A relay is a device that uses one, usually low-voltage, current to actuate a switch that engages a much larger voltage and current from a different source. In our case, we’ll be using the small 5V signal from the grbl controller to ‘switch’ the 120V used by the router. What type of relay should be used? There are two main types: Solid State Relays and Electro-mechanical relays.
- Completely non-moving relays that use circuitry to switch the load on and off
- More expensive than EMRs
- Usually lower-current
- Less ‘noisy’, as there is no physical gap-arc possible
- Less failure prone (no moving parts)
- Easier to wire up (usually)
- A mechanical elctro-magnetic switch that open and closes a connection
- Dirt cheap
- Noisy, as the current (possibly) arcs as the switch closes
- Can typically handle higher currents
- Still easy to wire up, but not as easy as SSRs
I’m going to be using a 25A SSR for my project. They are very easy to wire and for this application will make a cleaner end-product. No matter what sort of relay you choose, make sure its rated for at least 20% MORE current than your router pulls. The Makita is rated at 6.5Amps, so I would stick with a relay that’s good for 10A (to be on the safe side)
In gCode as grbl understands it, there are two commands that are used to turn the spindle on and off.
- M3S10000: Start the spindle spinning Clockwise (M3) at 10,000RPM (S10000)
- M5: Stop the spindle
Any time we want to start the spindle, we’ll use M3S10000. The number after the S corresponds to the PWM output of the pin we’re going to be tapping into – but don’t worry about that, we’re not controlling the speed of the router. For our purposes, just accept that the full command should be issued when you want to turn the router on.
This is the minimum parts list needed for this modification. Items noted with * are optional.
- A high-current relay (SSR or EMR) http://a.co/gDwagp6
- Soldering Iron & solder
- Servo leads* http://a.co/8gNopIl
- Pin headers* http://a.co/5M4sLcy
- Some 24ga or thinner wire (if not using servo leads) http://a.co/1z8SbZu
- A drill and tap* http://a.co/hLFK8En
- Desitin Diaper Cream (yes, really) http://a.co/1tVspC8
- Some 14ga copper wire
- Single pole 120V switch of some sort
This should be followed top-to-bottom. But please read through ALL of it first, then start at the top and work through.
Wiring the CM Board
Unplug your Carbide Motion Controller from all power, usb, steppers and switches and remove it from your machine.
Depending on your version, the board will be different. Here is a 2.4d board, but most will look vaguely similar to this
There are two different sets of pins in the upper corner of the board – a set of four and a set of six. Thankfully, for our purposes they do the same thing.
The top set (right box), showing a set of four pins, will be present on later revisions of the board – you may not have these. The two pins we are interested in are labeled GND and PWM.
The bottom set (left box) of six pins should be present on every revision of the S3 CM board. The two pins we are interested in here are the ones labeled as Pin 3 and Pin 6 in the diagram above. (Pin 3 corresponds to PWM and pin 6 corresponds to GND.)
For the sake of cross-compatibility, I’ll be using the block of six pins on the left. If you have the set of four, you can use those too, but YOU ONLY NEED TO USE ONE SET. Don’t short any of these pins to each other.
We need to attach some leads to pins 3 and 6. You can do this with some thin (~24ga) wire and solder directly to the holes on the board, or you can solder in pins. I’ve soldered in pins to both sets of holes here to make connection and disconnection easier, but this is not strictly needed. You need only attach TWO wires to pins 3 and 6 on the left block shown below:
Run the leads from Pins 3 and 6 through one of the holes in the CM case and plug all the stock bits and bobs back into the CM controller where they should be.
Note for VFD & Spindle users: If you're planning to use a true spindle with a discrete VFD instead of an AC trim router, you can stop right here. The GND and PWM pins are all you need to connect to your VFD. See this community thread for details on VFD setup
Wire up the relay
Safety note: We are dealing with main voltages here, with currents large enough to kill you. If you are not completely comfortable with 120V electrical work, do not proceed.
The input side of the relay gets attached to the two leads from the grbl CM board (pins 3 and 6). The output side should interrupt the Hot wire for your router.
In the diagram below the signal wires from the CM controller are blue and can be a small (26ga) wire. The black and white wires should be sized to carry AC current (14ga or larger). There is a physical switch wired in between the wall outlet and the relay. This is critical. You ALWAYS want a way to override and shut-down the router in case of emergency. In this configuration both the physical switch and the relay must be closed in order for the router to turn on.
Logical wiring Diagram:
Photo of final configuration:
Mounting the Relay
Solid state relays make a lot of heat. That’s just the way it is. Because of this an EMR is actually a bit simpler to install. The SSR linked to above comes with a large finned heatsink, but it’s possible to buy them without it.
I tested my relay by running my shop vac through it (11A rated current draw). The Makita router I use is rated at 6A, so the shopvac test is wild overkill.
I ran it for 20 minutes, three times. The first time was with no heatsink and the relay reached about 160F. Then I ran it with just the included finned heatsink and it reached about 110F. My final test was with the heatsink attached to the side of the S3’s aluminum rails. In this test it never broke room temperature.
I’m bolting the SSR to the exterior of the left hand rail, next to the CM control board using some #10-32NC socket-cap bolts.
Lay out the relay on the side rail and mark the centers of relay’s mounting holes. Use an awl or end punch to make marks in the aluminum. Then starting with a small bit make a starter hole, then slowly drill the holes out using the bit sized for your tap. Finally, slowly tap the holes for the bolts you have. I've used 10-32NF thread size with socket-cap screws and they fit very nicely.
Get some of the Desitin and smear a small amount onto the aluminum back of the SSR. This is superior to commercial thermal paste in transferring heat. Even if it weren’t, just pressing the back plate against the rail transferred enough heat to keep it cool.
Bolt the SSR to the rail;
Because we’ve got exposed 120V contacts, I’m going to liberally wrap the exterior of the SSR with electrical tape. This is safe enough for my shop, but please make it as safe as YOU feel it should be.
Post Processors and Final Notes
As noted earlier, in order to take full advantage of automatic spindle on/off, the gcode being passed to grbl needs to contain Start and Stop commands at the appropriate times.
Good news is that Carbide Motion does this already! Other CAM software may or may not.
Vectric's vCarve product is commonly used, but the included 'Shapeoko Inch' post processor does not pass any spindle control commands. There are new post-processors available, which are maintained on this thread in the Community:
These PP handle both spindle on/off control, as well as tool changes.
Note that one must configure Grbl, entering the maximum spindle speed into $30 
If you're a user of a dust boot or other vacuum solution, it might be worth running power from your relay/switch to an Outlet, rather than directly to a router. This way, a router AND a shopvac could be plugged into the outlet and both switched on and off automatically. Now of course, you'll need a much larger relay for this, or even a pair wired in series, but it's a nice further level of automation.