Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    Simple relay control... or not?

    Duet Hardware and wiring
    8
    43
    391
    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.
    • Nightowl
      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_uk oliof 2 Replies Last reply Reply Quote 0
      • jay_s_uk
        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

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

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • Nightowl
            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

            droftarts 1 Reply Last reply Reply Quote 0
            • droftarts
              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

              Cartesian bed-slinger with Duet 3 Mini 5+ WiFi : RRP Fisher Delta v1 with Duet 2 Maestro : TronXY X5S with Duet 2 Wifi (in progress)

              Nightowl 1 Reply Last reply Reply Quote 0
              • Nightowl
                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.

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

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

                  Ian

                  Cartesian bed-slinger with Duet 3 Mini 5+ WiFi : RRP Fisher Delta v1 with Duet 2 Maestro : TronXY X5S with Duet 2 Wifi (in progress)

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

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

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

                    droftarts 1 Reply Last reply Reply Quote 0
                    • droftarts
                      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

                      Cartesian bed-slinger with Duet 3 Mini 5+ WiFi : RRP Fisher Delta v1 with Duet 2 Maestro : TronXY X5S with Duet 2 Wifi (in progress)

                      Nightowl paolozampini1973 jumpedwithbothfeet 3 Replies Last reply Reply Quote 0
                      • Nightowl
                        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?

                        droftarts 1 Reply Last reply Reply Quote 0
                        • droftarts
                          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

                          Cartesian bed-slinger with Duet 3 Mini 5+ WiFi : RRP Fisher Delta v1 with Duet 2 Maestro : TronXY X5S with Duet 2 Wifi (in progress)

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

                            Brilliant, thank you @droftarts!

                            1 Reply Last reply Reply Quote 0
                            • paolozampini1973
                              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
                              • jumpedwithbothfeet
                                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

                                Voron Trident based (4Z) - too much to list!

                                droftarts 1 Reply Last reply Reply Quote 1
                                • droftarts
                                  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

                                  Cartesian bed-slinger with Duet 3 Mini 5+ WiFi : RRP Fisher Delta v1 with Duet 2 Maestro : TronXY X5S with Duet 2 Wifi (in progress)

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

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

                                    Voron Trident based (4Z) - too much to list!

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

                                      This post is deleted!
                                      1 Reply Last reply Reply Quote 0
                                      • Nightowl
                                        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_uk alankilian 2 Replies Last reply Reply Quote 1
                                        • jay_s_uk
                                          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

                                          Nightowl 1 Reply Last reply Reply Quote 0
                                          • Nightowl
                                            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
                                            • alankilian
                                              alankilian @Nightowl last edited by

                                              @nightowl999

                                              I just read the Amazon description for your relay-control module and it says it can be triggered by an Arduino using any voltage from 3 to 14 Volts, so you don't need to worry about drawing too much power from the onboard 12 Volt supply at all.

                                              Where did you read that it takes 2 Amps to drive the module? I'd like to verify that.

                                              SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

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

                                                Erm, I didn't @alankilian. That was @jumpedwithbothfeet wishing it was 2A!

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

                                                  @nightowl999 said in Simple relay control... or not?:

                                                  Erm, I didn't @alankilian. That was @jumpedwithbothfeet wishing it was 2A!

                                                  OK, I got it.

                                                  It looks like you're in good shape!

                                                  🙂

                                                  SeemeCNC Rostock Max V3 converted to V3.2 with a Duet2 Ethernet Firmware 3.2 and SE300

                                                  Nightowl 2 Replies Last reply Reply Quote 1
                                                  • Nightowl
                                                    Nightowl @alankilian last edited by

                                                    @alankilian
                                                    Yep. Just keep an eye out for a big cloud of smoke in SW England. If there is one, it didn't work 😱 😱

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

                                                      @nightowl999 have you considered using the Laser/VFD output to drive the relay module? It provides a 5V signal.

                                                      Duet WiFi hardware designer and firmware engineer
                                                      Please do not ask me for Duet support via PM or email, use the forum
                                                      http://www.escher3d.com, https://miscsolutions.wordpress.com

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