Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Laser/CNC macros for RRF3 on Workbee

    Scheduled Pinned Locked Moved
    CNC
    4
    9
    751
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • FelixHundefined
      FelixH
      last edited by

      Hi all,

      yesterday I updated the firmware of my Ooznest Workbee. Last year I upgraded her with a SuperPID and a Laser. It took a while, but I was able to create some simple macros for switching between CNC and Laser modes.

      However now the firmware runs FFR3 and these macros do not work anymore and I am having a hard time adapting them, so I would appreciate some help here.

      Before the upgrade this was my setting:

      customconfig.g (which is called at the end on config.g)

      ; ADD ANY CUSTOM SETTINGS BELOW
      
      ;New Steps=(mm requested*current steps)/mm actual
      
      
      
      M92  X399.03 Y398.49 Z400 ; Set steps per mm
      
      M574 X2 Y2 Z2 S1 ; Set active low endstops
      
      M106 P1 I-1 H-1 A21 ; disable FAN2 & allocate tool 0 to pin 21
      M563 P0 S"Spindle" ;
      M453 S"Spindle" P21 I1 T0 R30000; , Tool 0 = Spindle, invert PWM, 30000 RPM at max PWM
      

      Switch to Laser.g (macro to switch from CNC to Laser modes)

      M106 P2 S255  ; turn on 12v PSU
      
      M307 H3 A-1 C-1 D-1       ; Disable Heater output on H3
      M452 P3 S1 R255 F200         ; Enable Laser mode, on output 3 (heater 3), with max intensity being 255, and a PWM frequency of 200
      

      Switch to CNC.g (macro to switch from Laser to CNC modes)

      M106 P2 S0  ; turn off 12v PSU
      
      M453 ; Put the machine into CNC Modes
      
      M140 H-1 ; Disable heated bed
      M208 X800 Y770 Z94 S0 ; Set axis maxima
      M98 Pcustomconfig.g ; Execute custom config settings
      

      As far as I remember I used the output on FAN1 to control the Spindle speed.
      The FAN2 was used to control a SSR to turn on/off a 12v PSU, for the laser.

      the new config.g provided by Ooznest, simply calls different config files:

      config.g (by Ooznest)

      ; Configuration file for Duet
      ; executed by the firmware on start-up
      ; WorkBee Firmware Version 1.1
      
      global systemSettingsVersion={1.2}
      
      ; Configuration files
      M98 P"config-network.g"
      M98 P"config-drives.g"
      M98 P"config-axes.g"
      M98 P"config-axes-limits.g"
      M98 P"config-axes-calibration.g"
      M98 P"config-axes-endstops.g"
      M98 P"config-probe.g"
      M98 P"config-spindle.g"
      M98 P"config-laser.g"
      
      ; Other Settings
      M453 ; Put the machine into CNC Modes
      G90 ; Set absolute coordinates
      M140 H-1 ; Disable heated bed
      M564 S1 H1 ; Disable jog commands when not homed
      M911 S21.0 R23 P"G91 G1 Z3 F1000" ; Configure power loss resume
      
      ; User Configuration files
      M98 P"config-user-settings.g"
      
      M501 ; Load Stored Parameters 
      

      The instructions provided by the folks at Ooznest seem a little bit superficial, in my opinion:

      https://learn.ooznest.co.uk/Guide/How+To+Update+WorkBee+Firmware+V1.0.7+>+V3.3.0-1.2/240#s1128

      I asked for help on their site, but they came back to me twice providing solutions for something I was not having an issue with...

      So I would appreciate any help somebody would give me in adapting my old macros to the new paradigm...

      Thanks in advance!

      FelixHundefined 1 Reply Last reply Reply Quote 1
      • Phaedruxundefined
        Phaedrux Moderator
        last edited by

        There's a lot of nested macros in there, might help to share those as well.

        If you run those older macros now do you get any errors?

        This shows how M452 has changed in RRF3
        https://duet3d.dozuki.com/Wiki/M452

        You don't need M307 H3 A-1 C-1 D-1 to unbind the heater anymore.

        In general, checking the gcode wiki for the gcodes in there should give some information on how it's changed in RRF3.

        There's also this example. https://duet3d.dozuki.com/Wiki/Laser_PWM_control#Section_RepRapFirmware_3_x

        Z-Bot CoreXY Build | Thingiverse Profile

        FelixHundefined 1 Reply Last reply Reply Quote 0
        • FelixHundefined
          FelixH @FelixH
          last edited by

          Well, I have gone a long way since the post and I got the Spindle working, including the control of RPMs.

          Now I am battling with the Laser. I got it to switch on/off the 12v PSU and switching to laser mode to cnc mode and back works ok. However, before the update I could use the M42 to set the laser at different intensities, for example at 1% for focusing purposes, but now I don't know how to get around it...

          1 Reply Last reply Reply Quote 0
          • FelixHundefined
            FelixH @Phaedrux
            last edited by

            @phaedrux

            there is something definitely amiss on my setup and I don't know what.

            On the "Switch to Laser" Macro I have the following line:

            M106 P2 S255  ; turn on 12v PSU
            
            M452 C"exp.heater3"  F200
            

            which, as far as I know, should work fine.

            As soon as I run the macro, the 12v PSU is switched ON and the laser goes on, full blast.
            None of the macros I have dim the laser power.
            The M5 command, does not switch OFF the laser.

            I tried changing "exp.heater3" for "exp.8" and it does not change.
            I tried changing "!exp.heater3" for "!exp.heater3" (notice the exclamation mark) and the laser does not turn ON.
            I tried unplugging the wire from the heater3 pin and the Laser continues to be ON.

            I am running out of ideas, to be honest.
            Any further help, will be welcomed.

            radiomodellundefined 1 Reply Last reply Reply Quote 0
            • FelixHundefined FelixH referenced this topic
            • radiomodellundefined
              radiomodell @FelixH
              last edited by

              @felixh This is my code for testing laser with 1% power. No need to switch to LASER mode. Just directly control pins. Maybe this code helps for testing.

              M950 P3 C"nil"                ; free P3 
              M950 P3 C"exp.heater3" Q200   ; Laser control to P3
              M42 P3 S0                     ; laser control off
              M106 P2 S255
              G04 P1000                     ; Breake stabilizing laser power supply
              M42 P3 S0.01                 ; Laser on with 1% power
              
              
              G04 P3000                      ; wait 3 seconds, then
              
              M42 P3 S0                      ; turn off laser control and power supply
              M106 P2 S0			          
              

              Here are my commands -with my pin configuration- to switch to laser mode:

              M950 R0 C"nil"                         ; free R0, coming fron CMC-Mode, not working properly in the moment
              M950 P0 C"exp.heater3"                 ; M42 P0 S255 Laser Power Supply on, M42 P0 S0 Laser Power off
              M42 P0 S0			                   ; Laser Power Ausschalten	
              M452 C"exp.heater6" R255 S0 F20000     ; laser uses heater6 pin for control, 255 is max power in M3 SXXX command, not sticky,  PWM frequency 20kHz;
              

              Laser power is switched on in Gcode job file.

              Phaedruxundefined FelixHundefined 2 Replies Last reply Reply Quote 1
              • Phaedruxundefined
                Phaedrux Moderator @radiomodell
                last edited by

                @radiomodell That's a good example macro. Mind if I add that to the laser documentation?

                Z-Bot CoreXY Build | Thingiverse Profile

                radiomodellundefined 1 Reply Last reply Reply Quote 0
                • radiomodellundefined
                  radiomodell @Phaedrux
                  last edited by

                  @phaedrux Please feel free to use code in documentation. In former post I just modified control of Power Supply to the Fan Pin FelixH was using.

                  here is the macro with my pin out.

                  M950 P0 C"exp.heater3"        ; M42 P0 S255 to switch on Laser power supply, M42 P0 S0 power supply off
                  M950 P3 C"nil"
                  M950 P3 C"exp.heater6" Q20000 ; Laser control to P3
                  M42 P0 S255                   ; Laserpower on
                  G04 P1000                     ; Breake stabilizing laser power supply
                  M42 P3 S0.01                  ; Laser on with 1% power
                  
                  ; following lines automatically switch off Laser power and power supply after 3 seconds. You can put M42 XX commands to a separate Macro to switch off laser independently.  
                  
                  G04 P3000                      ; wait 3 seconds, then   
                  
                  M42 P3 S0                      ; turn off laser control and power supply
                  M42 P0 S0			            
                  

                  My Duet is on 3.4 B7 Firmware on Duet2 Ethernet. The macro works well until i switch to CNC mode defining "exp.heater3" for spindle power. From that moment the heater3 pin is only usable in CNC mode. Leaving CNC mode does not free the pin. No further control in Laser or FFF mode. My only solution is a reboot of Duet.

                  B.t.w On 3.4 b7 firmware I added following code to config.g :

                  M950 P0 C"exp.heater3"       ; Floating Pin? Define it an switch it off
                  M42 P0 S0                    ; Power Ausschalten	
                  

                  Without putting "exp.heater3" to defined status it seems to be floating and it fires spindle frequently.

                  I wish you a Merry Christmas.

                  1 Reply Last reply Reply Quote 0
                  • FelixHundefined
                    FelixH @radiomodell
                    last edited by

                    @radiomodell thanks a lot for your snippets! As it so happens a couple of days ago, I came out with nearly the same ones on another thread: https://forum.duet3d.com/topic/19842/weird-laser-mode/36?_=1640511378171

                    And they work very fine.
                    Thanks again!

                    1 Reply Last reply Reply Quote 0
                    • o_lampeundefined
                      o_lampe
                      last edited by

                      I just posted a simple solution to fire the laser without moving here

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Unless otherwise noted, all forum content is licensed under CC-BY-SA