Simple relay control... or not?
-
I thought this would be fairly straightforward, but searching through these forums I haven't really found the solution I'm looking for I think I've looked in most places!
I've got a Duet3 MB6HC running my CNC machine and would like to use an external relay to turn the hand router on and off.
This is the relay (yes, some might say this is expensive for what it does, but it is what it is!)...
https://smile.amazon.co.uk/gp/product/B0765WBGK6/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1The relay needs a voltage to be activated and no voltage to deactivate (it's non-latching), so I think a fan output would work, but I need to understand how to turn the 'fan' on and off using g-code.
The blurb for the relay shows it can use a GPIO pin, which needs to be programmed to go 'high' to turn the relay on and low to turn it off. The voltage required is 3 to 14v.
So, my questions are these:
-
Should I use a spare 5-pin io connector, a 2-pin fan connector or something else?
-
Once the preferred connector has been configured, how would I go about activating/deactivating the relay with g-code (or a macro)?
Thanks
-
-
@nightowl999 just set it up as a spindle using M950
e.g.M950 R0 C"exp.heater3+exp.heater4" Q100
The first output in your case won't be used. The second output is where you would connect the relay (and in your case use a fan). Then M3 and M5 can be used to turn the spindle on and off -
This post is deleted! -
'Pon my soul, @jay_s_uk, is it really that simple?
I'm not using any of those 'Out' headers, but I'm assuming I can't just copy and paste that line into my config.g file! Should I edit the line to:
M950 R0 C"exp.heater1+exp.heater2" Q100
...and connect the two wires to the relay to OUT 2?
Thank you
-
@nightowl999
M950 R0 C"exp.heater1+exp.heater2" Q100
is for Duet 2. For Duet 3, use something likeM950 R0 C"out1+out2" Q100
I'm assuming your PSU is 12V, as out1,2,3 and 4 use VIN.
See here for pin names and capabilities: https://docs.duet3d.com/Duet3D_hardware/Duet_3_family/Duet_3_Mainboard_6HC_Hardware_Overview#pin-names
Ian
-
Thanks, @droftarts.
There is no PSU. I need to provide a voltage (3-14v) to operate and hold the relay (it's non-latching) and then 0v to release it.
-
@nightowl999 You're running the board on USB power?
Ian
-
Sorry, @droftarts, I'm being a bit slow...
No, the Duet3 is running from a 24V PSU.
-
@nightowl999 Then don't use the heater outputs, as 24V will be too much for the relay. You can use a fan output, with the fan voltage set to 12V. I would imagine the current draw of a relay is less than 2A.
Ian
-
Thanks, @droftarts. Does that mean I could use Out 7, 8 or 9 and change your code accordingly, or are they 24V because I'm using a 24V PSU?
-
@nightowl999 You can use out4, 5, 6, 7, 8 or 9. Above each bank (out4-6 and out7-9) there is a 3-pin header. This selects the voltage for each bank, and can be set to V_FUSED (fused VIN, ie 24V) or 12V (using the onboard 12V reglator).
See the wiring diagram for setting: https://docs.duet3d.com/Duet3D_hardware/Duet_3_family/Duet_3_Mainboard_6HC_Hardware_Overview#wiring-diagram
Ian
-
Brilliant, thank you @droftarts!
-
@droftarts said in Simple relay control... or not?:
@nightowl999 Then don't use the heater outputs, as 24V will be too much for the relay. You can use a fan output, with the fan voltage set to 12V. I would imagine the current draw of a relay is less than 2A.
Ian
RELAY 20 MHA MAX 80MHA
-
@droftarts said in Simple relay control... or not?:
@nightowl999 Then don't use the heater outputs, as 24V will be too much for the relay. You can use a fan output, with the fan voltage set to 12V. I would imagine the current draw of a relay is less than 2A.
Ian
Isn't the maximum amps 800mA at 12V? or am I reading it wrong?
-
@jumpedwithbothfeet Yes, you're right. It's 2A with V_Fused, 800mA total current with 12V. Looks like the relay is well below this, though.
Ian
-
@droftarts I was half hoping it was 2 amps it would of simplified my wiring a fair bit!
-
This post is deleted! -
@droftarts said in Simple relay control... or not?:
Just as a quick follow-up, this should work, then:
M950 R0 C"out4+out7"
...with the relay wires connected to the pins of Out 7 and the Out 7-9 jumper between V_OUTLC2 and 12V?
Thank you
-
@nightowl999 yep
-