Inhibit tool when z is above set point
- kb0thn
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
04 Jan 2025 01:57 #318007
by kb0thn
Inhibit tool when z is above set point was created by kb0thn
Hi Group,
I've got a large format wood router that I've put a diode laser on. The diode laser is just turned on and off with a digital output. I would like to have LinuxCNC inhibit the laser if Z is above a certain point. What is the best way to do something like this?
Thanks!
-Jim
I've got a large format wood router that I've put a diode laser on. The diode laser is just turned on and off with a digital output. I would like to have LinuxCNC inhibit the laser if Z is above a certain point. What is the best way to do something like this?
Thanks!
-Jim
Please Log in or Create an account to join the conversation.
- Benb
- Offline
- Premium Member
Less
More
- Posts: 139
- Thank you received: 50
04 Jan 2025 04:15 #318021
by Benb
Replied by Benb on topic Inhibit tool when z is above set point
If you have measurment of the z distance you can use the hal compare component.
linuxcnc.org/docs/stable/html/man/man9/comp.9.html
otherwise install a limit switch to send a signal to inhibit the laser.
linuxcnc.org/docs/stable/html/man/man9/comp.9.html
otherwise install a limit switch to send a signal to inhibit the laser.
Please Log in or Create an account to join the conversation.
- kb0thn
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
05 Jan 2025 01:46 #318141
by kb0thn
Replied by kb0thn on topic Inhibit tool when z is above set point
Thanks for the guidance. I implemented the following code and it seems to work. The logic is that the laser has to be 0.375" of less (relative) above the surface. AND the laser engraver tool number (8) must be selected. And the motion input (triggered by a M62 P21 or M64 P21) must be true.
Currently I program z=0 as the top of the work surface. This code won't work if I program z=0 as the spoilboard or somewhere else. I guess I could use another M code to set a laser safety height or something. We'll see how this works first.
-Jim
# inhibit laser engraver when at unsafe height (relative)
addf comp.0 servo-thread
setp comp.0.in1 0.375 # okay to have engraver on below this (relative) z height
setp comp.0.hyst 0.005 # hysteresis
net engraver-height-current comp.0.in0 <= halui.axis.z.pos-relative
# engraver tool (T8) must be the active tool and height must be safe
addf conv-u32-float.0 servo-thread
net tool_number_u32 <= halui.tool.number => conv-u32-float.0.in
net tool_number_float <= conv-u32-float.0.out
addf comp.1 servo-thread
setp comp.1.in0 8 # engraver tool number
setp comp.1.hyst 0.0001 # floating point is never equal
net tool_number_float => comp.1.in1
addf and2.3 servo-thread
net engrave-safe-height <= comp.0.out => and2.3.in0
net engrave-safe-selected <= motion.digital-out-21 => and2.3.in1
net engrave-signal <= and2.3.out
# make sure comp.1.equal and engrave_signal are both true, if so we turn on optimat_o_laser_engraver_pwm
addf and2.4 servo-thread
net engrave-signal => and2.4.in0
net engrave-tool-match => comp.1.equal => and2.4.in1
net engrave_pwm <= optimat_o_laser_engraver_pwm <= and2.4.out
Currently I program z=0 as the top of the work surface. This code won't work if I program z=0 as the spoilboard or somewhere else. I guess I could use another M code to set a laser safety height or something. We'll see how this works first.
-Jim
# inhibit laser engraver when at unsafe height (relative)
addf comp.0 servo-thread
setp comp.0.in1 0.375 # okay to have engraver on below this (relative) z height
setp comp.0.hyst 0.005 # hysteresis
net engraver-height-current comp.0.in0 <= halui.axis.z.pos-relative
# engraver tool (T8) must be the active tool and height must be safe
addf conv-u32-float.0 servo-thread
net tool_number_u32 <= halui.tool.number => conv-u32-float.0.in
net tool_number_float <= conv-u32-float.0.out
addf comp.1 servo-thread
setp comp.1.in0 8 # engraver tool number
setp comp.1.hyst 0.0001 # floating point is never equal
net tool_number_float => comp.1.in1
addf and2.3 servo-thread
net engrave-safe-height <= comp.0.out => and2.3.in0
net engrave-safe-selected <= motion.digital-out-21 => and2.3.in1
net engrave-signal <= and2.3.out
# make sure comp.1.equal and engrave_signal are both true, if so we turn on optimat_o_laser_engraver_pwm
addf and2.4 servo-thread
net engrave-signal => and2.4.in0
net engrave-tool-match => comp.1.equal => and2.4.in1
net engrave_pwm <= optimat_o_laser_engraver_pwm <= and2.4.out
Please Log in or Create an account to join the conversation.
Time to create page: 0.086 seconds