Custom relay output function

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

Post Reply
terrymcc
Posts: 116
Joined: Fri Nov 27, 2020 11:34 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: waiting on delivery
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Pattison, TX
Contact:

Custom relay output function

Post by terrymcc »

I would like to disable power to my power draw bar circuit if the spindle is spinning. I have spare relay board outputs. Anybody know of an easy way to do this? I assume it would be PLC modifications but haven't really been into that yet.

Thanks,
ShawnM
Posts: 2190
Joined: Fri May 24, 2019 8:34 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 7804734C6498-0401191832
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Clearwater, FL

Re: Custom relay output function

Post by ShawnM »

I think the easiest way would be to edit your PP to include a M6X (X being the spare relay output) call to turn ON that relay right before your M3 call to turn on your spindle and then a M8X call turn turn it off right after the M5 call to turn off the spindle. You could wire the power for the drawbar through the NC side of the relay contact so with the spindle off the relay is closed and the drawbar circuit works. With the spindle running the relay is open and no power will flow to the drawbar circuit. Make sure the drawbar circuit load is under the max rating of the relay. Editing your M3 and M5 macro is another way or use an output on the VFD to control a relay that breaks power to your drawbar circuit when the VFD is running. No need for PLC modifications.
Last edited by ShawnM on Mon Mar 01, 2021 12:26 pm, edited 1 time in total.
Gary Campbell
Posts: 2164
Joined: Sat Nov 18, 2017 2:32 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: Acorn 238
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Marquette, MI
Contact:

Re: Custom relay output function

Post by Gary Campbell »

I use a M100/101 check for drawbar sensor in the M3 macro. Serves the same purpose, spindle won't start if the drawbar is retracted
GCnC Control
CNC Control & Retrofits
https://www.youtube.com/user/Islaww1/videos
terrymcc
Posts: 116
Joined: Fri Nov 27, 2020 11:34 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: waiting on delivery
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Pattison, TX
Contact:

Re: Custom relay output function

Post by terrymcc »

Both great feedback. Thanks for taking the time....
WastedFreeTime
Posts: 4
Joined: Tue Sep 14, 2021 10:20 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 4462
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Custom relay output function

Post by WastedFreeTime »

I ran across this thread while I was looking to implement something similar so I’ll share my solution in case it helps someone in the future.
The previous suggestions might work for others but in my scenario: I didn’t want to just edit my PP to disable my power draw bar circuit while the spindle is spinning because that solution wouldn’t apply to gcode created with intercon programming or when operating the spindle in manual mode. Also, a drawbar sensor is a good idea, but I don’t have one.

Instead I chose to edit the PLC to create a lockout on the Power Draw Bar (PDB) when the spindle is running.

In my build, I use a normally open foot switch to actuate an air solenoid which actuates the PDB. In addition, I use the normally closed side of the OUT4 relay in series with the foot switch to act as the safety relay. I have assigned the parameter SPINDLEBRAKERELEASE to OUT7 in the wizard. I do this because my spindle is controlled by the PWM output and Acorn doesn’t keep this pin low at all phases of the boot up sequence on the initial application of power. By running it through the NC side of OUT 7, I guarantee my spindle only receives a PWM command when SPINDLEBRAKERELEASE is asserted. The relevant portions of my relay board schematic are below:
RelayBoardSchematic.JPG
By default, Centroid supplies a series of M functions to be used with the relay board outputs. The files mfunc6X.mac use an M94 to turn on relay board output X and mfunc8X.mac files use an M95 to turn off relay board output X. In this case, the Power Draw Bar safety relay is on OUTPUT 4 so this implementation will use M64 and M84.

The default PLC code already has M64 mapped to OUTPUT4 with this line:
"IF M64 THEN (OUTPUT4)"

The PDB safety relay (OUT 4) should follow the same logic as the spindle brake release relay (OUT 7) when turning on the spindle to safe the PDB. When turning off the spindle, its desirable to have the Power Draw Bar safety relay (OUT 4) wait a couple seconds after the spindle brake is engaged to ensure the spindle is stopped before re-enabling the power draw bar.

To do this, add a timer definition (Code starts at line 2040 in the .src file). Timer 34 is the first unused timer on my machine. I think Centroid supports up to 64 timers.

Line 2077 in my PLC became: PowerDrawBarTimer IS T34

The timer need to be initialized to a value in milliseconds. This should be done with the other timers defined in the .src starting at line 2159. I've found it takes ~1.5 seconds for my spindle to come to a dead stop from full speed so I set the timer to 2 seconds for some margin:

Line 2184 in my PLC became PowerDrawBarTimer = 2000,

The remainder of the changes can make significant re-use of the Spindle Brake Release logic already in the PLC starting around line 4095.
The logic used to turn on the SpindleBrakeRelease around line 4116 can be edited to also SET M64 which will in turn enable OUTPUT4 and therefore disable the Power Draw Bar circuit.

; Turn on SpindleBrakeRelease and OUTPUT 4 if SpindleBrake is enabled and when spindle is
; requested to turn on OR the SpinBrakeMode_M is off.
IF !SpindleBrakeDisabled_M &&
((StandardSpindleStage && SpindleEnableOut_M) ||
(G540SpindleStage && (SpindleForward_M || SpindleReverse_M)) ||
SpinBrakeOn_M)
THEN SET SpindleBrakeRelease, SET M64

The logic used to turn off the SpindleBrakeRelease around line 4126 can be edited to also SET PowerDrawBarTimer which will begin the 2 second count down. After the PowerDrawBarTimer completes, then M64 is reset with an RST M64 and the timer is reset with a SET PowerDrawBarTimer.

IF !SpindleBrakeDisabled_M &&
((StandardSpindleStage && !SpindleEnableOut_M && !SpinBrakeOn_M) ||
(G540SpindleStage && (!SpindleForward_M && !SpindleReverse_M) && !SpinBrakeOn_M) ||
(SpinBrakeOff_M && !((StandardSpindleStage && SpindleEnableOut_M) ||
(G540SpindleStage && (SpindleForward_M || SpindleReverse_M)))))
THEN RST SpindleBrakeRelease, SET PowerDrawBarTimer

This implementation will disable the Power Draw Bar regardless of if the spindle was turned on in manual mode, from the vcp or mpg, or if commanded through MDI with an M3, or if called with an M3 through an executing G-code file. If you are comfortable editing the PLC, its quite easy to implement.

Hope this helps someone out in the future.
---------------------------------------------------
My build: viewtopic.php?p=54318#p54318
cnckeith
Posts: 7166
Joined: Wed Mar 03, 2010 4:23 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Contact:

Re: Custom relay output function

Post by cnckeith »

thanks for posting, great to see you guys using the tools we have provided.
Need support? READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html
Post Reply