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

    Config for Spindle or Laser

    Scheduled Pinned Locked Moved
    CNC
    3
    5
    379
    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.
    • SamanthaJaneyCakeundefined
      SamanthaJaneyCake
      last edited by

      Hi there,
      Moved my machine from an old RAMPS1.4 running Marlin to a Duet2 Wifi.
      On the RAMPS1.4 I just ran a PWM out from one of my GPIO pins to the speed controller (with common ground to board) and that worked absolutely fine.
      The plan here is to have two ports on the Z carriage allowing me to quickly swap between my spindle and laser. I'll have a macro that tells the system it's using the spindle (M453) and another to change that to laser instead (M452). In spindle mode it just controls "!fan1" to PWM control the speed controller. For laser I'm cheating and hooking the PWM signal pin up to "!fan0" but also the power input to the heated bed output, so will be disabled on startup and avoid the power blip issue associated with controlling a laser this way.

      I'm now currently trying to set up my config file to get M3 to work properly literally just for the spindle and having issues with it. I'm not seeing any example files around but have followed what I can find on the wiki. Still, I get no signal out on my spindle PWM pin (fan1).
      I've removed all the laser stuff for now while I focus on getting my spindle to literally just turn on.

      ; CNC and Laser
      M453 ; CNC mode
      M950 R0 C"!fan1" Q31372 L12000 ; configure spindle pins, fan1 is 5V PWM
      ; C = PWM pin, Q = frequenc(Hz), L = max speed
      M563 P0 S"Spindle" R0 ; assign spindle 0 to tool 0
      T0 P0
      

      I then tried selecting tool 0 and setting it to 12000RPM:

      T0
      M3 S12000
      

      But no voltage change on "fan1" pin.

      I had this exact board up and running my laser via fan0 previously and that was working fine, the code is minimally different, so I'm a bit lost as to what I'm doing (or not doing) wrong. Any advice really appreciated, thanks!

      o_lampeundefined gloomyandyundefined 2 Replies Last reply Reply Quote 0
      • o_lampeundefined
        o_lampe @SamanthaJaneyCake
        last edited by

        @SamanthaJaneyCake
        Maybe it's related to the T0 P0 line? ==> Change tool, but don't run toolchange macros
        Have you tried M3 P0 S12000 ?

        ...just shooting from the hip,,, it's early sunday morning

        SamanthaJaneyCakeundefined 1 Reply Last reply Reply Quote 0
        • gloomyandyundefined
          gloomyandy @SamanthaJaneyCake
          last edited by

          @SamanthaJaneyCake Not sure if you have seen the Duet docs on how best to connect a laser to the various duet boards: https://docs.duet3d.com/User_manual/Machine_configuration/Configuration_laser

          Remember that fan (and heater outputs) are not simple gpio pins, they are actually a mosfet output that is switching the negative connection between "floating" and ground (rather than driving a positive and negative output like a gpio pin will do). This works fine for fans and heaters (which is what it is designed for), but may not work for some other devices. In particular you may not get a usable reading if you are trying to measure the output of the fan between the output pin and negative/ground. You may be able to make it usable by adding a pull up resistor to the mosfet output, or by using the output pin and a positive voltage - (like +5v).

          SamanthaJaneyCakeundefined 1 Reply Last reply Reply Quote 0
          • SamanthaJaneyCakeundefined
            SamanthaJaneyCake @o_lampe
            last edited by

            @o_lampe early Sunday mornings indeed! No, I’ve tried variations with and without the T0 line, run M3 P0 S12000 and tried setting them up as GPIO and addressing them with M42. I eventually ended up taking all the tool connections off, sticking a small 5V fan on and sanity checking the pins actually work (they do), so challenge for today is to troubleshoot what I’m doing wrong 😑

            1 Reply Last reply Reply Quote 0
            • SamanthaJaneyCakeundefined
              SamanthaJaneyCake @gloomyandy
              last edited by

              @gloomyandy morning, thanks for checking that with me. I read all the docs to do with laser control thoroughly when I was using this board for my laser cutter. At the time I’d ordered the expansion board to do it properly but the delivery guy marked it as “left in outhouse” (we don’t have an outhouse) and I never saw it again. In the end I connected it to fan0 as a 5V capable PWM and I’ve had almost perfect control over the laser prior to this setup.
              The one issue I got was it powering up for a second at initialisation, I had figured that to solve that I could set bedheater as a GPIO and essentially use it as my power control for the laser. This in testing has worked fine but one of my tests today will be to decouple that and run the laser directly from the PSU like it was previously just to sanity check that setup that I know ought to work.

              For the spindle I could try feeding it a 5Vref from the fan0 connector to the speed controller, good shout. Laser I don’t have that option unfortunately.

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