Additional hardware-button for coolant

More
22 Oct 2025 12:50 #336874 by TripleM
Hello,
I would like to add a hardware button for cooling, for example.
Currently, my *.hal entry looks like this:
net coolant-flood     <=  iocontrol.0.coolant-flood => hm2_7i96s.0.7i84.0.0.output-11

This allows me to switch the coolant on and off via the GUI.

How can I add the hardware button (push button)?
I want to be able to continue switching it on and off in the GUI and see that the cooling is switched on. 

Thanks   

Please Log in or Create an account to join the conversation.

More
22 Oct 2025 13:01 #336875 by zz912

Please Log in or Create an account to join the conversation.

More
22 Oct 2025 13:20 - 22 Oct 2025 13:24 #336876 by andypugh
Replied by andypugh on topic Additional hardware-button for coolant
On my lathe I fitted a 3-position switch, labelled with "on - auto - off". This allows me to override the G-code if required, to either on or off.

The HAL to do this looks like this:
net coolant-off hm2_7i84.008a.input-25
net coolant-on hm2_7i84.008a.input-26

loadrt mux_generic config="bb4"
addf mux-gen.00 servo-thread
net coolant-off mux-gen.00.sel-bit-00
net coolant-on mux-gen.00.sel-bit-01
net coolant-flood mux-gen.00.out-bit => hm2_7i84.008a.output-08
net coolant-auto iocontrol.0.coolant-flood mux-gen.00.in-bit-00
setp mux-gen.00.in-bit-01 0
setp mux-gen.00.in-bit-02 1
setp mux-gen.00.in-bit-03 0

Possibly not the simplest way, I suppose that it could have been done with simple AND and NOT components

coolant-out = (coolant _flood OR coolant_on) AND (NOT coolant_off)

Or even LUT5.
Truth-table for LUT5
coolant_flood | 0 1 0 1 0 1 0 1
coolant_on    | 0 0 1 1 0 0 1 1
coolant_off   | 0 0 0 0 1 1 1 1

coolant_out   | 0 1 1 1 0 0 0 0

LUT5 Mask = 14 (0x0E)
Last edit: 22 Oct 2025 13:24 by andypugh.

Please Log in or Create an account to join the conversation.

More
22 Oct 2025 13:26 #336877 by newbynobi
Replied by newbynobi on topic Additional hardware-button for coolant
You may also just use the halui pin,

linuxcnc.org/docs/html/gui/halui.html#_flood

 
The following user(s) said Thank You: rodw

Please Log in or Create an account to join the conversation.

More
24 Oct 2025 11:46 #337041 by TripleM
Replied by TripleM on topic Additional hardware-button for coolant
The halui pin works.
nfortunately, it is currently very sensitive. If you press the button for too long, the pump switches off again or toggles between on and off.

I would need to add something that checks whether the button has been pressed again. 
Does anyone have any ideas?
loadrt not names=not.coolant
loadrt and2 names=and.coolanton,and.coolantoff

addf not.coolant    servo-thread
addf and.coolanton     servo-thread
addf and.coolantoff servo-thread

net coolant_on     not.coolant.in     and.coolantoff.in0    <= halui.flood.is-on
net and1_in_1    and.coolanton.in1    and.coolantoff.in1    <= emcopanel.coolant
net and1_in_0    and.coolanton.in0     <= not.coolant.out

net and1_out    and.coolanton.out     => halui.flood.on
net and2_out    and.coolantoff.out    => halui.flood.off

Please Log in or Create an account to join the conversation.

More
24 Oct 2025 11:56 #337042 by rodw
Replied by rodw on topic Additional hardware-button for coolant
try toggle or toggle2nist components.

Please Log in or Create an account to join the conversation.

More
25 Oct 2025 13:57 - 25 Oct 2025 14:11 #337135 by juergen-home
Replied by juergen-home on topic Additional hardware-button for coolant
Slightly changed from my  gamepad pendant forum.linuxcnc.org/47-hal-examples/57498...tion-selector-switch
Maybe this works.
#----------------------------------------------------------------------------------------------------------
# Activate coolant / mist
#----------------------------------------------------------------------------------------------------------
# A single joypad button will start and stop the coolant.
# coolant on-off with toggle2nist

loadrt toggle names=tog_0   # Load N components for logical NOT operations
addf tog_0 servo-thread

loadrt toggle2nist names=tog2nist_0   # Load N components for logical NOT operations
addf tog2nist_0 servo-thread

# this toggle in front of toggle2nist is needed for regular toggle2nist.comp in 2.9.6
net net-joy-coolant-toggle tog_0.in  <= input.0.btn-base3 # here is the button
net net-button-start tog2nist_0.in <= tog_0.out

net net-coolant.is-on tog2nist_0.is-on <= halui.coolant.is-on
net net-coolant-off tog2nist_0.off => halui.coolant.off
net net-coolant-on tog2nist_0.on => halui.coolant.on
#----------------------------------------------------------------------------------------------------------
Last edit: 25 Oct 2025 14:11 by juergen-home. Reason: mist --> coolant

Please Log in or Create an account to join the conversation.

Moderators: newbynobiHansU
Time to create page: 0.076 seconds
Powered by Kunena Forum