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

    Setup Relay-Controlled Spindle

    Scheduled Pinned Locked Moved
    CNC
    5
    12
    598
    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.
    • N7JTIundefined
      N7JTI
      last edited by

      I'm trying to get M3/M5 to work for spindle control on my Duet3 controlled CNC. I have a relay that controls power to my trimmer-router based spindle. There is no RPM control, just on-off.

      I can control the relay... If I just define it as a GPIO I can toggle the GPIO. So, this works to define the GPIO

      M950 P1 C"out1"
      

      The following code does NOT work to define a spindle. I get no errors, and I can't see a spindle defined in the web interface and M3 does not actuate the relay. out3 is not used.

      ; Set CNC mode
      M950 R0 C"out3+out1" Q100
      M563 P0 S"Spindle 1" R0 ; Create tool 0 with spindle 0 and call it "Spindle 1"
      M453
      

      What am I missing here?

      Thanks,
      Alan

      o_lampeundefined dc42undefined 2 Replies Last reply Reply Quote 0
      • Nightowlundefined
        Nightowl
        last edited by

        Following...

        Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
        I'm still on my learning curve, so take everything I say with caution!

        RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

        1 Reply Last reply Reply Quote 0
        • N7JTIundefined
          N7JTI
          last edited by

          Is there some better place on the forum to post this?

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

            @n7jti
            It's just wild guessing and you might have tried it yourself already, but I'd define

            M950 R0 C"nil+out1" L*somevalue*
            

            My guess is, that out3 as nonexisting PWM pin has no valid signal and/or using M3 without a S(peed) value only works with a predefined speed from the L-parameter.
            You might get away with setting out3 to high in config

            N7JTIundefined 1 Reply Last reply Reply Quote 0
            • Nightowlundefined
              Nightowl
              last edited by

              @o_lampe I'm following, but you're not using a spindle, per se, but a trim router, which is what I intend to do from my Duet3 MB6HC.

              I'm happy to be corrected, but I don't think you need the second part of the code. Raymond Stone has published a blog (here: https://codingblog.galcomp.net/2020/08/15/adding-a-relay-to-a-duet-2-to-switch-on-a-router-via-gcode/?fbclid=IwAR3dWqBOuMMktVsoJPvOqLCNTAernA0aN4__sVvq2TbP3ZL2_Tdv6BDmFL4) explaining how he did it with a Duet 2, but he used macros. I think these are essentially M3 and M5 commands?

              Hope this helps.

              Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
              I'm still on my learning curve, so take everything I say with caution!

              RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

              N7JTIundefined 1 Reply Last reply Reply Quote 0
              • N7JTIundefined
                N7JTI @o_lampe
                last edited by

                @o_lampe I tried using nil as a pin and it errors when I try it. SO I'm using an unused pin. I'll give the "L" a shot

                N7JTIundefined 1 Reply Last reply Reply Quote 0
                • N7JTIundefined
                  N7JTI @Nightowl
                  last edited by

                  @nightowl999 I can already switch my router on and off via a relay. The problem here is that I have to hand-edit the g-code that comes out of the post-processor in order to get my router to turn on and off automatically. That is painful. I'd rather have the router respond to M3/M5.

                  So how do we get a pin to be high/low in response to an M3/M5 command?

                  Nightowlundefined 2 Replies Last reply Reply Quote 0
                  • Nightowlundefined
                    Nightowl @N7JTI
                    last edited by

                    Sorry, @n7jti. I probably can't help you then 😢

                    Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                    I'm still on my learning curve, so take everything I say with caution!

                    RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

                    1 Reply Last reply Reply Quote 0
                    • N7JTIundefined
                      N7JTI @N7JTI
                      last edited by

                      @n7jti The "L" made no difference at all.

                      jumpedwithbothfeetundefined 1 Reply Last reply Reply Quote 0
                      • jumpedwithbothfeetundefined
                        jumpedwithbothfeet @N7JTI
                        last edited by

                        @n7jti It may help showing a picture of your relay wiring/what type of relay etc and your full config.g file, adding an ! before the the output will also invert the signal, but you need to know if it requires a high or low signal to turn on the relay.

                        6HC Voron Trident based, 6XD CNC, Mini 5 polar printer

                        1 Reply Last reply Reply Quote 0
                        • dc42undefined
                          dc42 administrators @N7JTI
                          last edited by dc42

                          @n7jti which firmware version are you using?

                          Why are you using 2 pin names in the M950 R0 command when you have only one spindle control pin? Some of the examples in the M950 and M453 command descriptions use only a single pin name in the M950 R0 command.

                          Duet WiFi hardware designer and firmware engineer
                          Please do not ask me for Duet support via PM or email, use the forum
                          http://www.escher3d.com, https://miscsolutions.wordpress.com

                          1 Reply Last reply Reply Quote 0
                          • Nightowlundefined
                            Nightowl @N7JTI
                            last edited by

                            @n7jti I'll need to pick your brains on that, probably. I still haven't quite got my head around how to do that, yet.

                            Few things are more dangerous than taking the advice of someone who thinks he knows what he's doing.
                            I'm still on my learning curve, so take everything I say with caution!

                            RatRig 1075, Duet3 MB6HC, Sorotec SFM 1000 PV-ER milling motor, Hobbyist

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