GRBL Plasma w THC, Torch Touchoff, and Rotary

This is the place for any plugins, posts or other useful tools you have created.
User avatar
djreiswig
Posts: 484
Joined: Sat Feb 20, 2016 4:47 am
Location: SE Nebraska

Re: GRBL Plasma w THC, Torch Touchoff, and Rotary

Post by djreiswig »

Happy to help
User avatar
bLouChip
Posts: 124
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

Re: GRBL Plasma w THC, Torch Touchoff, and Rotary

Post by bLouChip »

update version 25.7

25.1 prologue comments fixup
25.3 change default THC dynamic on/off cmd to allow continuous XY motion during state changes.
25.4 remove LdcAdcOFF flag and instead reset LdcAbsCutHeight, adj OnNewEntity() header comments.
25.5 added two machine pause cmds in Bench Test gcode so I don't use it to cut by mistake!
25.6 changed per-cut torch probe cycle from 2 probes to 1, 1/2 the time,
while maintaining same probe accuracy of +/- 0.025mm or accuracy of Z axis
25.7 added LdcPauseOnNewPart boolean option

A few versions prior I had made changes to the dynamic THC on/off gcode, moving it to Path Rules. However, 2 of the gcodes (M7 and M9) for my THC Anti-Dive Circuit (ADC) (which has the side effect of also managing the effective THC on/off state) will cause the XY motion to pause/stop during a cut, albeit just a 0.1ms of a pause/stop, the reason being that grbl is synchronizing the M7/M9 with the exact XY position in which it was placed by Path Rules. This can cause a dimple in the cut edges of the kerf, not good. I had forgotten about this motion pausing side effect.

So to fix it and have continuous XY motion while also changing THC on/off state, I changed to a similar method that I used a few versions back and cleaned up the logic a bit. This method uses spindle speed (S0 for OFF, and S1000 for ON) as the dynamic THC on/off during XY motion, in Path Rules at anytime and when Z arrives at cutHeight during a pierce. This works in a continuous motion due to grbl laser mode $32=1, and when using M4 (spindle enable signal from MCU) to fire the torch, then spindle speed (S-PWM signal from MCU) is proportionally varied automatically by grbl to the realtime XY motion speed, accounting for acceleration and deceleration. My Z THC ADC uses S-PWM to dynamically block or pass the THC Z motion signals, so below 85% of feedrate due to deceleration, the circuit blocks the THC trying to adjust Z to the plasma arc voltage deviation, and then passes the THC signals to Z when later accelerating and feedrate is > 95%. So to 'manually' or programmatically manage this circuit, I can force S-PWM to zero (S0) to always block the THC signals, or full on (S1000) to allow the circuit to function automatically again. Grbl's laser mode operation is that IF spindle speed is changed while ALSO processing a motion gcode XYZorA (called a motion block), then motion will remain continuous while spindle speed changes immediately. Lasers can respond to this instantaneous S-PWM signal change, but mechanical spindles cannot, so in $32=0 (non laser mode), then motion will pause for a spindle speed change, but again only for 0.1ms to process the Snnnn stmt, same as it does for M7/M9 stmts. If an actual mechanical spindle were being used, you'd want to insert a G04 P5 or so also to allow the spindle time to change speed. The final condition that makes the scheme work in plasma cutting with a THC and my Z ADC, is that my Proma THC SD unit is configured to delay Z motion control for 2.5 seconds, that's enough time for the pierce to occur and for grbl to move Z from PH to CH. That is why I pierce with a M4 S1000 cmd.

here's a link to the THC Z Anti-Dive Circuit schematic: https://drive.google.com/file/d/1UKgOIl ... Yx1RG/view
and grbl laser mode explained: https://github.com/gnea/grbl/wiki/Grbl-v1.1-Laser-Mode
Attachments
GRBL plasma LDC w Rotary.scpost
v 25.7
(41.92 KiB) Downloaded 59 times
LDC SC tools and rules.tools.txt
(9.62 KiB) Downloaded 59 times
MillRight CNC MegaV XL XYZA Tri-CAM Mill/Plasma/Laser
grbl 1.1i, UGS, Win 11, LightBurn, SC, Aspire, and sometimes [con]Fusion360
my youtube channel
User avatar
bLouChip
Posts: 124
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

Re: GRBL Plasma w THC, Torch Touchoff, and Rotary

Post by bLouChip »

update v26

now I remember why I retired from writing code in my day job 10 years ago ;)

So after spending some time on the plasma table this past weekend, the modified torch probe cycle did not work out well 80% through a 130 pierce job on 16gaHR where the minor warppage of the sheetmetal combined with accumulated THC Z error caused a probe alarm, the 2mm buffer I was using in the probe cycle was not enough. Increasing the buffer distance in the single cycle probe method makes the overall cycle time about the same as it was in the double probe cycle. So I reverted back to the double probe cycle but increased the slow probe feedrate to 100mm/m instead of 50, only giving up 0.050mm of accuracy, so its still quicker and its written in a way to avoid probe error unless there is a 5mm delta from one probe cycle to the next, that's how it was previously.

There is also a fix in the OnDrill() operation when not having the RotaryPlasma plugin enabled. Thanks to Ash for finding and reporting this.
Attachments
GRBL plasma LDC w Rotary.scpost
v26
(42.62 KiB) Downloaded 60 times
MillRight CNC MegaV XL XYZA Tri-CAM Mill/Plasma/Laser
grbl 1.1i, UGS, Win 11, LightBurn, SC, Aspire, and sometimes [con]Fusion360
my youtube channel
User avatar
bLouChip
Posts: 124
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

Re: GRBL Plasma w THC, Torch Touchoff, and Rotary

Post by bLouChip »

update v 26.2

26.1 added two custom options and external vars for OnDrill(), LdcDrillPdPct and LdcDrillChPct,
to better control and allow tuning of drill pecking rather than full piercing. See the prologue for details.
26.2 thanks to Les... added code to auto load the Rotary-plasma plugin library if necessary,
conditioned on whether or not its enabled in SC, so no need to comment out the lib stmts if not using the plugin.

* fix to THC ADC enable M7 signal timing and sequencing with Z motion.

I did some drill peck testing on 16ga with a 30A PMX30XP nozzle and found that 90% of a 0.5s pierce delay, 3.7mm PH, and 2.6mm CH (50% PH to CH adder to normal CH of 1.5) for made for about a 0.8mm dia. peck 1/2 way into the 16gaHR steel sheet, air at 72PSI. Of course PDs will vary by plasma source mfg (I'm using a PrimeWeld Cut60 with Tecmo UPM105 torch). The scpost LdcDrillPdPct default is 90%, and LdcDrillChPct default is 50% based on these tests.
Attachments
GRBL plasma LDC w Rotary.scpost
v 26.2
(44.52 KiB) Downloaded 59 times
MillRight CNC MegaV XL XYZA Tri-CAM Mill/Plasma/Laser
grbl 1.1i, UGS, Win 11, LightBurn, SC, Aspire, and sometimes [con]Fusion360
my youtube channel
User avatar
bLouChip
Posts: 124
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

Re: GRBL Plasma w THC, Torch Touchoff, and Rotary

Post by bLouChip »

version 26.5

26.3 cleaned up msgUnit init, LdcThcONcmd timing after S0 setting, added G94 and S0 to G00 stmt,
added RTformat, changed fire cmd to M4 S0, changed LdcThcCtrl to just use M7.
26.4 added $HZ (Z homing cycle) during air supply catchup machine pause events. This is to
null out accumulation of THC Z error I continue to experience on my table.
26.5 created function DoTorchProbeCycle() to accommodate tracking/diagnosing THC Z error
Attachments
GRBL plasma LDC w Rotary.scpost
v26.5
(46.45 KiB) Downloaded 61 times
MillRight CNC MegaV XL XYZA Tri-CAM Mill/Plasma/Laser
grbl 1.1i, UGS, Win 11, LightBurn, SC, Aspire, and sometimes [con]Fusion360
my youtube channel
User avatar
bLouChip
Posts: 124
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

Re: GRBL Plasma w THC, Torch Touchoff, and Rotary

Post by bLouChip »

update: version 28

mostly changes in gcode production to account for tuning my THC Z Anti-Dive Circuit and the Proma THC SD setting adjustments. You can read about this here: https://forum.sheetcam.com/viewtopic.php?p=31408#p31408 , and it spills over in a crosslink to plasmaspider forum.
Attachments
GRBL plasma LDC w Rotary.scpost
version 28
(50.92 KiB) Downloaded 34 times
MillRight CNC MegaV XL XYZA Tri-CAM Mill/Plasma/Laser
grbl 1.1i, UGS, Win 11, LightBurn, SC, Aspire, and sometimes [con]Fusion360
my youtube channel
User avatar
bLouChip
Posts: 124
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

Re: GRBL Plasma w THC, Torch Touchoff, and Rotary

Post by bLouChip »

update: version 28.2

28.1 added LdcFastProbe var
28.2 added LdcProximityDist feature, supporting vars, and logic.
-- proximity distance in mm to skip a Torch Probe Cycle before piercing if current location is within proximity of a recent previous location. A value of 0 turns off the feature. Using this feature is NOT Recommended if you are also using an autonomous THC such as Proma THC SD, these units require Torch Probe Cycles on every pierce location.
Attachments
GRBL plasma LDC w Rotary.scpost
v 28.2
(52.53 KiB) Downloaded 5 times
MillRight CNC MegaV XL XYZA Tri-CAM Mill/Plasma/Laser
grbl 1.1i, UGS, Win 11, LightBurn, SC, Aspire, and sometimes [con]Fusion360
my youtube channel
Post Reply