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

using M3 command to open and close a switch

Scheduled Pinned Locked Moved
CNC
4
10
647
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
    anagh
    last edited by anagh 20 Oct 2020, 23:36

    Hello, I have a duet 3. I want to use the M3 command to open and close a switch. Initially, I tried to use a relay by connecting it to a fan output (out3). My hope is to be able to use the output3 voltage to switch the relay and close the switch. Here is what I used in config.h for that.

    M950 F0 C"out3" Q100 ; create fan 0 on pin out3 and set its frequency
    M106 P0 S0 H-1 ; set fan 0 value. Thermostatic control is turned off
    M563 P0 S"Spindle" F0
    M453 S"Spindle" P"out3" R12000 F2000 T0

    I read somewhere that the P parameter for M453 has been discontinued. When I remove P parameter, the "Spindle" in the DWC becomes inactive

    But when I send M3 S10000 command and connect a multimeter across the out3 pin, I don't get any voltage. Can anyone help me with this. The firmware I am using is 3.1.1.

    If there is any other better way to open or close a switch with M3 command (I can not use any other command), please let me know. Thanks!

    1 Reply Last reply Reply Quote 0
    • undefined
      Phaedrux Moderator
      last edited by 21 Oct 2020, 00:18

      Why must you use M3? I don't understand the requirement.

      Rather than treating it as a fan, why not treat it as an i/o pin and switch it with M42.

      https://duet3d.dozuki.com/Wiki/Gcode#Section_M42_Switch_I_O_pin

      Z-Bot CoreXY Build | Thingiverse Profile

      1 Reply Last reply Reply Quote 0
      • undefined
        anagh
        last edited by 21 Oct 2020, 01:07

        @Phaedrux This is mainly due to legacy reasons. My Gcode has several M3 and M5 commands. If I decide to switch them with M42, it will be cumbersome. Also, I use one more machine with a different controller which uses M3 and M5. So I will have to maintain separate sets of Gcodes for both machines.

        I can use M42 as a last resort. But preferrably, I would like to use M3 and M5.

        1 Reply Last reply Reply Quote 0
        • ?
          A Former User
          last edited by 21 Oct 2020, 01:30

          Does your M3 specify an fixed RPM with the S parameter? If so you should be able to use just M435 C"out3" Rn where n is the same RPM you use for M3.

          @anagh said in using M3 command to open and close a switch:

          M453

          in 3.2 M435 has a dedicated pin for on/off shouldn't that do what you need it to do regardless of speeds?

          https://duet3d.dozuki.com/Wiki/Gcode#Section_M453_in_RepRapFirmware_3_2_and_later

          in either case skip the M950 and M106 not sure you need M563 either.

          1 Reply Last reply Reply Quote 0
          • undefined
            anagh
            last edited by 21 Oct 2020, 02:11

            My M3 does not specify a fixed speed. For the other controller, my Gcode just has M3 without the S parameter.
            I will try using just M435 and let you know how it goes. Thanks for your help!

            1 Reply Last reply Reply Quote 0
            • undefined
              anagh
              last edited by 21 Oct 2020, 14:01

              @bearer I tried using M453 C"out3" R5000 in config.h. After that when I send the M3 S5000 command, I get a message saying "M3 S5000 command not supported in machine mode FFF". When I just M3, it accepts it but I don't get any voltage across out3 and after that when I send M5, I get the same error message of command not supported.

              Am I doing something wrong here?

              ? 1 Reply Last reply 21 Oct 2020, 14:32 Reply Quote 0
              • ?
                A Former User @anagh
                last edited by 21 Oct 2020, 14:32

                @anagh said in using M3 command to open and close a switch:

                not supported in machine mode FFF

                sounds like M453 didn't put the firmware in cnc mode

                what do you get if you query with M450?

                https://duet3d.dozuki.com/Wiki/Gcode#Section_M450_Report_Printer_Mode

                1 Reply Last reply Reply Quote 0
                • undefined
                  anagh
                  last edited by 21 Oct 2020, 18:52

                  In hindsight, the error is funny. In your earlier message, you mentioned M435 instead of M453. So I typed in M435 instead of M453 even though I knew I had to use M453.
                  I corrected that and now it is working. I have to use M3 Sxxxx to turn on the switch instead of just M3 like I did for the other controller but I will live with it.
                  Thanks a lot for your help.

                  1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User
                    last edited by 21 Oct 2020, 19:22

                    lol, sorry - don't trust random strangers on the internet at 3am😇

                    anyways, as long as the other controller doesn't complain about he S parameter then I'd say thats the way to go then.

                    1 Reply Last reply Reply Quote 1
                    • undefined
                      Alpenprinter
                      last edited by Alpenprinter 2 Sept 2021, 17:16 9 Feb 2021, 17:12

                      I have a quite similar Problem:

                      I want to switch a on/off realy to switch the spindle via the M3/M5 command.

                      The relay is connected the fan port 7 of a Duet3 board.
                      I configured the following lines:

                      "M453 P7 S0 T0 C"out1+out7+out2" ; set CNC Mode"

                      Result:
                      "M3" does not switch the relay, but "M3 S1" does.
                      "M5" stops the spindle, as intended.

                      How can I configure the board, so I can switch the spindle with "M3" only, without M1, because this is how the gcode ist generated my the postprocessor?

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