Laser turns off after following code is sent after M3



  • Here is a segment of the gcode file I am using. Is there something I am missing?
    M05 S0
    G90
    G21
    G1 F3000
    G1 X78.027 Y53.1606
    G4 P0
    M03 S255
    G4 P0
    G1 F750.000000
    G2 X67.4647 Y58.2199 I3.2607 J20.3625
    G2 X61.308 Y68.2625 I13.9842 J15.4816
    G2 X60.6505 Y73.2702 I18.3579 J4.9575
    G2 X61.3345 Y78.3007 I19.2122 J-0.0508
    G2 X63.9352 Y84.1174 I20.1897 J-5.5369
    G2 X68.1532 Y88.8641 I17.4699 J-11.2768
    G2 X74.512 Y92.7553 I16.8015 J-20.3154
    G2 X77.7869 Y93.0201 I2.0283 J-4.7017
    G3 X78.3207 Y92.9989 I0.3174 J1.2641
    G1 X78.4301 Y93.1283
    G2 X79.0747 Y93.7511 I0.6232 J0.
    G2 X85.4415 Y92.8863 I-1.1045 J-32.0006
    G2 X88.8112 Y91.7702 I-4.9161 J-20.4871
    G2 X91.8733 Y90.1351 I-7.9239 J-18.525
    G2 X99.9914 Y79.6837 I-11.0149 J-16.9343
    G2 X99.9025 Y66.4387 I-19.1661 J-6.4941
    G2 X94.4483 Y58.2217 I-19.0985 J6.7584
    G2 X85.8249 Y53.6123 I-13.412 J14.7204
    G2 X81.6389 Y52.9782 I-5.5116 J22.2482
    G2 X78.027 Y53.1606 I-0.9673 J16.6973
    G1 X78.027 Y53.1606
    G4 P0
    M05 S0
    G1 F3000
    G1 X77.1071 Y56.4577
    G4 P0
    M03 S255
    G4 P0
    G1 F750.000000
    G1 X77.0617 Y56.5215 F750.000000
    G3 X76.4537 Y56.684 I-1.4259 J-4.1163
    G3 X75.9837 Y56.6826 I-0.2312 J-1.2096
    G1 X75.9401 Y56.5826
    G3 X76.7081 Y56.0991 I0.8778 J0.5425
    G3 X77.1071 Y56.4577 I0.0384 J0.3586
    G1 X77.1071 Y56.4577
    G4 P0
    M05 S0


  • administrators

    In firmware 2.02 it is assumed that if you put the firmware into laser mode with M452 then you will use the G1 S parameter to set the laser power. This provides better control and synchronisation than using M3. If you want to go on using M3 to control the laser then I suggest you don't use M452.



  • The plugin I have for inkscape generates code with the M3 commands. Could you recommend a plugin that generates using G1 S parameters?
    If I don't use M452, how would I set the E1 heater and Heater 3 to laser mode in order for the M3 commands to work correctly?


  • administrators

    Both Smoothieware and GRBL use the S parameter to control laser power, so you could look for a plugin that works with one of those firmwares. If you can't find one, I guess I could add a parameter to the M452 command that selects how the laser is controlled.



  • I will look around for a Smmothieware/GRBL plugin.

    I'm confused on what I would change in the M452 command. I have set the P, R and F parameters and I don't see anything else besides inverting the signal that you can do with the command. From other places on the forum, it looks like people have had success using the M452 with M3 commands when using a fan pin to control. However, I need to use a 5V TTL signal. Is there something inherent to how the HEATER3 pin is controlled? Is there another pin I might try instead?


  • administrators

    No there is nothing inherent to heater 3, it's just the first PWM-capable output on the expansion connector.

    I'm wondering whether it would work to have M3 preset the laser power (without actually turning it on) in laser mode. Then the power you set with M3 would be used on subsequent G1 commands with no S parameter (but not on G0 commands). Do you think that would work for you?

    Meanwhile you could try using CNC mode (M453) which lets you map M3 to an output for spindle motor control in a similar way to M452. Note, in CNC mode, G0 commands ignore the feedrate and always use maximum speed as set by M203.



  • Hi. Im using LightBurn for generating gcode. Most of preset machine have persistent power so gcode have S power only on change. It will be good if M5 lock the output so none of G1 movements turn on laser. M3 without without Sxxx could unlock laser with previously setup power or with S to set new power. But Laser would only turn on with G1 movement. If S is included in G1 new power is set up. G0 cannot reset power.

    Now im using custom written program convert gcode. It reads line by line and if S power param is in this line i stor it, If G1 line without S i add S with stored power at the end.


  • administrators

    @bishop86 said in Laser turns off after following code is sent after M3:

    Hi. Im using LightBurn for generating gcode. Most of preset machine have persistent power so gcode have S power only on change. It will be good if M5 lock the output so none of G1 movements turn on laser. M3 without without Sxxx could unlock laser with previously setup power or with S to set new power. But Laser would only turn on with G1 movement. If S is included in G1 new power is set up. G0 cannot reset power.

    Are there any other firmwares that behave in this way?



  • @dc42 I've tired a lot of software (lightburn, laserweb4, lasergrbl) in the last few days that generate GCode using G1 Xnnn Ynnn Snnn to set the laser power. However, as @bishop86 mentioned, the S parameter is only included when the S is supposed to change, meaning G-Code will look like this:

    G1 X33.73 Y16.07 S255.00
    G1 X36.89 Y19.23
    G1 X36.94 Y19.30
    G1 X36.96 Y19.38
    

    This means that S is supposed to stick, and I doesn't do that currently. That's why @bishop86 wrote a script to append the S paramter to G1 lines that have it missing.

    In the meantime, would you be able to share the script you wrote @bishop86 ?


  • administrators

    Which firmware version are you running? The G1 S parameter is already sticky in 2.03beta2 (although I regard this as dangerous, and a very bad decision on the part of those who introduced the S parameter and made it sticky).



  • @dc42 Oh, I haven't tried the beta yet, still running 2.02. Will give it a try in the next days!


  • administrators

    Advance warning: in 2.03beta3 the G1/G2/G3 S parameter will only be sticky if you add parameter S1 to your M452 command.


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.