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

    Simple relay control... or not?

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    8
    43
    2.2k
    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.
    • Nightowlundefined
      Nightowl
      last edited by

      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=1

      The 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:

      1. Should I use a spare 5-pin io connector, a 2-pin fan connector or something else?

      2. Once the preferred connector has been configured, how would I go about activating/deactivating the relay with g-code (or a macro)?

      Thanks

      jay_s_ukundefined oliofundefined 2 Replies Last reply Reply Quote 0
      • jay_s_ukundefined
        jay_s_uk @Nightowl
        last edited by

        @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

        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

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

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • Nightowlundefined
            Nightowl @jay_s_uk
            last edited by

            '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

            droftartsundefined 1 Reply Last reply Reply Quote 0
            • droftartsundefined
              droftarts administrators @Nightowl
              last edited by droftarts

              @nightowl999 M950 R0 C"exp.heater1+exp.heater2" Q100 is for Duet 2. For Duet 3, use something like

              M950 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

              Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

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

                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.

                droftartsundefined 1 Reply Last reply Reply Quote 0
                • droftartsundefined
                  droftarts administrators @Nightowl
                  last edited by

                  @nightowl999 You're running the board on USB power?

                  Ian

                  Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

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

                    Sorry, @droftarts, I'm being a bit slow...

                    No, the Duet3 is running from a 24V PSU.

                    droftartsundefined 1 Reply Last reply Reply Quote 0
                    • droftartsundefined
                      droftarts administrators @Nightowl
                      last edited by

                      @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

                      Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                      Nightowlundefined paolozampini1973undefined jumpedwithbothfeetundefined 3 Replies Last reply Reply Quote 0
                      • Nightowlundefined
                        Nightowl @droftarts
                        last edited by

                        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?

                        droftartsundefined 1 Reply Last reply Reply Quote 0
                        • droftartsundefined
                          droftarts administrators @Nightowl
                          last edited by

                          @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

                          Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                          Nightowlundefined 3 Replies Last reply Reply Quote 0
                          • Nightowlundefined
                            Nightowl @droftarts
                            last edited by

                            Brilliant, thank you @droftarts!

                            1 Reply Last reply Reply Quote 0
                            • paolozampini1973undefined
                              paolozampini1973 @droftarts
                              last edited by

                              @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

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

                                @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?

                                b4603a30-bc79-4558-94a9-4cbcde137b4f-image.png

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

                                droftartsundefined 1 Reply Last reply Reply Quote 1
                                • droftartsundefined
                                  droftarts administrators @jumpedwithbothfeet
                                  last edited by

                                  @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

                                  Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

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

                                    @droftarts I was half hoping it was 2 amps it would of simplified my wiring a fair bit!

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

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

                                      This post is deleted!
                                      1 Reply Last reply Reply Quote 0
                                      • Nightowlundefined
                                        Nightowl @droftarts
                                        last edited by Nightowl

                                        @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 👍

                                        jay_s_ukundefined alankilianundefined 2 Replies Last reply Reply Quote 1
                                        • jay_s_ukundefined
                                          jay_s_uk @Nightowl
                                          last edited by

                                          @nightowl999 yep

                                          Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

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

                                            Spiffing, @jay_s_uk 😀 😀

                                            And then it will 'activate' with M3 and deactivate with M5.

                                            Thank you @jay_s_uk

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