🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    PbHub + 2-Relay Units - only 1 relay channel working?

    Units
    2
    3
    1.7k
    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.
    • E
      emsea22
      last edited by

      Hi - I have a PbHub with a 2-relay unit connected to (if it matters) CH5. The 2-relay unit works fine when connected directly to the Core 2 device/Port C, but when connected to the PbHub, only 1 or the two relays will switch.

      I'm using micropython and:

      pbhub_0.digitalWrite(5, 0, 0)
      pbhub_0.digitalWrite(5, 0, 1)

      -- works (off/on)

      pbhub_0.digitalWrite(5, 1, 0)
      pbhub_0.digitalWrite(5, 1, 1)

      -- doesn't do anything

      the 2-relay unit (confusingly) has labeled channels of 1 and 2 on the device, A and B on the schematic - and takes 1 and 2 as relay identifiers if you're controlling it directly (via Port A) the UI flow code/micropython is:

      relay2_0.set_value(1, 0)
      relay2_0.set_value(1,1)
      relay2_0.set_value(2,0)
      relay2_0.set_value(2,1)

      I'm considering addressing the PbHub directly or trying arduino code, but just wondering if there's some obvious reason I'm missing.

      -Thanks!

      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by felmue

        Hello @emsea22

        which version PbHub are you using? v1.0 U041 or v1.1 U041-B?

        I think only version v1.1 can both pins have set to outputs on all channels. The original PbHub has its IN pins for CH4 and CH5 connected to ADC inputs of the Mega328 which I guess means they can only be inputs.

        Have you tried a different channel, e.g. CH0?

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        E 1 Reply Last reply Reply Quote 0
        • E
          emsea22 @felmue
          last edited by

          @felmue SOLVED - thanks for that - CH2 works as expected!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post