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
bLouChip
Posts: 120
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

GRBL Plasma w THC, Torch Touchoff, and Rotary

Post by bLouChip »

update: jump to last post in this thread (now page 2) for the latest scpost file download.

I've posted this custom .scpost code in various forum replies and questions, various versions of the .scpost while I've been developing it. I think it's pretty stable now, it has features that I like and functions well for my plasma table. Perhaps others can use it with minor changes or as a model in making their custom .scpost, I tried to comment the code well for readability. As it changes going forward, I'll update the version here.
Enjoy.
Lou

10/30/23, version 15
updated post, -
* added another external variable LdcThcZAntiDive, 0 Off, 1 ON, default is ON. The THC Z Anti-Dive enable/disable gcode used is specific to a custom circuit that I built, link to schematic here: https://drive.google.com/file/d/1UKgOIl ... sp=sharing
To use this post without that circuit either change the enable gcode to suit your Anti-Dive circuit or disable the gcode production of it by setting the variable to zero 0.
* changed some var names to more meaningful names
* added many new comments to describe external variables, post logic, and gcode.

11/2/23, version 16
update .scpost -
* as I was replying to another forum question I realized I forgot to cover the case of grbl1.1e+ running on an Arduino Uno board, where D11 is the trigger pin/signal (SPWM signal). So this .scpost version changes the torchfire command to "M3 S1000" to cover this case, when LdcThcZAntiDive = 0.
Attachments
GRBL plasma LDC.scpost
version 16
(15 KiB) Downloaded 501 times
GRBL plasma LDC.scpost
version 15
(14.2 KiB) Downloaded 514 times
Last edited by bLouChip on Sat Jan 13, 2024 4:25 pm, edited 3 times in total.
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: 120
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

Re: GRBL Plasma w THC and Torch Touchoff

Post by bLouChip »

updated scpost to version 17
* adjusted logic of external variables to allow for use of Set Post Variable Operations, in addition to use from Options menu as before.
* I should have mentioned previously that the THC in use with the custom Z THC Anti-Dive circuit is a Proma Compact THC SD brand and model, https://www.proma-elektronika.com/downl ... csd_en.pdf
Attachments
GRBL plasma LDC.scpost
version 17
(14.98 KiB) Downloaded 493 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
Lyndondr
Posts: 1
Joined: Sat Nov 18, 2023 2:23 am

Re: GRBL Plasma w THC and Torch Touchoff

Post by Lyndondr »

I assume this post won't work without a THC?
Also I don't have the Z axis set up yet, so I assume it will hang on the probing step?

Thanks
User avatar
bLouChip
Posts: 120
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

Re: GRBL Plasma w THC and Torch Touchoff

Post by bLouChip »

It does work without a THC, set external post variable LdcThcZAntiDive = 0 .
It does NOT work without motorized Z axis for reason you noted.
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
Tristan86
Posts: 4
Joined: Thu Sep 07, 2023 3:24 pm

Re: GRBL Plasma w THC and Torch Touchoff

Post by Tristan86 »

Hello ! It Is amazing to see what is done and shared in some forums, thank you very much bLouChip !

I fear my designed is not adapted to your postprocessor, but may be someone may tell me I am wrong or explain how to tweak the postprocesser to fit this different design.

I based myself on JD Garage too. So I have built the Z axis in the last days. But one first doubt is, this one makes the probe touch and trigger the switch once it is squeezed between the material and the switch. It is based on the z motor lowering the switch against the strength of compression spring. But you say your design works with gravity dropping, right? How to deal with this difference? Any simple solution?

Other difference, not implemented yet, is the rotary axis I plan to install with a chuck, parallel to Y axis. I therefore replaced my Arduino Uno by a Mega, and gave it a fork of grbl, Grbl Mega 5X, to handle the extra axis. That makes a big difference and requires changes in the postprocesser, right?
I was thinking I could just use two different postprocessors according to my task, and use the Z probe only with sheet metal. Bent tubes are not recoverable, and useless in CNC stuffs but it may a pain to always need to switch
Any tip or suggestion will be warmly welcomed.

A last question is about your use of a THC, which I plan to implement as well. I was considering to install a standalone THC, may be make it of my own with an extra Arduino. I believe I understood that in your postprocessor design, the THC is activated only after the plasma arc is rather stabilized, does its job while cutting, and is put off once the cut is done, letting then the z probe take back the control of the same motor, right ? (Since you use Arduino I guess some other THC system communicating Z DRO changes with the the CNC would be impossible. But I prefer to ask now to be sure the design I plan to do will fit an available postprocessor, not as I did before, referring to the previous questions)
Thank you very much for your precisions.
User avatar
bLouChip
Posts: 120
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

Re: GRBL Plasma w THC and Torch Touchoff

Post by bLouChip »

Thank you for the compliment, I'm happy to help.
I'd like to suggest that you move this discussion to a new thread in this forum as it appears it will be rather busy and specific to your build. We can cross link the threads for reference, and I'll move this reply to into your new thread also.

My scpost may be closer as is to meeting your needs than you believe, but if not, I can help you customize it.
I use the Atmega2560 MCU also, and run the 5axis grbl fork, although I'm using only 4 axes and my rotary is parallel to X, so its axis letter is A. Yours will be B, which is parallel to Y. I too will be using rotary with plasma process soon, so I will add rotary support to my scpost sometime in the next 3 months, I don't anticipate it being a major change.

re. the Z axis and torch probe touchoff mechanics- I believe some folks refer to this mechanism as "floating torch mount". That is what I use, its the same concept as JD Garage design as far as I know. The floating or sliding torch mount normally hangs against its down stop position due to gravity, and thus stays off the actuator for the probe switch, until Z motion moves down to compress the "float" distance and actuate the probe switch. The float distance is what I refer to as LdcTorchProbeTravel.

re. THC- I use Proma THC SD brand and model. Per its stock installation and wiring diagram it is always "active" and looking for an arc voltage. Once it detects an arc, it takes over (after its own programmed delay to allow the arc to stabilize) the Z axis motor independent of the grbl controller, by relay switching the Z STEP and DIR control signals. I wanted more control than this, so I built a THC Z Anti-Dive circuit to intercept the Z STEP signal from the THC and block it at times, essentially rendering the THC OFF. Thus I can let the circuit work automatically in the Z Anti-Dive mode when XY cornering and during other XY accel/decel motions that would spike the arc voltage, or I can command the THC OFF state using grbl Spindle power percentage (SPWM) gcode stmt and signal at any time.

You can see photos of my CNC build here: https://drive.google.com/drive/folders/ ... AAHuvQLFic
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
Tristan86
Posts: 4
Joined: Thu Sep 07, 2023 3:24 pm

Re: GRBL Plasma w THC and Torch Touchoff

Post by Tristan86 »

Thank you for your fast answer !

As you suggested, I created a new and specific thread, here :
viewtopic.php?t=9136

Just one last question. Where, with which informations and sources, how did you learn how to adapt and write your postprocessor code ?
User avatar
bLouChip
Posts: 120
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 18
Added Rotary-plasma plugin support. I've only done minor machine testing, but much more bench testing. I've only tested rotary modes of Flatsheet and Round Pipe. Rectangle and I-Beam not yet tested and I know more work is needed to support those modes, I don't advise you try those.
Note that rotary jobs by this scpost assume WCS torch zero is the surface of the cylinder, NOT the center of axis rotation as do most other rotary scpost code. I do this because my machine only has 100mm of Z motion available, so I adjust the height of the rotary chuck on Z so the range of 100mm motion is sufficient.
If you don't have the Rotary-plasma plugin license, don't use this version, continue to use version 17.

Changes:
I changed 2 external post variable names to make more sense to other users;
* LdcThcZAntiDive has been changed to LdcThcPresent, still 1 for yes, and 0 for no THC.
* LdcThcOn changed to LdcThcEnable, still 1 for ON and 0 for OFF.
These and other external post variables are dynamic now, so you can use Set Post Processor Variables Operation to change them during runtime.
* added machine Pause based on a timer that you set in the scpost file, the job will Pause when the timer tips OR between Parts. The timer pause is for the case of allowing an under capacity air supply to catch up. Pause will occur after moving to next shape and in the safeZ position, before pierce so the air should be flowing over solid metal. Pause requires operator intervention to Resume, either via Cycle Start in the sender program or physical pushbutton on the control panel connected to controller Resume input.

Update: later same day, I found a bug, fixed, and reposted file since no downloads yet. Version 18.1

Please read the scpost header comments for full usage information and how to adjust values to your machine if necessary. The external post variables should cover most cases.

Enjoy.
Lou
Attachments
GRBL plasma LDC w Rotary.scpost
version 18.1
(23.82 KiB) Downloaded 401 times
Last edited by bLouChip on Tue Dec 19, 2023 4:44 am, edited 2 times in total.
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
djreiswig
Posts: 483
Joined: Sat Feb 20, 2016 4:47 am
Location: SE Nebraska

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

Post by djreiswig »

There is a Boolean variable for posts & tools (and maybe operations), although I still don't think it works correctly in the post variables. I noticed this a while ago, and posted it as a bug on the forum, but I don't think it's ever been fixed. Maybe you'll have better luck. In the tools it displays a checkbox, so you can use a check to select instead of 1 & 0.
viewtopic.php?p=28973#p28973
User avatar
bLouChip
Posts: 120
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

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

Post by bLouChip »

@djreiswig - agreed, I tried it, likely hit the same bug. As I recall the bug has to do with the external boolean var testing false regardless of value set in the Set Post Processor Variable Operation, or maybe it was when setting it from the Options window; perhaps it arrives inside the scpost as a number 0 or 1. It was confusing so I went back to unit0DECPLACE instead for external variable flags. I do use other boolean datatypes inside the scpost with success.
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
Les Newell
Site Admin
Posts: 3665
Joined: Thu May 11, 2006 8:12 pm

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

Post by Les Newell »

Due to the way SheetCam stores values internally, sc.unitBoolean results in a numeric value that is 1 for true or 0 for false. This works fine in C++ but unfortunately Lua regards anything that is not boolean or nil as true.
To be safe you need to do a comparison:

Code: Select all

   if LdcThcEnable == 1 then
User avatar
djreiswig
Posts: 483
Joined: Sat Feb 20, 2016 4:47 am
Location: SE Nebraska

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

Post by djreiswig »

The bug I found was not with the value, but with the fact that it doesn't display the check box in the post options window like it does everywhere else.
User avatar
Les Newell
Site Admin
Posts: 3665
Joined: Thu May 11, 2006 8:12 pm

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

Post by Les Newell »

Do you mean using post.DefineCustomOption and post.ShowCustomOptions?
I just checked and it appears to work in both dev and stable.
User avatar
djreiswig
Posts: 483
Joined: Sat Feb 20, 2016 4:47 am
Location: SE Nebraska

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

Post by djreiswig »

Apologies. It wasn't working on 7.1.22, but I just updated to 7.1.35 and it's fixed. Thanks Les.
User avatar
bLouChip
Posts: 120
Joined: Tue Nov 09, 2021 4:58 pm
Location: Raleigh, NC
Contact:

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

Post by bLouChip »

updated scpost, version 20-beta

SheetCAM's Rotary-plasma plugin support has been added, but it is NOT required.
If you don't use the Rotary-plasma plugin, that is it is not an "Enabled" plugin, then you should comment out the Rotary Plasma and Helper library stmts at the end of this scpost, as such:
--package.path = sc.Globals:Get().thisDir .. "/plugins/RotaryPlasma/?.lua"
--require("rotaryhelper")
If you do use the Rotary-plasma plugin, then those stmts are required.
Know that you can have the Rotary-plasma plugin "Enabled" all the time and just select "Flat Sheet" in the plugin dialogue to run a 2D job, ie rotary is not used.

I have tested this scpost with Rotary-plasma plugin for Flat Sheet, Round Pipe, and Rectangle Tubing thus far, but pretty minimal testing, so be careful with use. I have also tested it without the plugin enabled.
Please report problems here or send me a PM.

*** IMPORTANT ROTARY NOTE:
*** ZERO Z TO THE SURFACE OF THE CYLINDER PRIOR TO JOB START, NOT THE CENTER OF ROTATION.
*** For Rectangles, zero Z on the apex of a corner rotated to top dead center. In other words,
*** that is the maximum radius for the object.

Cheers,
Lou
Attachments
GRBL plasma LDC w Rotary.scpost
version 20-beta
(26.64 KiB) Downloaded 459 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