User avatar
phluxm
Posts: 7
Joined: Fri Aug 18, 2017 10:21 am

Can I use an outdoor mains PIR with a Pi?

Fri Nov 01, 2019 4:38 pm

Hello!

I'm a coder with only a little electronics knowledge and I've got a project that requires an outdoor weatherproof PIR sensor but that needs to interface with the Pis GPIO.

I have 2 PIRs:
https://www.amazon.co.uk/Infrared-Detec ... p_p_img_12
https://www.amazon.co.uk/gp/product/B00 ... le_o02_s00

and a couple of questions for using them...
  • Both PIRs have 3 wires but one is blue, brown, black the other blue, brown, red. I am correct to think I supply 5v on the brown wire, attach blue to GND and then the red/black one goes to the Pi's input pin?
  • Will these PIRs (presumably designed for 220v mains power) work on a 5v supply from the Pi? Will a lower voltage affect the PIRs range or sensitivity etc? I've got one of the PIRs giving me fluctuations in voltage but I need to almost have my hand over it to get big jumps in the readings
  • Do use these voltage fluctuations on the red/black wire to trigger the pi? If so how do I read this with the Pi? I'm using Python's Python (RPi.GPIO) API and used the code GPIO.setup(17, GPIO.IN) but the voltage change is pretty small and the Pi seems to only read the input voltage as a 1 or a 0. Am I doing something wrong? Is it right that Pis pins do not take analog readings? (I could set a value as a response threshold if they did)
Thanks for your help!
Ben
Ben Neal - Creative Technologist - Psicon Lab "Digital Dreams Grounded" - info@psiconlab.co.uk

User avatar
rpdom
Posts: 15353
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Can I use an outdoor mains PIR with a Pi?

Fri Nov 01, 2019 5:24 pm

I doubt either of those PIRs will work with a Pi without some serious modification. They are, as you say, designed for mains use, not 5V or 3.3V. They will probably have a PSU inside to drop the voltage down to 5V and a relay circuit to switch the output. Neither of those would be needed for the PI.

But, you could possibly use them to drive a mains relay or something to safely switch the GPIO inputs on the Pi.

blimpyway
Posts: 183
Joined: Mon Mar 19, 2018 1:18 pm

Re: Can I use an outdoor mains PIR with a Pi?

Fri Nov 01, 2019 6:30 pm

Search for Arduino mini PIR sensor modules. These should work from 2.7 to 12.0 volts, so they-re ok with Pi's 3.3V gpio

User avatar
rpdom
Posts: 15353
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Can I use an outdoor mains PIR with a Pi?

Fri Nov 01, 2019 8:04 pm

blimpyway wrote:
Fri Nov 01, 2019 6:30 pm
Search for Arduino mini PIR sensor modules. These should work from 2.7 to 12.0 volts, so they-re ok with Pi's 3.3V gpio
Are they rated for outdoor weatherproof use as required?

blimpyway
Posts: 183
Joined: Mon Mar 19, 2018 1:18 pm

Re: Can I use an outdoor mains PIR with a Pi?

Fri Nov 01, 2019 8:26 pm

most likely not these modules are just the sensor with its circuit.
The rating is given by the case and gaskets/glue/silicone used to close it air/dust/water tight.

If you need an official weatherproof rating is one problem, if you need just to weatherproof the sensor is a different one.


PS if one follows a "LED from mains circuit" they can replace LED with an optocoupler to detect mains 220V AC presence with a GPIO pin.

https://www.google.com/search?q=led+fro ... 81&bih=477

User avatar
phluxm
Posts: 7
Joined: Fri Aug 18, 2017 10:21 am

Re: Can I use an outdoor mains PIR with a Pi?

Sat Nov 09, 2019 12:27 pm

Thanks everyone! I ended up just using a 5v PIR and enclosing it in a weatherproof junction box then sealing it in with silicone sealant in the end.
Ben Neal - Creative Technologist - Psicon Lab "Digital Dreams Grounded" - info@psiconlab.co.uk

Return to “Automation, sensing and robotics”