grblhal / plugin_plasma Goto Github PK
View Code? Open in Web Editor NEWgrblHAL plugin for plasma cutters (THC)
License: Other
grblHAL plugin for plasma cutters (THC)
License: Other
Hey All
I'm running PLASMA v0.13 on 1.1f.20240404 in up/down mode.
When I fire the torch using the M4 command I get the warning "[MSG:Warning: Plasma mode not available!]" and the relay triggers, but none of the Plasma specific functionality appears to work.
I'm sure I missed something somewhere but figured I'd reach out incase I haven't ๐
Plasma Config
; 350 - Plasma mode
$350=2
; 351 - Plasma THC delay
$351=1.0
; 358 - Plasma Arc fail timeout
$358=1.0
; 359 - Plasma Arc retry delay
$359=1.0
; 360 - Plasma Arc max retries
$360=3
; 366 - Arc voltage port
$366=0
; 367 - Arc ok port
$367=1
; 368 - Cutter down port
$368=3
; 369 - Cutter up port
$369=2
Hi!
If we wanted to use a THC with the OpenBuilds BlackBox, what would your suggestion be?
The THC we have an eye on can use Mode 2:
Line 11 in 9a96784
With the ports available on the BlackBox, we don't have three "spare" inputs for Arc OK, Up and Down.
But - we might be able to cheat like we did with the parallel limits we did for the 4th axis with the plugin https://github.com/grblHAL/ESP32/blob/master/main/BlackBoxX32.c
In this case we might be able to get away with the available ports if we:
Doesn't need an analog input as the THC handles the voltage sense side itself and just sends up/down and arc-ok (from the Inverter)
So #2 (comment) might apply as well, we'd be forced to only support Mode 2 THCs due to our hardware - but we can document that clearly
I try to build a Plasma cutter with a STM32F411 "blackpill" .
It skd looks like working a bit, but does not really match the expectations from documentation and source code.
The pattern is similar to #8, but not related to sth like MCP3211 :
I messed around with preprocessor conditionals, but in the end, after configring an analog input, I found that obviously at least some thc functionality is implemented.
Some details:
$I
[VER:1.1f.20240709:]
[OPT:VNMDSL+2,100,1024,3,0]
[AXS:3:XYZ]
[NEWOPT:ENUMS,RT+,HOME,OS,ES,SED]
[FIRMWARE:grblHAL]
[SIGNALS:HSDTEP]
[NVS STORAGE:*FLASH]
[FREE MEMORY:31K]
[DRIVER:STM32F411]
[DRIVER VERSION:240624]
[BOARD:BlackPill THC]
[AUX IO:2,2,0,0]
[PLUGIN:Bootloader Entry v0.02]
[PLUGIN:PLASMA v0.13]
some blind dry run exercises (not all input is echoed)
?<Idle|MPos:456.000,456.000,0.000|Bf:100,1024|FS:0,0|Pn:T>
ok
error:2
ok
ok X500
?<Run|MPos:470.024,456.000,0.000|Bf:99,1024|FS:500,0|Pn:T|Ov:100,100,100|A:S>
ok
?<Run|MPos:490.552,456.000,0.000|Bf:99,1024|FS:500,0|Pn:T>
ok
?<Idle|MPos:500.000,456.000,0.000|Bf:100,1024|FS:0,0|Pn:T>
ok
$?<Idle|MPos:500.000,456.000,0.000|Bf:100,1024|FS:0,0|Pn:T|WCO:0.000,0.000,0.000>
$?<Idle|MPos:500.000,456.000,0.000|Bf:100,1024|FS:0,0|Pn:T>
Pinout:
[PIN:PB7,Feed hold]
[PIN:PB6,Cycle start]
[PIN:PA1,Safety door]
[PIN:PA0,Emergency stop]
[PIN:PB5,Probe]
[PIN:PB12,X limit min]
[PIN:PB13,Y limit min]
[PIN:PB15,Y limit min 2]
[PIN:PB14,Z limit min]
[PIN:PB9,Aux in 2,Stop disable]
[PIN:PB4,Aux in 3,P0]
[PIN:PB3,Aux in 4,P1]
[PIN:PB8,Aux analog in 0,Arc voltage]
[PIN:PA2,X step]
[PIN:PA4,Y step]
[PIN:PB0,Y2 step]
[PIN:PA6,Z step]
[PIN:PA3,X dir]
[PIN:PA5,Y dir]
[PIN:PB1,Y2 dir]
[PIN:PA7,Z dir]
[PIN:PC13,Steppers enable]
[PIN:PB2,Spindle on]
[PIN:PA8,Spindle PWM]
[PIN:PC14,Mist]
[PIN:PC15,Flood]
[PIN:PA15,Aux out 0,P0]
[PIN:PB10,Aux out 2,P1]
[PIN:PA10,RX,UART1]
[PIN:PA9,TX,UART1]
/* Pin Assignments:
*
* -----------
* VB | | +3V
* * Step En/Dis C13 | | GND
* ?Mist? Coolant Flood C14 | | +5V
* ?Flood? Coolant Mist C15 | * - * | B9 I2C SDA - Aux in 2 -Stop disable
* RST | |K| | B8 I2C SCL - Aux analog in 0 - Arc voltage
* Reset A0 | - | B7 Feed Hold *
**Safety door/I2C strobe A1 | | B6 Cycle Start *
* * X Step A2 | | B5 Probe *
* * X Direction A3 | / \ | B4 Encoder Index - aux in 3, P0
* * Y Step A4 | <MCU> | B3 Encoder Pulse (B) - aux in 4, P1
* * Y Direction A5 | \ / | A15 Encoder Pulse (A) - aux out 0,P0
* * Z Step A6 | | A12 USB D+ *
* * Z Direction A7 | - - | A11 USB D- *
* Y2-step aka A Step B0 | |R| |B| | A10 USART1_RX ???
* Y2 dir A Direction B1 | - - | A9 USART1_TX ???
* * Spindle Enable B2 | | A8 Spindle PWM *
* Aux out 2,P1 (sp-dir) B10 | | B15 A Limit aka y limit min2
* +3V | ----- | B14 Z Limit *
* GND | | | | B13 Y Limit *
* +5V | | USB | | B12 X Limit *
* -----------
*/
upper end of configuration:
This is what worries me most - many variables listes in thc.c
and in https://github.com/grblHAL/Plugin_plasma are missing
....
$132=200.000
$170=0.000
$171=0.000
$172=0.000
$341=0
$342=30.0
$343=25.0
$344=200.0
$345=200.0
$346=1
$347=5.0
$348=2.500
$349=25.000
$350=1
$351=3.0
$358=3.0
$359=3.0
$360=3
$366=0
$367=255
$368=255
$369=255
$370=3
$372=0
$384=0
$392=4.0
$393=1.0
$398=100
$481=0
$484=1
$486=0
My gut feeling tells me that quite some stuff might still be broken...
Ho can I pin this down?
OK, my hardware is not fully operational, so that may be the source of the issue. Much of what I'm doing at this point amounts to simulation with relays and wires.
I have a 5v relay connected to the spindle enable on the Teensy 4.1 T41U5XBB. When I toggle spindle on ioSender, the relay closes (which is expected) and then opens a few seconds later. This part of the behavior is similar whether the connection is USB or ethernet.
Now for a bit more.
if connected via USB, ioSender (2.0.43) shows "arc on" in the status bar. It doesn't change to "arc ok," "arc failed," or "arc delay." I have the "arc ok" port set to [PIN:30,Aux input 1,Arc ok] per $pins which is correct. I was thinking of simply hardwire AUX1 to 3v3 to simulate "high" (or setting to gnd for "low"). The plasma cutter "arc ok" is not much more than a NO circuit that is closed by Cutter. Hence the idea of either jumper to 3v3 or GND. This doesn't change the behavior. Then ioSender will popup a message with "Unhandled exception occured: Object reference not set to an instance of an object" then ioSender closes.
if connected via ethernet (which will be my preferred connection), no "arc on" in status bar with similar msg from ioSender.
Am I "simulating" the "arc ok" incorrectly? Is there a way to query the current status of the AUX digital pins from console?
I apologize in advance if this is not truly an issue.
Hi, I am trying to use the PicoCNC board with the RP2040 for a DIY plasma cutter and am trying to get THC working. The analog input will be the ADC on GPIO28, moving the probe pin to 24. I also ordered an I2C ADC chip but that's a later step.
However, I am immediately running into problems while trying to add the plasma plugin. I added an include "plasma.c"
within driver.h
but it contains redefinitions of multiple functions causing the compilation to fail. (side question: why was the plasma.h
file removed in some recent change?) In summary the errors are for redefinitions of the 'digital_out', 'analog_out', 'stepperPulseStart', and 'enumeratePins' functions, and for the 'settings_changed' variable. Here is the full output:
....
[ 17%] Building C object CMakeFiles/grblHAL.dir/ioports_analog.c.obj
/home/jelmer/grblHAL_driver_RP2040/pico_cnc.c:51:13: error: redefinition of 'digital_out'
51 | static void digital_out (uint8_t port, bool on)
| ^~~~~~~~~~~
In file included from /home/jelmer/grblHAL_driver_RP2040/driver.h:207,
from /home/jelmer/grblHAL_driver_RP2040/pico_cnc.c:26:
/home/jelmer/grblHAL_driver_RP2040/plasma/thc.c:137:13: note: previous definition of 'digital_out' was here
137 | static void digital_out (uint8_t portnum, bool on)
| ^~~~~~~~~~~
make[2]: *** [CMakeFiles/grblHAL.dir/build.make:202: CMakeFiles/grblHAL.dir/pico_cnc.c.obj] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/jelmer/grblHAL_driver_RP2040/ioports_analog.c:89:13: error: redefinition of 'analog_out'
89 | static bool analog_out (uint8_t port, float value)
| ^~~~~~~~~~
In file included from /home/jelmer/grblHAL_driver_RP2040/driver.h:207,
from /home/jelmer/grblHAL_driver_RP2040/ioports_analog.c:22:
/home/jelmer/grblHAL_driver_RP2040/plasma/thc.c:159:13: note: previous definition of 'analog_out' was here
159 | static bool analog_out (uint8_t portnum, float value)
| ^~~~~~~~~~
In file included from /home/jelmer/pico/pico-sdk/src/common/pico_base/include/pico.h:33,
from /home/jelmer/pico/pico-sdk/src/common/pico_time/include/pico/time.h:10,
from /home/jelmer/grblHAL_driver_RP2040/driver.c:31:
/home/jelmer/grblHAL_driver_RP2040/driver.c:1048:33: error: redefinition of 'stepperPulseStart'
1048 | static void __not_in_flash_func(stepperPulseStart)(stepper_t *stepper)
| ^~~~~~~~~~~~~~~~~
/home/jelmer/pico/pico-sdk/src/rp2_common/pico_platform/include/pico/platform.h:265:76: note: in definition of macro '__not_in_flash_func'
265 | #define __not_in_flash_func(func_name) __not_in_flash(__STRING(func_name)) func_name
| ^~~~~~~~~
In file included from /home/jelmer/grblHAL_driver_RP2040/driver.h:207,
from /home/jelmer/grblHAL_driver_RP2040/driver.c:44:
/home/jelmer/grblHAL_driver_RP2040/plasma/thc.c:362:13: note: previous definition of 'stepperPulseStart' was here
362 | static void stepperPulseStart (stepper_t *stepper)
| ^~~~~~~~~~~~~~~~~
/home/jelmer/grblHAL_driver_RP2040/driver.c:1764:6: error: 'settings_changed' redeclared as different kind of symbol
1764 | void settings_changed (settings_t *settings, settings_changed_flags_t changed)
| ^~~~~~~~~~~~~~~~
In file included from /home/jelmer/grblHAL_driver_RP2040/driver.h:207,
from /home/jelmer/grblHAL_driver_RP2040/driver.c:44:
/home/jelmer/grblHAL_driver_RP2040/plasma/thc.c:120:29: note: previous declaration of 'settings_changed' was here
120 | static settings_changed_ptr settings_changed;
| ^~~~~~~~~~~~~~~~
/home/jelmer/grblHAL_driver_RP2040/driver.c:2066:13: error: redefinition of 'enumeratePins'
2066 | static void enumeratePins (bool low_level, pin_info_ptr pin_info, void *data)
| ^~~~~~~~~~~~~
In file included from /home/jelmer/grblHAL_driver_RP2040/driver.h:207,
from /home/jelmer/grblHAL_driver_RP2040/driver.c:44:
/home/jelmer/grblHAL_driver_RP2040/plasma/thc.c:656:13: note: previous definition of 'enumeratePins' was here
656 | static void enumeratePins (bool low_level, pin_info_ptr pin_info, void *data)
| ^~~~~~~~~~~~~
make[2]: *** [CMakeFiles/grblHAL.dir/build.make:244: CMakeFiles/grblHAL.dir/ioports_analog.c.obj] Error 1
make[2]: *** [CMakeFiles/grblHAL.dir/build.make:90: CMakeFiles/grblHAL.dir/driver.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:1511: CMakeFiles/grblHAL.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
What would be the correct way of activating the plasma plugin? You mention testing this plugin already so i am also curious about the implementation that you use. I can't seem to find a complete example of the implementation within any of the hardware drivers.
Also, should STEP_INJECT_ENABLE
be enabled to use THC?
My fork of the RP2040 driver can be found here for reference: https://github.com/JelmerV/grblHAL_driver_RP2040
Tried several time by adding the THC plugin on the web builder, but the firmware generated did not include the THC .
also like to know where all the control lines from the CNC Plasma cutter connect to on the phil-barrett breakout board, can not find any documents on that. Thanks,
Hi, I am a developer, I am working on a plasma right now. I intend to use grblHal with Atmel SAM3X8E (Arduino Due) as base hardware. I have doubts about how to add the Plasma / THC plugin to the main project? also if you are interested in testers and developers I like to be one . Thank you very much in advance.
Sorry for putting this in issues - there is no discussion section.
The current ADC daughter board I make has 12 bit resolution. Is 10 or 8 bit resolution acceptable? When I started out I assumed that 12 bits was needed but am not so sure.
Assuming a target Arc Voltage of 100V, 12 bit resolution means 24 mV per step, 10 - 96 mV/Step and 8 - 391 mV. This assumes no noise so the reality is probably 3 to 4 times worse usable resolution, with an 8-bit ADC probably reaching a volt per step. (disclaimer, I'm no analog guru).
The reason I am asking is I've been looking at alternate ADCs. The current MCP3221 is relatively expensive and seems to have limited/sporadic availability. There is a 10 bit ADC - MCP3021 that looks like it is a drop in replacement for the MCP3221. It appears to have broader availability and is a bit cheaper. The current driver in grblHAL should work with no changes. It yields a 12 bit value but the bottom 2 bits do not get set. The datasheet does not define what they are set to but as long as it is consistent, it should not matter. I've got a couple on order and will try them out. The nice thing about the MCP3021, it has the same I2C address as the MCP3221 so no driver changes needed.
I've also been looking at several TI ADCs that have broader availability. They are well less expensive than the MCP3221 but require driver changes. Probably small but still needs to be considered.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.