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

    [Solved] 5 RELAY Units on M5Stack device

    General
    2
    3
    5.1k
    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.
    • M5StickFreaklerM
      M5StickFreakler
      last edited by M5StickFreakler

      Hi folks

      I have played around a bit with some relay units, but I cant find a way to connect 5 units to my M5Stack unit.

      I have tried:

      • to connect them all to same port via splitters
      • to connect them all via Pa.HUB-Unit
      • to connect them all via Pb.HUB-Unit

      It does not work.

      Does anyone have an idea or has everyone done it?

      Thanks very much
      Thomas

      1 Reply Last reply Reply Quote 0
      • C
        crami25
        last edited by

        @M5StickFreakler

        You have to use the Pb-Hub unit, black connector of the relay units to the black connectors of the Pb-Hub (for analog and/or digital input/outputs, e.g. realys) . The Pa-Hub is used connecting i2c units (red connectors) with the same i2c address (e.g. to environment units).

        You can programm the 6 channels (analog or digital, equivalent to multiple Core-B channels) of the Pb-hub using blockly.

        good luck crami25

        M5StickFreaklerM 1 Reply Last reply Reply Quote 1
        • M5StickFreaklerM
          M5StickFreakler @crami25
          last edited by M5StickFreakler

          @crami25

          Thank you crami25

          I thought that I have to use the RELAY-Unit-Component and the PbHub.Unit-Component simultaneously in UIFlow.
          But as you told me, I just have to set the Outputs on the PbHub to 0 oder 1 :-)
          No need of the RELAY-Unit-Component in software.

          from m5stack import *
          from m5ui import *
          from uiflow import *
          import unit
          
          setScreenColor(0x222222)
          pbhub0 = unit.get(unit.PBHUB, unit.PORTA)
          
          while True:
            pbhub0.digitalWrite(0, 0, 1)
            wait_ms(100)
            pbhub0.digitalWrite(1, 0, 1)
            wait_ms(100)
            pbhub0.digitalWrite(2, 0, 1)
            wait_ms(100)
            pbhub0.digitalWrite(3, 0, 1)
            wait_ms(100)
            pbhub0.digitalWrite(4, 0, 1)
            wait(1)
            pbhub0.digitalWrite(0, 0, 0)
            wait_ms(100)
            pbhub0.digitalWrite(1, 0, 0)
            wait_ms(100)
            pbhub0.digitalWrite(2, 0, 0)
            wait_ms(100)
            pbhub0.digitalWrite(3, 0, 0)
            wait_ms(100)
            pbhub0.digitalWrite(4, 0, 0)
            wait(1)
          

          Great it works!

          Best regards Thomas

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