Page 1 of 2

Spindle Control

Posted: Wed Jun 04, 2014 12:24 pm
by RaymondOverman
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 2155 times

Re: Spindle Control

Posted: Wed Jun 04, 2014 1:21 pm
by Tom Smith
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 :)

Re: Spindle Control

Posted: Wed Jun 04, 2014 2:00 pm
by RobCee
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.

Re: Spindle Control

Posted: Wed Jun 04, 2014 2:28 pm
by RaymondOverman
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.

Re: Spindle Control

Posted: Wed Jun 04, 2014 2:46 pm
by RobCee
Hmm, good point.

Re: Spindle Control

Posted: Wed Jun 04, 2014 4:05 pm
by RaymondOverman
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

Re: Spindle Control

Posted: Thu Jun 05, 2014 1:11 pm
by RaymondOverman
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.

Re: Spindle Control

Posted: Thu Jun 05, 2014 3:37 pm
by Tom Smith
Interesting, I wonder what the missing piece of the puzzle is here.

Re: Spindle Control

Posted: Fri Jun 06, 2014 2:51 pm
by cvoinescu
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?

Re: Spindle Control

Posted: Mon Jun 09, 2014 6:58 pm
by McOtis
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.