Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    Using m42 command to control laser

    Laser Cutters
    4
    10
    184
    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.
    • Oman737
      Oman737 last edited by

      I'm able to control my laser with M42 p0 S0..1 but I would like to be able to use 0..255 as my range. since most programs use 255 as the max.

      This is what is in my config g.
      M452
      M950 P0 C"exp.heater3" Q2000

      to control
      M42 p0 S0..1

      0=off, 1= full pwr

      Thank You

      o_lampe jay_s_uk 2 Replies Last reply Reply Quote 0
      • o_lampe
        o_lampe @Oman737 last edited by

        @oman737
        M42 Wiki says:

        M42 switches a general purpose I/O pin. Use M42 Px Sy to set pin x to value y. The S field may be in the range 0..1 or 0..255.
        
        1 Reply Last reply Reply Quote 0
        • jay_s_uk
          jay_s_uk @Oman737 last edited by

          @oman737 in laser mode, typically M3 is used to turn the laser "on" and then the S value in G0 and G1 sets the laser power. M5 turns the laser "off"

          Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

          Oman737 1 Reply Last reply Reply Quote 0
          • Oman737
            Oman737 @jay_s_uk last edited by

            @jay_s_uk That's what I thought but when I Used the method explained in https://duet3d.dozuki.com/Wiki/Laser_PWM_control it never seems to work. it would tell me that Error: M3: Command is not supported in machine mode Laser. I even tried M571 P"exp.heater3" F200 S255 but got Error: M571: Pin 'exp.heater3' is not free. At this point, I'm not sure where to go.

            Here is my config.g file in case I'm missing something.

            ; Configuration file for Duet WiFi (firmware version 3)
            ; executed by the firmware on start-up
            ; generated by RepRapFirmware Configuration Tool v3.2.3 on Fri May 21 2021 12:29:37 GMT-0400 (Eastern Daylight Time)

            ; General preferences
            G90 ; send absolute coordinates...
            M83 ; ...but relative extruder moves
            M550 P"CR-10" ; set printer name
            M918 P1 E4 F2000000 ; configure direct-connect display

            ; Network
            M552 S1 ; enable network
            M586 P0 S1 ; enable HTTP
            M586 P1 S0 ; disable FTP
            M586 P2 S0 ; disable Telnet

            ; Drives
            M569 P0 S0 ; physical drive 0 goes forwards
            M569 P1 S0 ; physical drive 1 goes forwards
            M569 P2 S1 ; physical drive 2 goes forwards
            M584 X0 Y1 Z2 ; set drive mapping
            M350 X16 Y16 Z16 I1 ; configure microstepping with interpolation
            M92 X80.00 Y80.00 Z1501 ; set steps per mm
            M566 X900.00 Y900.00 Z12.00 ; set maximum instantaneous speed changes (mm/min)
            M203 X22000 Y22000 Z300 ; set maximum speeds (mm/min)
            M201 X2000 Y2000 Z20.00 ; set accelerations (mm/s^2)
            M906 X800 Y800 Z800 I30 ; set motor currents (mA) and motor idle factor in per cent
            M84 S50 ; Set idle timeout

            ; Axis Limits
            M208 X0 Y0 Z0 S1 ; set axis minima
            M208 X300 Y300 Z360 ; set axis maxima

            ; Endstops
            M574 X1 S1 P"xstop" ; configure active-high endstop for low end on X via pin xstop
            M574 Y1 S1 P"ystop" ; configure active-high endstop for low end on Y via pin ystop
            M574 Z1 S2 ; configure Z-probe endstop for low end on Z
            ;Laser
            M452 C"exp.heater3" R255 F200 ; Enable Laser mode, on exp.heater3, with max intensity being 255, and a PWM frequency of 200

            T3P3Tony 1 Reply Last reply Reply Quote 0
            • T3P3Tony
              T3P3Tony administrators @Oman737 last edited by

              @oman737 what version of RRF are you using?

              www.duet3d.com

              1 Reply Last reply Reply Quote 0
              • Oman737
                Oman737 last edited by

                @t3p3tony I'm using 3.3

                jay_s_uk 1 Reply Last reply Reply Quote 0
                • jay_s_uk
                  jay_s_uk @Oman737 last edited by

                  @oman737 are you actually using exp.heater3 as the output?
                  can you try running M98 P"config.g" to see if it throws any errors

                  Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                  Oman737 1 Reply Last reply Reply Quote 0
                  • Oman737
                    Oman737 @jay_s_uk last edited by

                    @jay_s_uk This is what I got

                    M98 P"config.g"
                    HTTP is enabled on port 80
                    FTP is disabled
                    TELNET is disabled

                    1 Reply Last reply Reply Quote 0
                    • Oman737
                      Oman737 last edited by

                      Thank you for all of the help I don't know what it was that made it work but when I ran a gcode that was made in lightburn it worked as it should.

                      o_lampe 1 Reply Last reply Reply Quote 1
                      • o_lampe
                        o_lampe @Oman737 last edited by o_lampe

                        @oman737 said in Using m42 command to control laser:

                        I don't know what it was that made it work

                        That's a dangerous situation with a laser that could melt your eyeballs... you should at least KNOW how to switch it off

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