Setup Relay-Controlled Spindle
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?
Is there some better place on the forum to post this?
o_lampe last edited by o_lampe
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
@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.
@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
@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?
Sorry, @n7jti. I probably can't help you then
@n7jti The "L" made no difference at all.
jumpedwithbothfeet 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.
dc42 administrators 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.
@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.