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

NEJE-like Laser as CNC upgrade

Scheduled Pinned Locked Moved Solved
Laser Cutters
11
47
3.3k
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.
  • undefined
    FelixH
    last edited by 28 Jun 2020, 11:46

    Hi there, fellow Duet users

    As what I though to be a nice upgrade to my Duet-controlled Workbee CNC, I ordered a NEJE-like Laser from Aliexpress. The specs are as these.

    Yesterday I spent most of the afternoon trying to figure out how to generate Gcode for engraving which, since I am a macOS user, turned out to be more complicated than anticipated. Finally I found Visicut, which I will be testing (open source, cross-plattform).

    Today I'm spending the day trying to figure out how will I be connecting the Laser module to the Duet. I've read through the wiki page regarding this topic, but I still have some questions.

    • If I understand that correctly, the laser I ordered accepts 3v3 PWM signals, so I do not know if I need to prepare a breakout board as the one described there.
    • Also, to work with a Laser, the Duet has to be on "Laser Mode". Usually I have it on CNC mode (obviously). So I don't know if I will have to edit the config.g file every time I want to use the Laser. Which is no big deal at all, but still. Wouldn't it be possible to set up some initial GCode on the jobs?. I am guessing the answer is no, but... or would it be better to have two separate config.g files and switch accordingly?

    Thanks in advance!

    undefined 1 Reply Last reply 1 Jul 2020, 11:31 Reply Quote 0
    • undefined
      FelixH
      last edited by 27 Nov 2020, 13:37

      Well just an update on my side. I finally finished upgrading my Workbee with a worthy electronics box where everything is well organized. I never liked it to have the controller board exposed and on the moving gantry.

      Anyway, I've been able to put my laser to work by following the indications here. I used the brake-out board suggested and it works just fine. Amazingly enough, it worked on the first try, which for my standards is amazing to say the least.

      I have a problem though when switching back to CNC mode and it is the following error:

      M98 P"0:/macros/Laser/Switch to CNC"
      CNC mode selected Error: G10: Attempt to set/report offsets and temperatures for non-existent tool: 999
      

      The macro I'm using to switch back to CNC mode is the following, which is a mix between what I've seen and what I found on my config.g file

      M106 P2 S0  ; turn off 12v PSU
      
      M453 ; Put the machine into CNC Modes
      
      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
      M501 ; Load Stored Parameters 
      M98 Pcustomconfig.g ; Execute custom config settings
      

      any clue in what is this about? it would be much appreciated!

      undefined 1 Reply Last reply 27 Nov 2020, 18:37 Reply Quote 0
      • undefined
        FelixH
        last edited by 30 Jun 2020, 08:49

        Really, nobody has installed this laser?

        1 Reply Last reply Reply Quote 0
        • ?
          A Former User
          last edited by 30 Jun 2020, 09:24

          If you need a breakout board or not would depend on how much current the laser pwm input needs and if it can be wired directly to a pin; or if it can work with a fan output, but a fan output might not be suited due to the inverted nature of the n-channel mosfet.

          In any case, best make sure you can add a pull down to the output to ensure the laser doesn't trigger if the output is allowed to float.

          Shouldn't be any reason you can't switch to M452 in your g-code but I'd be more concerned with switching back to M453 in the event of a aborted job or something.

          1 Reply Last reply Reply Quote 0
          • undefined
            droftarts administrators @FelixH
            last edited by 1 Jul 2020, 11:31

            @FelixH I'm not sure about the wiring, but there's two ways you can set up the switching between CNC and laser. Either use a macro that runs the relevant command (M452 for laser, M453 for CNC, also M450 reports the mode it's in) and any other settings. Or use M505 and have separate config folders for CNC and laser. You then have a very simple config.g in the sys folder that calls the config.g from the relevant folder. It means that you can be sure that if you reset, it will still be in the same mode! I'd guess there will be quite a lot of settings that will need to change between CNC and laser, eg motor speeds and accelerations.

            I use M505 to be able to switch between firmware setups when testing. The sys/config.g looks like this:

            ;M505 P"RRF2"
            M505 P"RRF3"
            ;M505 P"TEST"
            M98 P"config.g"
            

            Then I have 3 folders (RRF2, RRF3 and TEST) that each have a full set of config files. You do have to manually edit the sys/config.g file to change setup, though it's just a case of commenting/uncommenting the correct lines.

            Ian

            Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

            ? 1 Reply Last reply 1 Jul 2020, 12:00 Reply Quote 1
            • ?
              A Former User
              last edited by A Former User 7 Jan 2020, 12:12 1 Jul 2020, 11:56

              if you run RRF3 i suppose you could have a switch to control the mode at boot with (something like) and possibly a trigger to trigger a warning/reboot.

              M950 J0 C"thisinputpin"
              if sensors.gpIn[0].value > 0
                M505 P"Laser"
              else
               M505 P"CNC"
              M98 P"config.g"
              
              undefined 1 Reply Last reply 1 Jul 2020, 12:10 Reply Quote 0
              • ?
                A Former User @droftarts
                last edited by 1 Jul 2020, 12:00

                @droftarts said in NEJE-like Laser as CNC upgrade:

                I use M505 to be able to switch between firmware setups when testing.

                a little OT, but M997 ignores M505 or is it just me?

                undefined 1 Reply Last reply 14 Oct 2020, 20:42 Reply Quote 0
                • undefined
                  FelixH
                  last edited by 1 Jul 2020, 12:04

                  I will try something like this, yes. Thanks for your inputs. A macro is what I was thinking of. I do not run RRF3 as the folks on Ooznest have not released anything new for a long time...

                  Another question laser related. On the Wiki page describes wiring the Laser to the Bed PWM output with the breakout board and so on... Where can I wire my spindle to be able to control the RPM with GCode?. In order no minimize confusion in the future, I'd prefer to use the standard Mcodes for that. I don't know if it would not be compatible with having a laser.

                  ? 1 Reply Last reply 1 Jul 2020, 12:07 Reply Quote 0
                  • ?
                    A Former User @FelixH
                    last edited by 1 Jul 2020, 12:07

                    @FelixH said in NEJE-like Laser as CNC upgrade:

                    I do not run RRF3 as the folks on Ooznest have not released anything new for a long time...

                    come to think of it you might be able to replicate the same thing with M582 in config.g and put M505 in triggern.g

                    1 Reply Last reply Reply Quote 0
                    • undefined
                      FelixH @A Former User
                      last edited by 1 Jul 2020, 12:10

                      @bearer said in NEJE-like Laser as CNC upgrade:

                      if you run RRF3 i suppose you could have a switch to control the mode at boot with (something like) and possibly a trigger to trigger a warning/reboot.

                      M950 J0 C"thisinputpin"
                      if sensors.gpIn[0].value  < 0
                        M505 P"Laser"
                      else
                       M505 P"CNC"
                      M98 P"config.g"
                      

                      Can you actually do some conditionals on GCodes?

                      ? 1 Reply Last reply 1 Jul 2020, 12:11 Reply Quote 0
                      • ?
                        A Former User @FelixH
                        last edited by 1 Jul 2020, 12:11

                        @FelixH said in NEJE-like Laser as CNC upgrade:

                        Can you actually do some conditionals on GCodes?

                        in RRF3 that should be valid +/- a few possible spelling mistakes, yes.

                        1 Reply Last reply Reply Quote 0
                        • undefined
                          FelixH
                          last edited by 1 Jul 2020, 12:13

                          oh... too bad. I will have to wait, because it opens up a whole new realm of possibilities

                          undefined 1 Reply Last reply 1 Jul 2020, 13:09 Reply Quote 0
                          • ?
                            A Former User
                            last edited by 1 Jul 2020, 12:14

                            yes, so many g-codes and so little time... 😄

                            1 Reply Last reply Reply Quote 0
                            • undefined
                              droftarts administrators @FelixH
                              last edited by 1 Jul 2020, 13:09

                              @FelixH While the WorkBee does currently use RRF2 (2.0.3 I think, though it should be okay to use 2.05.1), I don't think there's anything in RRF 3.1.1 that breaks the compatibility, other than updating fans, endstops, thermistor and heater (if used) assignments in config.g (and possibly a few other codes). I haven't tested the WorkBee DWC, but DWC 1.22.6 works for me in RRF 3.1.1 with Duet 2 WiFi, on which the WorkBee interface is based. So you could create another folder to hold a RRF 3.1.1 config, and try it out, and you can always just flash firmware back to RRF2 as needed.

                              Ian

                              Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                              1 Reply Last reply Reply Quote 0
                              • radiomodellundefined
                                radiomodell
                                last edited by 1 Jul 2020, 13:15

                                @FelixH said in NEJE-like Laser as CNC upgrade:

                                • If I understand that correctly, the laser I ordered accepts 3v3 PWM signals, so I do not know if I need to prepare a breakout board as the one described there.

                                I use my Duet2 Ethernet running Firmware Version 3 without breakout board to control same laser as you ordered. The Laser needs 12V Power supply continuously and Laser beam is controlled by PWM-signal.

                                Heater 3 pin controls Spindel- and Laser Power. Heater 6 pin is output of Laser PWM signal.

                                This is my code to switch to laser mode:

                                ; Configuration file for Duet Ethernet (firmware version 3.1.1)
                                ; executed at Startup of Laser mode
                                ;
                                ;
                                G54                                    ; 1. Koordinatensystem anwählen
                                M208 X550 Y1200 Z230 S0                ; Set axis maximum
                                ;
                                M453 C"nil"                            ; CNC-Modus Pin für Spindel abwählen 
                                M950 P0 C"exp.heater3"                 ; M42 P0 S255 schaltet Laser Spannungsversorgung ein, M42 P0 S0 schaltet aus
                                M42 P0 S0			       ; Laser Power Ausschalten	
                                M452 C"exp.heater6" R500 S1 Q20000     ; laser uses heater3 pin,  PWM frequency 100Hz;
                                ;
                                ; Tools
                                M140 H-1                        ; Heizbett aus
                                M563 P0 D-1 H-1                 ; Tool0 abwählen
                                M563 P1 D-1 H-1                 ; Tool1 abwählen
                                
                                M563 P0 S"Laser"                ; Define tool 0
                                G10 P0 X-7 Y-45 Z-68.5          ; Set tool 0 axis offsets vs. Headposition  -68.5 Z-Achse Nullpunkt (Laser Fokus)
                                T0
                                M42 P0 S0			;Laserpower aus nach Werkzeuganwahl.
                                
                                

                                This code switches to CNC-Mode

                                ; Configuration file for Duet Ethernet (firmware version 3.1.1)
                                ; executed at start-up of CNC mode
                                ;
                                ;
                                G54    ; 1. Koordinatensystem anwählen
                                M950 P0 C"nil"       ; falls Laser-Modus Aktiv war, Pin freigeben
                                
                                M453 C"exp.heater3" R500  ; spindle forward on heater 3 pin, R=Max Spindeldredzahl
                                
                                ; Tools
                                ;M140  S-274               ; Heizbett aus
                                M140 H-1                   ; Heizbett aus
                                M563 P0 D-1 H-1           ; Tool 0 abwählen
                                M563 P1 D-1 H-1           ; Tool 1 abwählen
                                
                                M563 P0 S"Spindel"        ; Define tool 0
                                G10 P0 X0 Y0 Z0           ; Set tool 0 axis offsets vs. Headposition
                                
                                M208 X550 Y1200 Z230 S0   ; Set axis maxima
                                
                                

                                Switching between modes I have to redefine Heater 3 pin.

                                G-code at beginning of work file is:

                                G90
                                T0
                                M42 P0 S255   ; switches Laser Power on
                                G04 2000      ; wait until Laser power is stabilised
                                M05
                                G55
                                
                                

                                trailing code is:

                                M05
                                G04 3000
                                T-1
                                M42 P0 S0
                                G54
                                G0 X5 Y5 Z220
                                
                                undefined undefined 2 Replies Last reply 1 Jul 2020, 14:26 Reply Quote 1
                                • undefined
                                  FelixH @radiomodell
                                  last edited by 1 Jul 2020, 14:26

                                  @radiomodell thanks a lot for the info! I'm assuming you have these snippets set in macros, right?

                                  So, if I get it correctly, if you have the Bed pin to control both the spindle and the laser, it means that you have to wires coming out of each terminal, so to say?

                                  Another question, the snippet

                                  M42 P0 S255   ; switches Laser Power on
                                  

                                  What does it do exactly? Does it power the Laser's PSU via a relay? Because to enable the laser or spindle the M3 command is used with a Sxxx on the movement codes, right?

                                  Vielen Dank nochmals!

                                  1 Reply Last reply Reply Quote 0
                                  • radiomodellundefined
                                    radiomodell
                                    last edited by 1 Jul 2020, 14:54

                                    @FelixH You can use these snippets in macros with firmware version 3. And I selected different I/O pins. Heater3 pin controls one solid state relais. Spindel and laser power supply are both connected to the 230V sockets controlled by relais. Heater6 pin controls laser PWM.
                                    In Laser mode line 9 M950 P0 C"exp.heater3" defines heater3 pin to be controlled by M42 P0 SXXX command . 0 off, 255 on. Laser PWM is defined in line 11: M452 C"exp.heater6" R500 S1 Q20000. Just mentioned wrong comment in line 11. PWM frequency is 20KHz, not 100 Hz. Sorry for that.
                                    Same pin controls spindel on/off in CNC mode. Thus I have te redefine pin in CNC-mode. To CNC mode in line 6 definition is released. In line 8 spindle control is "connected" to heater3 pin. Now in CNC mode it is switched by M3 command.

                                    1 Reply Last reply Reply Quote 0
                                    • undefined
                                      FelixH
                                      last edited by 1 Jul 2020, 15:07

                                      Thanks again @radiomodell . It's a lot of info right now, I shall look at in with more detail once my laser arrives. I am still on RRF 2, so I will have to adapt. I also ordered the components to build the breakout board. Just in case...

                                      1 Reply Last reply Reply Quote 0
                                      • undefined
                                        sh12
                                        last edited by 22 Jul 2020, 13:54

                                        @radiomodell , not to hijack this thread but I am running into the exact same thing. I have the NEJE laser module but cannot get it to be controlled via pwm. It is always at full power. Can you tell me exactly how you have it wired?
                                        I have 12v supply going to 12v, and Gnd pins. Then I have the duex fan6 pwn pin and fan6 gnd pin going to the laser pwm and temperature (or gnd) pins.

                                        Looks like you may be able to walk me through this if you're willing.

                                        radiomodellundefined 1 Reply Last reply 23 Jul 2020, 13:09 Reply Quote 0
                                        • undefined
                                          droftarts administrators @radiomodell
                                          last edited by 23 Jul 2020, 09:39

                                          @radiomodell said in NEJE-like Laser as CNC upgrade:

                                          M452 C"exp.heater6" R500 S1 Q20000 ; laser uses heater3 pin, PWM frequency 100Hz;

                                          @radiomodell @FelixH @sh12 Please note 'Q' parameter is incorrect, it should be 'F' for PWM frequency. The example in the Gcode dictionary for M452 was incorrect, but has now been fixed, thanks to @Royassas (see https://forum.duet3d.com/post/168234)

                                          So @radiomodell, you're probably using a PWM frequency of 500Hz, which is the default!

                                          Ian

                                          Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                                          1 Reply Last reply Reply Quote 0
                                          • radiomodellundefined
                                            radiomodell
                                            last edited by radiomodell 23 Jul 2020, 12:40

                                            @droftarts said in NEJE-like Laser as CNC upgrade:

                                            So @radiomodell, you're probably using a PWM frequency of 500Hz, which is the default!

                                            Thanks a lot for the hint! Laser worked fine til now. I will correct M452 command before next use.

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