using M3 command to open and close a switch
anagh last edited by anagh
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!
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.
@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.
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.
in 3.2 M435 has a dedicated pin for on/off shouldn't that do what you need it to do regardless of speeds?
in either case skip the M950 and M106 not sure you need M563 either.
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!
@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?
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?
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.
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.
Alpenprinter last edited by Alpenprinter
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"
"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?