Recommended way to implement spindle enable conditions?
- TripleM
- Offline
- Junior Member
-
Less
More
- Posts: 28
- Thank you received: 3
10 Jul 2026 11:26 #347658
by TripleM
Recommended way to implement spindle enable conditions? was created by TripleM
Hi everyone,I'd like to add some safety conditions for enabling the spindle on my lathe.The spindle should only be allowed to start if all required conditions are met, for example:
components and use the result as the spindle enable signal.Something along the lines of:Is this the usual way to implement this in LinuxCNC, or is there a better or more recommended approach?How have you implemented spindle interlocks on your machines?Thanks!
- The auxiliary drives are enabled.
- The chuck is clamped (clamping pressure is present).
- (I may add more conditions later.)
and2net spindle-enable-request ...
net aux-drives-on ...
net chuck-clamped ...
and2.0.in0 <= spindle-enable-request
and2.0.in1 <= aux-drives-on
...Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
-
Less
More
- Posts: 2126
- Thank you received: 882
10 Jul 2026 14:05 #347661
by spumco
Replied by spumco on topic Recommended way to implement spindle enable conditions?
If you have a long string of conditional pins/signals, the logic component is a little less messy in HAL than a bunch of nested/sequential and2 components.
linuxcnc.org/docs/stable/html/man/man9/logic.9.html
If you just want some interlocks to prohibit starting the spindle while chuck is open, or opening the chuck while spindle is turning, and2 or logic work fine.
However, I prefer using Classic Ladder for my spindle(s) and drawbar(s). My lathe has two spindles, each with a pneumatic drawbar. I control the drawbars with either physical buttons OR via M-codes. M-code control is necessary for automated bar-feed operations.
I also want to be able to open the collet closer while the spindle is running, although at a low maximum speed. Also need ability to orient spindle while the closer is open (hex/square stock).
Given the complexity of my particular config, I found ladder be be more intuitive and easier to configure (and test).
linuxcnc.org/docs/stable/html/man/man9/logic.9.html
If you just want some interlocks to prohibit starting the spindle while chuck is open, or opening the chuck while spindle is turning, and2 or logic work fine.
However, I prefer using Classic Ladder for my spindle(s) and drawbar(s). My lathe has two spindles, each with a pneumatic drawbar. I control the drawbars with either physical buttons OR via M-codes. M-code control is necessary for automated bar-feed operations.
I also want to be able to open the collet closer while the spindle is running, although at a low maximum speed. Also need ability to orient spindle while the closer is open (hex/square stock).
Given the complexity of my particular config, I found ladder be be more intuitive and easier to configure (and test).
Please Log in or Create an account to join the conversation.
- cmorley
- Offline
- Moderator
-
Less
More
- Posts: 7341
- Thank you received: 2164
11 Jul 2026 15:32 #347684
by cmorley
Replied by cmorley on topic Recommended way to implement spindle enable conditions?
There is also:
spindle.N.inhibit - (bit, in) When this bit is TRUE, the spindle speed is set to 0.
spindle.N.inhibit - (bit, in) When this bit is TRUE, the spindle speed is set to 0.
The following user(s) said Thank You: spumco
Please Log in or Create an account to join the conversation.
- Sascha H.
-
- Offline
- New Member
-
Less
More
- Posts: 11
- Thank you received: 5
13 Jul 2026 12:28 #347739
by Sascha H.
Replied by Sascha H. on topic Recommended way to implement spindle enable conditions?
I used lut5 to check for various conditions.
Here is my HAL on Github: github.com/shallerbach/endchen_rack_atc/...3f0/endchen.hal#L124
Here is my HAL on Github: github.com/shallerbach/endchen_rack_atc/...3f0/endchen.hal#L124
Please Log in or Create an account to join the conversation.
- tuxcnc
- Offline
- Elite Member
-
Less
More
- Posts: 179
- Thank you received: 24
13 Jul 2026 16:52 #347743
by tuxcnc
Replied by tuxcnc on topic Recommended way to implement spindle enable conditions?
Lut5 is the best solution, especially when condition is type of "if a=true and b=false".
BTW. Beware situations when your spindle turns off when axis moved. It is more dengerous than continue when something fails.
BTW. Beware situations when your spindle turns off when axis moved. It is more dengerous than continue when something fails.
Please Log in or Create an account to join the conversation.
- TripleM
- Offline
- Junior Member
-
Less
More
- Posts: 28
- Thank you received: 3
15 Jul 2026 07:41 #347780
by TripleM
Replied by TripleM on topic Recommended way to implement spindle enable conditions?
Thanks for all the suggestions and ideas!
I will give it a try and see how it works out on my machine.
I will give it a try and see how it works out on my machine.
Please Log in or Create an account to join the conversation.
Time to create page: 0.083 seconds