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

    Connecting relay to Core2

    General
    2
    4
    5.6k
    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.
    • L
      Leo05
      last edited by

      Hi,

      I have an issue connecting relay to my Core2.

      Here is my schematic:

      0_1633079302949_Capture d’écran_2021-10-01_11-08-03.png

      Nothing happen when changing PIN21 state...

      Is G21 the good PIN to use?

      I tried G15 and G12 too, without succes using this command:

      pinMode(12, OUTPUT);
      digitalWrite(12, HIGH);

      What am I doing wrong?
      Which pins are available for my need, and what are the numbers to use in digitalWrite?

      Thanks for your help

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

        Hello @Leo05

        all three GPIOs you've tried are no good as they are already used internally.
        GPIO12: BCLK (speaker)
        GPIO15: D/C (LCD)
        GPIO21: SDA (I2C)

        Check out the schematics.

        I'd try GPIO19 or GPIO27.

        This overview I've put together a while ago might be helpful too.

        Thanks
        Felix

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

        1 Reply Last reply Reply Quote 0
        • L
          Leo05
          last edited by

          Thank you very mcuh for the fast answer Felix!

          You are right, got one relay working with GIPO19 and digitalWrite(19, HIGH)

          But no succes with GPIO27, voltage does not change to 3.3V with digitalWrite(27, HIGH)... strange

          There is only 2 free GPIO to use? because I have 2 relays to connect but also one line with DS18B20 sensors and another with a water flowmeter.

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

            Hello @Leo05

            hmm, not sure why GPIO27 didn't work - it's marked as GPIO on the M5 Bus - should be free to use. I assume you've set it to output first?

            If you're not stacking a module which requires a serial connection GPIO13 and GPIO14 should be usable too.

            If you are not using I2C on the Groove port then GPIO32 and GPIO33 should be free too.

            Also GPIO35 and GPIO36 are free, afaik, but those two can only be inputs.

            Thanks
            Felix

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

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