I am building a small home automation system, and one node has a PIR to detect motion, and a Relay Module to control a 240v light with a Raspberry PI 3.

The PIR is connected to 5v, and has a resistor bridge on the data line to connect it to GPIO 12.

enter image description here

When I connect the Relay Module to the 3.3v, and to GPIO 13, I can control the relay, but after a few days, the PIR starts to falsely trigger every 2 minutes.

I get the feeling that the Relay has been wired up incorrectly, but not sure of the solution. I suspect I will have to connect it to the 5v power pin, but then I will need a transistor bridge (not sure of the resistances needed) on the GPIO out to toggle it (at the present 3.3 output, it doesn't trigger the relay when powered on 5v). I was under the impression that as it was a module, it would have most of the necessary components built in, but possibly not.

I can see a diode on there and some other components, but I'm not sure if it takes care of switching on a different voltage (3.3v on a 5v circuit), but as it appears to work on a 3.3v circuit, it be sufficient. But given the fact that the PIR is having issues suggests that it is not getting enough power.

Can anyone recommend how to wire it up properly?

  • PIR sensors usually have a 5V supply voltage but a 3.3V output signal. So there is no need to add Resistors to the data line. But a complete schematic would be helpful along with your code. – kwasmich Feb 28 at 12:31
  • @kwasmich ah, that's fair, it was something that was suggested as a fix for the 2 minute fix. It appeared to intermittently work, but apparently not and may not be necessary. To be honest, there's not much of a schematic, its 6 connections to standard rpi pins, except for the 2 data lines, which at this stage, are wired directly – topherg Feb 28 at 12:34

Your Answer


Browse other questions tagged or ask your own question.