Connecting relay to Core2

  • 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

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


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

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