[Solved] 5 RELAY Units on M5Stack device



  • 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



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



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