tomxi
Posts: 10
Joined: Mon Jun 01, 2015 12:58 pm

weird problem: PIR sensor positive on wifi activity

Mon Jun 01, 2015 1:07 pm

Hi, I have a raspi B and have connected a cheap ebay PIR sensor like the one in this article http://www.raspberrypi-spy.co.uk/2013/0 ... pi-part-1/ and also the raspi camera board.

I use the code in the linked article to detect motion and take a photo, very similar to the code here
viewtopic.php?p=757955#p757955

One problem: the PIR is also triggered when I access the pi over wifi (I have plugged in a small usb wifi module) and do something, like navigate to the folder of camera images. This happens every time. I have tried changing the two hardware knobs on the PIR (sensitivity and time) but the problem is still there. If I increase the time knob much the PIR stops detecting anything. If I decrease it again I'm back with the described problem. Changing the sensitivity knob makes no difference.

I have connected the PIR directly to the raspi (5V, ground, and and GPIO 8). Do I need to put something inbetween? A resistor? If so what value?

BMS Doug
Posts: 3823
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: weird problem: PIR sensor positive on wifi activity

Mon Jun 01, 2015 5:32 pm

As I see it there are two possible causes of the issue you are seeing: power blips caused by the wifi dongle drawing down the 5v supply or RF interference from the WIFI affecting the PIR.

To fix the power issue you could try adding a capacitor to the 5v supply to the PIR.

To solve RF interference try a sheet of tinfoil.
Doug.
Building Management Systems Engineer.

tomxi
Posts: 10
Joined: Mon Jun 01, 2015 12:58 pm

Re: weird problem: PIR sensor positive on wifi activity

Mon Jun 01, 2015 6:24 pm

Any rough idea on what capacitator to try that with (don't know the first thing about capacitators I'm afraid)?

You mean tinfoil over the PIR? Like a small... tinfoil hat. I'll give that a try.

BMS Doug
Posts: 3823
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: weird problem: PIR sensor positive on wifi activity

Mon Jun 01, 2015 6:58 pm

Yes, a mini tinfoil hat should be an easy proof either way.

I'm not a 100% sure with capacitor values. I'm sure someone else will have a suggestion.
Doug.
Building Management Systems Engineer.

tomxi
Posts: 10
Joined: Mon Jun 01, 2015 12:58 pm

Re: weird problem: PIR sensor positive on wifi activity

Mon Jun 01, 2015 9:46 pm

I tried shielding the PIR with tinfoil but it made no difference. Will try a capacitator, but would need pointers from someone on what to try.

User avatar
jbeale
Posts: 3263
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: weird problem: PIR sensor positive on wifi activity

Mon Jun 01, 2015 10:32 pm

If it's RF getting into the PIR, you can try to separate the two devices more. For example, use a USB extender cable to put the wifi dongle some distance away.
If it's DC power spikes, some capacitor on the +5V line like 10 uF to 100 uF ought to help. Or even better, just for testing, use a completely separate +5V supply to the PIR sensor.

tomxi
Posts: 10
Joined: Mon Jun 01, 2015 12:58 pm

Re: weird problem: PIR sensor positive on wifi activity

Tue Jun 02, 2015 4:11 pm

jbeale wrote:If it's RF getting into the PIR, you can try to separate the two devices more. For example, use a USB extender cable to put the wifi dongle some distance away.
That did the trick it appears! I put an old passive usb hub with a 10 cm long wire between the raspi and the usb wifi adapter and that was enough. I will test drive this more to see if it really solved the issue.

User avatar
jbeale
Posts: 3263
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: weird problem: PIR sensor positive on wifi activity

Tue Jun 02, 2015 4:45 pm

Glad to hear you've got an apparent solution. Note, the passive hub probably has its own capacitors on the +5V power line, so it might be helping with either a DC glitch (added capacitance) or a RF interference problem (added distance). Or both at once.

tomxi
Posts: 10
Joined: Mon Jun 01, 2015 12:58 pm

Re: weird problem: PIR sensor positive on wifi activity

Thu Jun 04, 2015 8:20 pm

I should have written that I also tried using a 1 meter usb extension cable. When I plug the wifi adapter into the extension cable and move the adapter close to the PIR I get the described problem. When I move it away ( ~ 20 cm is enough) the problem goes away. So the cause was likely RF interference.

scai
Posts: 1
Joined: Sun Feb 26, 2017 9:26 am

Re: weird problem: PIR sensor positive on wifi activity

Sun Feb 26, 2017 9:35 am

I have exactly the same problem with a Raspberry PI Model B, an edimax EW-7811UN wifi dongle and an HC-SR501 PIR sensor.

Putting some tinfoil between the Pi and the PIR seems to resolve the issues for me. However I will look for a USB extension cable to be on the safe side.

Thanks for the solution!

User avatar
omegaman477
Posts: 11
Joined: Tue Feb 28, 2017 1:13 pm
Location: Sydney, Australia

Re: weird problem: PIR sensor positive on wifi activity

Tue Feb 28, 2017 2:37 pm

Most likely the PIR is tripping due to RF interference. A common problem with the cheap ones. Decouple its PSU.
..the only thing worse than a stupid question is a question not asked.

jkw
Posts: 12
Joined: Thu Oct 02, 2014 5:20 pm

Re: weird problem: PIR sensor positive on wifi activity

Tue Mar 28, 2017 1:53 pm

I had the same problem with a esp8266 and a pir and can confirm that its the wifi signal. I've tried DC decoupling, buffering and scoped the signals and the only thing that helped was physical distance between the wifi module and the pir ..

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 17 guests