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

    Duet 3 Mini5+ How to control a 5V optocoupler relay

    Scheduled Pinned Locked Moved Solved
    Duet Hardware and wiring
    2
    4
    227
    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.
    • jgrg1undefined
      jgrg1
      last edited by jgrg1

      Hi,

      I'm trying to configure one of the Duet 3 Mini5+ GPIO outputs to control a 5V SSR (it has 'YS-1 Realy' printed on the PCB).

      alt text

      I had this working on a Raspberry Pi 3B+ via Octoprint, and was using it control the mains power to an LED power brick for the lighting strip for my 3D printer enclosure.

      In my config.g, I've configured io3.out using M950 with:

      M950 P0 C"io3.out"                                    ; create LED control signal on io3.out
      

      I've wired up the 5V_EXT, GND and io3.out connections of the io_3 jumper to the Vin, GND and CHin inputs of the relay board respectively, and checked the connections with a multimeter. I have 5V between 5V_EXT and GND as I'd expect.

      I tried to control the output signal with M42:

      M42 P0 S1.0
      

      and subsequently,

      M42 P0 S0.0
      

      Neither of which seem to do anything. Using a multimeter, I seem to see 1V on the io3.out pin relative to GND. I've also tried using M42 P0 S255 as well.

      I've also tried using io1 and io4 (and changing the configuration respectively), and also tried enabling the pull-up resistor using M950 P0 C"^io3.out", and inverting the output using M950 P0 C"!io3.out", and also using a different P pin number.

      On https://docs.duet3d.com/en/User_manual/Connecting_hardware/IO_GPIO, it states:

      • Digital pins (on/off) that can be used to control switches and relays, or read inputs from external switches and triggers.

      but how do I use M950 to configure a "digital" output, when it has a default PWM frequency of 500Hz. Is there a specific frequency I should use, e.g. 0 or 65536?

      DIY-O-Sphereundefined 1 Reply Last reply Reply Quote 0
      • DIY-O-Sphereundefined
        DIY-O-Sphere @jgrg1
        last edited by

        @jgrg1
        The board switches the negativ side, so you should measure the io3.out against the positive side.

        (UTC+1)

        jgrg1undefined 1 Reply Last reply Reply Quote 0
        • jgrg1undefined
          jgrg1 @DIY-O-Sphere
          last edited by

          @DIY-O-Sphere

          Back to basics continuity check has revealed that my signal wire has a break in it somewhere. Will swap that out, and try again.

          jgrg1undefined 1 Reply Last reply Reply Quote 1
          • jgrg1undefined
            jgrg1 @jgrg1
            last edited by

            That sorted it - and it now works perfectly. Just had to invert the output.

            My crimping tool mashed one of the cables, but not the other two. Shonkly cable, I guess.

            1 Reply Last reply Reply Quote 1
            • dc42undefined dc42 marked this topic as a question
            • dc42undefined dc42 has marked this topic as solved
            • First post
              Last post
            Unless otherwise noted, all forum content is licensed under CC-BY-SA