Here are some thoughts. Most of these are untested and may not work.
This is a great CNC plasma resource Linux CNC Plasma Primer
Note: This is only for plasma cutters with an ark OK signal
A spindle class could handle control of the plasma device and deal with the arc OK signal.
M3
(S Values are ignored)PlasmaSpindle:
enable_pin: gpio.14
arc_ok_pin: gpio.33:low
arc_wait_ms: 1200
tool_num: 0
off_on_alarm: true
atc:
m6_macro:
...
[MSG:INFO: WiFi on]
[MSG:INFO: Captive Portal Started]
[MSG:INFO: HTTP started on port 80]
[MSG:INFO: Telnet started on port 23]
[MSG:INFO: PlasmaSpindle Ena:gpio.14 Arc OK:gpio.33:low]
Grbl 3.9 [FluidNC v3.9.4 (wifi) '$' for help]
$plasmaspindle
/plasmaspindle:
enable_pin: gpio.14
arc_ok_pin: 'gpio.33:low'
arc_wait_ms: 1200
tool_num: 0
speed_map: 0=0.00% 1=100.00%
off_on_alarm: true
atc:
m6_macro:
ok
You could use normal probing with a floating Z or Ohmic sensor (contact)
The native analog input circuits on the ESP32 are not very good. We don't think they would work well for this. We also don't like the idea of such a direct connection to such a noisy device is a good idea.
Use an external THC that controls the height while cutting and lets FluidNC control it when not cutting.
Some THCs send up/down signals to the controller and the controller takes care of the Z motor steps.
When the machine slows for a corner, small feature or end of cut, the plasma voltage may change. To prevent the THC from incorrectly compensating for this the controller can inform the THC of the slow down to disable the THC compensation.
This will likely be part of a derived class if implemented
The firmware would very complicated. You have gcode that says cut this path at this height. This goes into a complex motion planner to keep it smooth and fast and starts that motion.
During that motion you have a real time activity monitoring the arc voltage. If that voltage changes you need to change that plan in real time without affecting the quality of the motion.
That is a constantly changing situation and you really need a PID algorithm, like the temp on a printer hot end, to prevent overshoot and get there as fast as possible..
Unlike a hot end, you cannot just slam on the heater when you are far from the the target. The whole time you also need to respect the acceleration and speed limitations of the motor.
It is not impossible to do of course and we have discussed methods many times, but not a priority at this time. We would need a bunch of users to show they are really interested in this by sponsoring it.
This is a proposed Gcode example. is a simple job of cutting 2 squares. This assumes you have homed and set the work X0 and Y0 before starting the job.
M3 S1
starts the plasma and waits for an arc OKG17 ; XY Plane
G21 ; set units
G54 ; set coordinate system
G90 ; set absolute position mode
M6 T1 ; optional. Select spindle and tool
G0 Z20 ; go to rapid move height
G0 X10.0 Y10.0 ; move to first cut
; first cut
G38.2 G91 F300 Z-100 P20 ; Floating Z. Probe in relative position and set 0 position
G90 ; set absolute position mode
G0 Z3.0 ; move to arc start position
M3 S1 ; start plasma
G4 P0.5 ; pierce time
; start cut
F1000 ; set cutting feedrate
G1 Y60
X60
Y10
X10
M5 ; turn off plasma
; cut done
G0Z20 ; return ro rapid height
G0X110.0 Y110.0 ; move to second cut
; second cut
G38.2 G91 F300 Z-100 P20 ; probe in relative position and set 0 position
G90 ; set absolute position mode
G0 Z3.0 ; move to arc start position
M3 ; start plasma
G4 P0.5 ; pierce time
; start cut
F1000 ; set cutting feedrate
G1 Y160
X160
Y110
X110
M5 ; turn off plasma
; cut done
G0 Z20 ; return ro rapid height
G53 G0 Z-1 ; move to top of Z
M30
This is what you will see if send M3 and the plasma cutter does not send the arc_ok signal.
Grbl 3.9 [FluidNC v3.9.4 (PlasmSpindle-ae36fe45) (wifi) '$' for help]
M3
[MSG:ERR: PlasmaSpindle failed to get arc OK signal]
ok
[MSG:INFO: ALARM: Spindle Control]
ALARM:10
This is what it should look like if you activate the arc_ok signal right after the M3.
M3
ok
This is what it should look like if you activate the arc_ok signal right after the M3 and then release the arc_ok
M3
ok
[MSG:INFO: ALARM: Abort Cycle]
ALARM:3