I am currently working on a project which uses PIR motion sensor and 5V relay. Since you might be familiar that both the motion sensor and the relay requires a 5V connection.

My problem is, I don't want messy connections (parallel and series) and want to use any other pin for power and ground.

Also, can you suggest which resistor I might require for the motion sensor and relay?

Thanks for any help.

1 Answer 1


You might get away with powering a PIR sensor from a logic line. Check the specs. If it draws less ≤20mA you'd be fine. If you nee to drive more current than that you can use a CMOS TTL Driver or a properly selected N-channel MOSFET. Adafruit sells these, for example.

A relay is another matter. If you this is one of those optically isolated relays and all you're driving is the optioisolator then you might get away with that too if you only need ≤20mA. If you're looking to actually power the relay coils with your Arduino, forget it. it's a bad idea to even have the relay driven from the 5V line on the Arduino. Relays take quite a bit of current, and their load is quite "dirty" and likely to cause problems.

As to "which resistor I might require for the motion sensor & relay", I'm not sure what you mean. You shouldn't need any resistors. If the relay draws more current than the Arduino can supply, a current limiting resistor might protect the Arduino from damage but the relay won't work correctly.

What resistors are you referring to?

  • In the last para I am talking about the resistance value 1omhs or 100 ohms etc Commented Feb 15, 2019 at 5:11
  • I know what resistors are. I don't think you need any in this application, but you need to determine how much current your devices draw.
    – Duncan C
    Commented Feb 15, 2019 at 11:16
  • "(On most Arduino models the absolute max current for each pin is 40mA but the recommendation is to stay at half that, or ≤20mA." Actually, the datasheet says Vout with Vcc = 5V is guaranteed to be >= 4.2V for up to 20mA, and may drop above that "If IOH exceeds the test condition [20mA at VCC = 5V], VOH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition."
    – CrossRoads
    Commented Feb 15, 2019 at 14:16
  • @CrossRoads that will teach me to trust things posted by other people on these boards as truth without validating for myself. Thanks for correcting me. I've deleted that part of my answer.
    – Duncan C
    Commented Feb 15, 2019 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.