I'm really new to Raspberry Pi, so please forgive me if this is a noobish question.

I have a very simple setup: Raspberry Pi 3 running Home Assistant with a switch connected to GPIO12 and 3.3v. The pin is configured to be pulled up.

Inside HA I have this config:

  - platform: rpi_gpio
    pull_mode: DOWN
      12: Motion

but this doesn't matter. When I press the button (or connect GPIO12 to 3.3V directly) HA and PI are detecting that I turn on the switch.

Now I've replaced the switch with a 12V OMRON mechanical Relay.
Relay is turn on or off by external power source and it works fine (I can hear it clicks)

I've connected 3.3V and GPIO12 to relay with help of an electrician.
The problem is that even I hear relay works the Pi isn't detecting anything.

If I connect wires directly (without the relay) it works, when using the relay it doesn't.
The best part is that the electrician took a screwdriver and shorted the relay legs (the ones that have connected 3.3V and GPIO 12) and Pi detected the switch is turned on.

It looks like the relay is "not sending" the full 3.3V and because of that Pi isn't detecting anything.

The relay is only used to connect 3.3V to GPIO12, it isn't controlled or powered by Raspberry Pi.

I've searched a bit over the internet about relay coil resistance, but this got me even more confused.

My question is: how can I make input relay work with Raspberry Pi 3. Any materials and hints are more than welcome.

Here is the Schematics of what works:


simulate this circuit – Schematic created using CircuitLab

and this is what doesn't


simulate this circuit

Sorry for a very basic schema, but I hope that now You get my point. I want to replace the momentary switch from picture one with a 12V relay. I've connected 3.3V from Pi to NO port of relay and GPIO12 to COM. I want the relay to control Pi I hope this is now clear.

  • Let me see. (1) Relay input side connection: Relay Vcc to Rpi 40 pin header 3V3, (2) Relay input terminal to Rpi GPIO 12 output mode. So Relay to Rpi connection has only two wires, one 3V3 power, another GPIO 12. So Rpi only drives relay, and NO input signal from Relay to Rpi. So Relay input side, deals with relay power and relay input signal. Now to the Relay output side: there are three terminals labelled (a) COM (Common), (b) NO (Normally "Open" / not connected to COM), (c) NC (Normally "Closed" / connected to Common). Now tell us what do you connect to these 3 output terminals.
    – tlfong01
    Oct 14, 2019 at 12:16
  • Hi @Mitsu, Now referring to the following picture, please confirm if connections 1, 2 are OK with you. And tell us what do you connect at points 3,4, and 5. imgur.com/gallery/1gao4CJ. PS - Never mind the weird little icons, just look at the "big" picture with 5 terminals.
    – tlfong01
    Oct 14, 2019 at 12:32
  • @tlfong01 I've added very basic schematics. The idea is that the relay controls the Raspberry. I have a momentary switch that connects 3.3V to GPIO12, but I must press that button manually. I want to replace that button with relay, so every time the relay turn on I get connection between 3.3V and GPIO12. I hope this is more clear now :)
    – Misiu
    Oct 14, 2019 at 12:50
  • How nice you are using this forum's online schematic drawing tool. I can easily extract your drawings into my workbook, and started editing. I can tell from your drawing that you are a newbie in electronics, but I am very surprised to notice that you are a fast learner, more about this later. Now I have edited your drawings, saved in my workbook, and started to answer.
    – tlfong01
    Oct 14, 2019 at 14:47
  • You may like to look at my version of your drawings and make comments. I must first tell you that I have reoriented your drawings so that Vcc is at top, and input on left, output on right side, etc, which is the convention of the EE guys. Now I need to google how HA is doing things. If there are HA guys here, then they can help you right away. Otherwise you need to tell you what exactly you want, I can write a python program and you change it to HA. But it is bed time for me. So see you tomorrow.
    – tlfong01
    Oct 14, 2019 at 14:58


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.