Spindle Control

Discussion about the arduino based g-code interpreter, grbl

Spindle Control

Postby RaymondOverman » Wed Jun 04, 2014 12:24 pm

Is there a way to change the spindle control so that it is on when you power on the arduino? I understand that the relay I'm using (or is it the Arduino) uses the opposite logic I need for spindle control and I can turn it off/on with M3/M5 but I can't quiet wrap my head around how to Invert the signal and get the result I want. Can anyone ELI5 this or provide an easy solution to this?

Here are the components I'm using. Ignore the wiring, it's changed since I took the picture.

Components.jpg
Components.jpg (151.28 KiB) Viewed 1794 times
SO2 / NEMA 23s / 5 axis SainSmart BOB and Drivers / DW660 Spindle / Rotary Axis / Spindle-Vac Relay / LimSW / Fender Wells / Drilled and Tapped 1"x8TPI Waste Board
RaymondOverman
 
Posts: 50
Joined: Tue May 20, 2014 8:13 pm

Re: Spindle Control

Postby Tom Smith » Wed Jun 04, 2014 1:21 pm

Apparently you can set start up commands using $N# where the '#' is 0,1,2,etc...

Check to see if there are any existing commands set by issuing a $N to the arduino using a grbl sender first, and then use the first empty number for your own command.

Therefore, if you set something like this:

$N0=M3

The command should be executed at start up, activate your relay and power the spindle.

This seems dangerous, mind you, so please be careful.

Reference link - https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.8

Tom

PS. I haven't actually done this myself, so please let me know if it works or not :)
Last edited by Tom Smith on Fri Jun 06, 2014 6:18 pm, edited 1 time in total.
_______________
ShapeOko1 191
Tom Smith
 
Posts: 297
Joined: Mon Apr 09, 2012 9:55 pm
Location: North Vancouver, British Columbia

Re: Spindle Control

Postby RobCee » Wed Jun 04, 2014 2:00 pm

Raymond, can it be as simple as switching your connection from the N/O to the N/C on the relay output? That should invert the logic, as you describe. Then you should be able to use M3/M5 commands.
ShapeOko2 #3400 - Chinese 800W AC Spindle - Stiffened X-Axis - TR10 Z-Axis - Inverted Z Motor - Hall Effect Limits - Drag Chains & Custom Brackets
RobCee
 
Posts: 587
Joined: Wed Jan 08, 2014 11:33 am
Location: Birmingham, UK

Re: Spindle Control

Postby RaymondOverman » Wed Jun 04, 2014 2:28 pm

The problem with that solution is when the Arduino is powered down, the relay is closed and the outlet is hot. Hitting the e-stop wouldn't shut off the spindle in that configuration unless I wired the spindle power through the e-stop with the arduino power wouldn it? That opens the chance for problems with interference since the controller and spindle are on the same circuit.
SO2 / NEMA 23s / 5 axis SainSmart BOB and Drivers / DW660 Spindle / Rotary Axis / Spindle-Vac Relay / LimSW / Fender Wells / Drilled and Tapped 1"x8TPI Waste Board
RaymondOverman
 
Posts: 50
Joined: Tue May 20, 2014 8:13 pm

Re: Spindle Control

Postby RobCee » Wed Jun 04, 2014 2:46 pm

Hmm, good point.
ShapeOko2 #3400 - Chinese 800W AC Spindle - Stiffened X-Axis - TR10 Z-Axis - Inverted Z Motor - Hall Effect Limits - Drag Chains & Custom Brackets
RobCee
 
Posts: 587
Joined: Wed Jan 08, 2014 11:33 am
Location: Birmingham, UK

Re: Spindle Control

Postby RaymondOverman » Wed Jun 04, 2014 4:05 pm

Tom,

I didn't see your reply before my last comment.

This might work. It would effectively interchange M3 (start spindle) and M5 (stop spindle) since that's the way the logic works with my electronics anyway. When the e-stop is triggered there won't be any voltage on the arduino side so the relay opens and shuts down the spindle for safety but when it's turned on, it immediately issues an M3 to power off the relay.

I'll test it tonight. The relay has a LED on it so I should be able to tell whether it's closed or open and run through a few scenarios without the actual spindle attached for safety.

Thanks
SO2 / NEMA 23s / 5 axis SainSmart BOB and Drivers / DW660 Spindle / Rotary Axis / Spindle-Vac Relay / LimSW / Fender Wells / Drilled and Tapped 1"x8TPI Waste Board
RaymondOverman
 
Posts: 50
Joined: Tue May 20, 2014 8:13 pm

Re: Spindle Control

Postby RaymondOverman » Thu Jun 05, 2014 1:11 pm

This didn't work as expected. If I'm connecting to the Arduino/GRBLShield it doesn't issue the M3 until I do a soft reset which means it's going to turn on the spindle. I didn't have a lot of time last night to look at it so I'm going to play with it some more.
SO2 / NEMA 23s / 5 axis SainSmart BOB and Drivers / DW660 Spindle / Rotary Axis / Spindle-Vac Relay / LimSW / Fender Wells / Drilled and Tapped 1"x8TPI Waste Board
RaymondOverman
 
Posts: 50
Joined: Tue May 20, 2014 8:13 pm

Re: Spindle Control

Postby Tom Smith » Thu Jun 05, 2014 3:37 pm

Interesting, I wonder what the missing piece of the puzzle is here.
Last edited by Tom Smith on Fri Jun 06, 2014 6:18 pm, edited 1 time in total.
_______________
ShapeOko1 191
Tom Smith
 
Posts: 297
Joined: Mon Apr 09, 2012 9:55 pm
Location: North Vancouver, British Columbia

Re: Spindle Control

Postby cvoinescu » Fri Jun 06, 2014 2:51 pm

I would bite the bullet and invert the logic of the relays. Because they have optocouplers, it may be very easy to change the board so that they are on on the opposite logic level. Do you have a schematic for the board, or clear photos that show all the traces?
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk
cvoinescu
 
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK

Re: Spindle Control

Postby McOtis » Mon Jun 09, 2014 6:58 pm

My experience with the GRLB and Spindle Control.
I have my spindle controlled via a relay as well, and whenever I hit the ABORT button (wired to the GRBL's abort pin), it resets GRBL and stops the spindle.
I have been using that for months as my "software" ESTOP and works great so far.

However your issue is strange.
Your spindle AC HOT should be connected to the NO connection on the relay.
Normally Open - aka the spindle is OFF.
The relay should only CLOSE when it gets the spindle ENABLE (high) from the Arduino/GRBL shield.
Again this assume you are using a HIGH triggered relay system. Is your relay board expecting the trigger to be low (aka grounded?)

On my enclosure I use two double throw double pole switches (ON / ON).
The first is actually used as simple ON/OFF switch, wired in series with the relay enable line. This allows me to manually turn OFF the spindle and prevent me or the GRBL from turning on the relay; basically a safety override if needed.
The second is wired in parallel to relay enable line and wired to a 5V high. This allows me to manually turn ON the spindle and jog the machine via manual software.
You would probably do with with one switch that was ON/OFF/ON but I made do with what I had.
McOtis
 
Posts: 80
Joined: Sun Feb 09, 2014 12:21 am
Location: Maryland

Next

Return to GRBL

Who is online

Users browsing this forum: No registered users and 1 guest