Spindle Control

discussion of design changes / improvements / suggestions
Post Reply
lowside42
Posts: 12
Joined: Thu Aug 29, 2013 9:25 pm

Spindle Control

Post by lowside42 » Fri Mar 14, 2014 4:53 am

I finally got around to wiring my ShapeOko 2 to control the spindle/vac from the grblShield pinouts. This is a really handy upgrade for any long running jobs since the g-code now starts everything up and shuts it down once the job is complete. No more spindle running in mid-air for 20 minutes before I remember to go check if the job is finished yet :lol:

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.

Pins/headers
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.

Image

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 :oops: ) 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.

Image

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.

Image

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?? :shock: ).

Image

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.

Alternate Relay
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.

g-code
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
Additional Pictures
Image
Image
Image

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.

-lowside

lordmundi
Posts: 207
Joined: Wed Jan 01, 2014 4:02 am
Location: Friendswood, TX
Contact:

Re: Spindle Control

Post by lordmundi » Fri Mar 14, 2014 5:44 am

congrats... i like this idea. Curious, are you switching both the vacuum and the spindle on the power switch tail relay?

lowside42
Posts: 12
Joined: Thu Aug 29, 2013 9:25 pm

Re: Spindle Control

Post by lowside42 » Fri Mar 14, 2014 12:49 pm

lordmundi wrote:Curious, are you switching both the vacuum and the spindle on the power switch tail relay?
Yes, they both switch on from the relay. It's behind the machine, so you can't really see it in the picture, but I have a small powerstrip plugged into the end of the Power Switch Tail and the vac and spindle are both plugged into that. This was actually an additional reason that I went with the Power Switch Tail over the SparkFun kit, since the PST is rated at 15amps which is more than enough to run everything. I think some of the components on the SparkFun kit are only rated to 8amps which was pushing things a bit. It can be assembled without those components to increase how much current it can handle but the power switch tail just seemed simpler all around.

dcartier
Posts: 16
Joined: Mon Feb 17, 2014 6:53 pm
Location: Brampton, Ontario

Re: Spindle Control

Post by dcartier » Mon Mar 17, 2014 2:38 am

Just curious, in the photo it looks like you have 2 C-clamps on your Z stepper? Are they on the motor or the peg board? If they are on the motor what are they being used for?

Dennis

lowside42
Posts: 12
Joined: Thu Aug 29, 2013 9:25 pm

Re: Spindle Control

Post by lowside42 » Mon Mar 17, 2014 3:56 am

dcartier wrote:Just curious, in the photo it looks like you have 2 C-clamps on your Z stepper? Are they on the motor or the peg board? If they are on the motor what are they being used for?
When screwing in the brass standoffs that attach the Z stepper to the bearing plate, I somehow managed to strip out the threads for the screws that hold the stepper halves together. I think this was due to the threaded ends of the brass standoffs being too long, but not 100% sure. At any rate, the C-clamps are holding the stepper together until I get a replacement or come up with a better solution :oops:

It's a bit of a bodge job I know, but believe it or not seems to be working as well as the original screws as long as I keep the clamps tight.

Auzze
Posts: 38
Joined: Thu Sep 05, 2013 8:30 pm
Location: Ballarat, AU

Re: Spindle Control

Post by Auzze » Mon Mar 17, 2014 6:40 am

Hey,

I have been planning to use one of these, superPID.
http://www.vhipe.com/product-private/SuperPID-Home.htm

bit pricey but works great..

Cool Hey,
Auzze
Shapeoko #1996F w/ double MakerSlide (500mm) X-Axis, (750mm) Y upgrades, Acme Screw Z-axis, ¼″ drive shaft, Outside belts, cable drag chain.

http://oz3dprint.info/

dcartier
Posts: 16
Joined: Mon Feb 17, 2014 6:53 pm
Location: Brampton, Ontario

Re: Spindle Control

Post by dcartier » Mon Mar 17, 2014 10:35 am

lowside42 wrote: When screwing in the brass standoffs that attach the Z stepper to the bearing plate, I somehow managed to strip out the threads for the screws that hold the stepper halves together. I think this was due to the threaded ends of the brass standoffs being too long, but not 100% sure. At any rate, the C-clamps are holding the stepper together until I get a replacement or come up with a better solution :oops:
Ah, that makes sense. That was the only thing I could think of is that you were holding the stepper together with them. What had me baffled was why you needed to hold the stepper together :D

My next purchase (after a DW660) will be a SuperPID as well, now that I actually have something that can benefit from it!! I have been following its development by RomanLini for years on CNCZone.

I also plan on cutting a set of magnetic limit switches based on another one of Roman's excellent threads.

Dennis

Post Reply