Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: Rimbaldo on March 28, 2020, 09:41:01 AM

Title: Can Mach3 do CW and CCW in the spindle with just one relay and one output?
Post by: Rimbaldo on March 28, 2020, 09:41:01 AM
Hi!

I've got a micro lathe working normally in Mach3 with it's stock motor, in CW and CCW, with two relays (to invert the wirings of the motor) and two outputs in Mach3 to do M3 and M5.

I'm buying a new brushless spindle motor and controller to adapt in my lathe.

The controller has one input (DIRECTION) that when connected to it's own GND turns the spindle CW and when let it floating (or in 5V) does CCW.

And another input (ENABLE INPUT) that when connected to GND turn the spindle on, and when not, turns off

So, I just need one relay to do CW or CCW with this controller.

Is there a way on Mach3 to set both CW and CCW to only one OUTPUT (instead of the two outputs required in the Spindle Configuration Screen), and only one relay, and then when the OUTPUT is LOW, the relay would be off, the spindle would be in CW and when in HIGH, the relay would be on, and the spindle would be in CCW.

If not, how can I solve this?

Thanks!

Title: Re: Can Mach3 do CW and CCW in the spindle with just one relay and one output?
Post by: ZASto on March 28, 2020, 11:12:18 AM
You will need 2 outputs from your BOB to control 2 relays.
First relay for CW/CCW and second for Start/Stop spindle.
Second, you can edit macros in your Mach3/macros/'your profile' folder named m3.m1s and m4 m1s
For example:

Code: [Select]
m3.m1s

ActivateSignal(OUTPUTx) ' switches ON direction control relay
DoSpinCW()                   ' switches enable relay

Code: [Select]
m4.m1s

DeactivateSignal(OUTPUTx) ' switches OFF direction control relay
DoSpinCW()                       ' switches enable relay


OUTPUTx is an output that you should define/enable in Pots & Pins

Attached you can see that CW and CCW can share same pin.
Title: Re: Can Mach3 do CW and CCW in the spindle with just one relay and one output?
Post by: Rimbaldo on March 29, 2020, 09:10:42 AM
You will need 2 outputs from your BOB to control 2 relays.
First relay for CW/CCW and second for Start/Stop spindle.
Second, you can edit macros in your Mach3/macros/'your profile' folder named m3.m1s and m4 m1s
For example:

Code: [Select]
m3.m1s

ActivateSignal(OUTPUTx) ' switches ON direction control relay
DoSpinCW()                   ' switches enable relay

Code: [Select]
m4.m1s

DeactivateSignal(OUTPUTx) ' switches OFF direction control relay
DoSpinCW()                       ' switches enable relay


OUTPUTx is an output that you should define/enable in Pots & Pins

Attached you can see that CW and CCW can share same pin.

Thanks! That pretty much solves it all!

Only one doubt: How do I assign the output pin for the enable relay to the DoSpinCW() function? I mean, how does this DoSpinCW() function knows which pin to send a signal? Is it the Spindle Output Pin in the Output port configuration?

Thanks a lot for your help!

Rodrigo
Title: Re: Can Mach3 do CW and CCW in the spindle with just one relay and one output?
Post by: ZASto on March 29, 2020, 11:44:29 AM
Well, DoSpinCW/CCW will activate Output1, according to image that I attached. -> Enable signal
OUTPUTx (x is an output that is free on your BOB) -> Spinning direction signal.

HTH
Title: Re: Can Mach3 do CW and CCW in the spindle with just one relay and one output?
Post by: Rimbaldo on May 18, 2020, 12:07:08 PM
Hi! Just today I managed to upgrade my motor. I’d like thank you for your help. It worked perfectly. I changed the m4 and m3 macros as you said and everything is working!

Thanks!