HC-SR501 PIR - stop false positives?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
the cosmic gate
Normal user
Posts: 102
Joined: 14 Nov 2015, 20:17

Re: HC-SR501 PIR - stop false positives?

#21 Post by the cosmic gate » 07 Jun 2016, 12:39

I've got also issues : http://www.esp8266.nu/forum/viewtopic.php?f=5&t=1628 , are these the same as discribed in this topic ?

edautz
Normal user
Posts: 13
Joined: 10 Apr 2016, 07:16

Re: HC-SR501 PIR - stop false positives?

#22 Post by edautz » 30 Jul 2016, 08:28

Sorry for the late respons, but it seems the same problem.

I am running stable for a few months now, using pir as an alarm sensor.

I upgraded my powersupply to 1 amp type. I also notices when the pir is exposed to the sun, sudden changes in sunlight triggers the pir. I am not able to solve that, you can only solve this in software.

the cosmic gate
Normal user
Posts: 102
Joined: 14 Nov 2015, 20:17

Re: HC-SR501 PIR - stop false positives?

#23 Post by the cosmic gate » 03 Aug 2016, 12:23

edautz wrote:Sorry for the late respons, but it seems the same problem.

I am running stable for a few months now, using pir as an alarm sensor.

I upgraded my powersupply to 1 amp type. I also notices when the pir is exposed to the sun, sudden changes in sunlight triggers the pir. I am not able to solve that, you can only solve this in software.
The pir I used is build in a lamp using the sonoff piece of hardware (and power) so sunlight wouldn't be a problem :)

chunter1
Normal user
Posts: 82
Joined: 22 Jan 2016, 22:40

Re: HC-SR501 PIR - stop false positives?

#24 Post by chunter1 » 06 Mar 2017, 09:31

Although this is an old thread - i guess some people might still be interested how to definately solfe the RF-induced false triggering problem.

You simple need to solder a 220nF ceramic capacitor across pin12 und pin13 of the chip (BISS0001) so that the high-frequency interference coming from the ESP8266 don't influece the gain stage anymore.

That's it!
Have fun! ;)

DeNB3rt
Normal user
Posts: 119
Joined: 15 Dec 2015, 14:07

Re: HC-SR501 PIR - stop false positives?

#25 Post by DeNB3rt » 06 Mar 2017, 15:47

chunter1 wrote:
06 Mar 2017, 09:31
Although this is an old thread - i guess some people might still be interested how to definately solfe the RF-induced false triggering problem.

You simple need to solder a 220nF ceramic capacitor across pin12 und pin13 of the chip (BISS0001) so that the high-frequency interference coming from the ESP8266 don't influece the gain stage anymore.
How long do you have this running without issues? Thanks for the tip!
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

bobbybeans
Normal user
Posts: 119
Joined: 26 Feb 2017, 17:30

Re: HC-SR501 PIR - stop false positives?

#26 Post by bobbybeans » 15 Mar 2017, 15:18

DeNB3rt wrote:
06 Mar 2017, 15:47
chunter1 wrote:
06 Mar 2017, 09:31
Although this is an old thread - i guess some people might still be interested how to definately solfe the RF-induced false triggering problem.

You simple need to solder a 220nF ceramic capacitor across pin12 und pin13 of the chip (BISS0001) so that the high-frequency interference coming from the ESP8266 don't influece the gain stage anymore.
How long do you have this running without issues? Thanks for the tip!

this is great shall be ordering some now :)

Shardan
Normal user
Posts: 1119
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: HC-SR501 PIR - stop false positives?

#27 Post by Shardan » 15 Mar 2017, 15:46

chunter1 wrote:
06 Mar 2017, 09:31
Although this is an old thread - i guess some people might still be interested how to definately solfe the RF-induced false triggering problem.

You simple need to solder a 220nF ceramic capacitor across pin12 und pin13 of the chip (BISS0001) so that the high-frequency interference coming from the ESP8266 don't influece the gain stage anymore.

That's it!
Have fun! ;)
Great, thanks.

Just an idea - there should be a "Solutions" category in the wiki or the forum and such solutions should be collected there.
Maybe within a more or les fixed scheme of "Issue" (Symptoms shown), "Analyse" (What causes the issue) and "Solution".
I'd be happy to help with that.
Regards
Shardan

chunter1
Normal user
Posts: 82
Joined: 22 Jan 2016, 22:40

Re: HC-SR501 PIR - stop false positives?

#28 Post by chunter1 » 02 May 2017, 12:40

Unfortunately, when sunlight is shining on the sensor, it still triggers permanently.

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: HC-SR501 PIR - stop false positives?

#29 Post by toffel969 » 03 May 2017, 00:47

chunter1 wrote:
02 May 2017, 12:40
Unfortunately, when sunlight is shining on the sensor, it still triggers permanently.
In think this is immanent to PIR type devices (passive infrared) . if the ir intensity changes it will trigger.
Leaves it too indoor use case or if you only want to use it when its dark...
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

chunter1
Normal user
Posts: 82
Joined: 22 Jan 2016, 22:40

Re: HC-SR501 PIR - stop false positives?

#30 Post by chunter1 » 06 May 2017, 00:13

toffel969 wrote:
03 May 2017, 00:47
chunter1 wrote:
02 May 2017, 12:40
Unfortunately, when sunlight is shining on the sensor, it still triggers permanently.
In think this is immanent to PIR type devices (passive infrared) . if the ir intensity changes it will trigger.
Leaves it too indoor use case or if you only want to use it when its dark...
To me it seems more like bad design and some kind of saturation effect since other PIR sensors don't false trigger under sunlight.

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: HC-SR501 PIR - stop false positives?

#31 Post by toffel969 » 06 May 2017, 12:42

chunter1 wrote:
06 May 2017, 00:13
toffel969 wrote:
03 May 2017, 00:47
chunter1 wrote:
02 May 2017, 12:40
Unfortunately, when sunlight is shining on the sensor, it still triggers permanently.
In think this is immanent to PIR type devices (passive infrared) . if the ir intensity changes it will trigger.
Leaves it too indoor use case or if you only want to use it when its dark...
To me it seems more like bad design and some kind of saturation effect since other PIR sensors don't false trigger under sunlight.
To me it seems like good design can avoid the triggering through light. However the PIR sensor itself just triggers on differences in the infrared lighting level. The sun undoubtedly is an IR-Source (so was the barbecue fire on my terasse that kept on triggering my PIR). Be it as it may, I don't see how this can be avoided other than buying different PIR that have measures to mitigate the effect we can change this. It is definitly not the same problem that causes the random triggering
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

Shardan
Normal user
Posts: 1119
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: HC-SR501 PIR - stop false positives?

#32 Post by Shardan » 06 May 2017, 15:28

Hello all,

some weeks agon i've designed a clean PCB layout for the HC-SR501 and some more sensors,
(HC-SR04 ultrasonic distance, door contact and humidity + temperature)
I want to use it as a server room surveillance device.
The prototype PCB's arrived some days ago and one device was assembled some days ago.
.
USIR-Sensor Frontside.jpg
USIR-Sensor Frontside.jpg (84.1 KiB) Viewed 17384 times
.
USIR-Sensor-Backside.jpg
USIR-Sensor-Backside.jpg (46.26 KiB) Viewed 17384 times
.
And a miracle happened......

There is no pull up resistor or capacitor added to the circuits.
It's test running for a week now and did not give false positives up to now.

For my curiosity i tested two other PIR's. A mini sensor and a
bigger one for 230VAC mains. The small one works similliar to the HC-SR501,
but it can't be adjusted on runtime and sensivity, but works.
The bigger one works too but is made for placing in the ceiling, not suitable for ESP-circuits.
.
DSCF0139cut.JPG
DSCF0139cut.JPG (101.87 KiB) Viewed 17384 times
.
As far as a can say atm all three show false positives with direct sunlight.
I agree with toffel that the sun is a massive IR source. The outside sensors i know
are made for lighting. They have an additional daylight sensor and switch off over the day.
Even the cheap 230V sensor i tested is able to deactivate over daylight time.
We use PIR's for the alarm system in our company. They are not allowed to be placed
in direct sunlight due to possible false positives.
There might be PIRs that are compensated against sunlight. Hoenstly i've never
seen one or could test one. I doubt if you can get it for a dollar at your dealer anyways :)

Regards
Shardan
Regards
Shardan

chunter1
Normal user
Posts: 82
Joined: 22 Jan 2016, 22:40

Re: HC-SR501 PIR - stop false positives?

#33 Post by chunter1 » 24 May 2017, 15:38

@Shardan
You should have spent your antenna keep-out region a bit more size - except ruining the RF performance was intended :D
At least it might help avoiding false triggering by RF.

Shardan
Normal user
Posts: 1119
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: HC-SR501 PIR - stop false positives?

#34 Post by Shardan » 24 May 2017, 16:49

Intrestingly i just used a ready made footprint for the ESP-12/E/F from my layout program...
and this is one of the strongest signals i get even on distance through walls.

Don't ask me why - high frequencies have their very own rules.
Regards
Shardan

JohnJoe
Normal user
Posts: 1
Joined: 23 Jul 2017, 14:56

Re: HC-SR501 PIR - stop false positives?

#35 Post by JohnJoe » 23 Jul 2017, 14:58

The solution I found to this problem is use a 10k resistor between the PIR sensor output and the input pin of the ESP8266.

I tried all of the suggestions above (caps, switching off the wifi etc) but only the resistor worked.

Another benefit is that Wifi can now be connected at the start (and disconnected at the end) of the program rather than for each message, as this can be slow.

Not sure if 10K is the best value, someone else may find a better value, but for now, for me its working great.

John

DeNB3rt
Normal user
Posts: 119
Joined: 15 Dec 2015, 14:07

Re: HC-SR501 PIR - stop false positives?

#36 Post by DeNB3rt » 26 Jul 2017, 09:07

JohnJoe wrote:
23 Jul 2017, 14:58
The solution I found to this problem is use a 10k resistor between the PIR sensor output and the input pin of the ESP8266.
Hi JohnJoe, 10k to ground?
I have positive experience with that.
Combined with keeping direct sunlight away from the sensor. :)
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

User avatar
rajbadri
Normal user
Posts: 56
Joined: 21 Dec 2015, 21:38
Location: India

Re: HC-SR501 PIR - stop false positives?

#37 Post by rajbadri » 30 Jul 2017, 06:23

chunter1 wrote:
06 Mar 2017, 09:31
Although this is an old thread - i guess some people might still be interested how to definately solfe the RF-induced false triggering problem.

You simple need to solder a 220nF ceramic capacitor across pin12 und pin13 of the chip (BISS0001) so that the high-frequency interference coming from the ESP8266 don't influece the gain stage anymore.

That's it!
Have fun! ;)
This Tip Solved my Problem. Thanks

riker1
Normal user
Posts: 303
Joined: 26 Dec 2017, 18:02

Re: HC-SR501 PIR - stop false positives?

#38 Post by riker1 » 24 Mar 2018, 10:15

Hi
could you paste a picture of the soldering solution? thanks

fmuntean
Normal user
Posts: 1
Joined: 24 Apr 2018, 02:04

Re: HC-SR501 PIR - stop false positives?

#39 Post by fmuntean » 24 Apr 2018, 02:49

I have been having the same issue with the false positives given by the HC-SR501 PIR sensor board.
I have searched and tried almost everything I could find about fixing this issue but nothing helped.

I know that my post is long but I like to describe the reasoning behind the changes and not just give people a short solution. if you look for that stop here and just try to solder a wire across the 18K resistor that is on top of the sensitivity potentiometer. Also make sure you let us know if it worked for you.


Then I start learning how it works and found this AN4368 Application note from ST (http://www.st.com/resource/en/applicati ... 096551.pdf) This helped me understand how any PIR circuit should work.
The two BISS0001 datasheets I found useful are: https://www.mpja.com/download/31227sc.pdf and https://cdn-learn.adafruit.com/assets/a ... SS0001.pdf

Maybe somebody that knows more can correct me if I am wrong here but my understanding is as follow:
When moving in front of the sensor because of the two windows the signal should go low then high or high then low these two peaks should count as a single movement.

There is not much info about the BISS001 IC but found that I could tap at both the Vout1 and Vout2 aka the two stages of the analog side of the circuit.
So I got the signal from the stage2 out pin 12 and created my own simple circuit using two comparators so I can see the output signal.(this is just trying to mimic their circuit inside the IC)
What this BISS001 IC is doing based on the schematics is that uses the two comparators and an OR logic to transform the small negative and positive peaks into digital peaks and enable the output when detecting such peaks. Now even if they would count every two peaks as one still there is no way to differentiate between the one negative and one positive or two positive peaks thus noise on the positive side could introduce more positive peaks and trigger the output with no negative peaks present.

The datasheet shows the VH=0.7VDD and VL=0.3VDD So using 10x 4K7 resistors in series between 3.3V and ground I have created my own reference ladder for the comparators and used 2 LEDs to see the output signal (actually hookup an old oscilloscope too on the input to my comparator to see the raw signal too).

This is what I found: It seems that the VH is not really 0.7VDD but more toward 0.6VDD thus triggering much easier. (positive noise could make it trigger much easier).
With this circuit I found that there is a lot of noise on the positive side of the comparator (that LED blinks much more even when not moving and seems to be correlated as many people pointed out with the ESP8266 WiFi activity).
If the BISS001 would have more logic inside to look for both peaks negative and positive and account them as a single peak then this IC would have been immune to the noise on the positive side.
From experimenting for few hours with it found that the negative peak had much less noise so I start comparing the different schematics I could find on the internet and using the App Note mentioned above calculated Gain and filter frequencies for the first stage. After redrawing the diagram I found that there is a 18K resistor between the PIR sensor and the input1 (hmm some schematics use it others are not).
So I thought why attenuating the signal before the amplifier ?And I said to myself if I can raise the signal level up I could make the system think that there are no positive peaks and I could trick the BISS0001 to only count the negative peaks and did solder a wire across the 18K resistor. The signal level raised slightly and became less noisy (now I would love to have a better DSO oscilloscope to actually capture the signal, with my analog scope I could only see the signal live) system started to behave better and the LED on the high side even at 0.6VDD will not trigger anymore even when moving in front of the sensor while the low side would still trigger when moving my hand in front.

It would be good if somebody with more experience and better equipment can reproduce this experiment and get better measurements or simply explain to me that I am doing something wrong.


PS: In the end I am not really sure if the BISS001 has an OR GATE or an AND GATE to combine the comparators signals. From my experiments seems that is an AND GATE.

riker1
Normal user
Posts: 303
Joined: 26 Dec 2017, 18:02

Re: HC-SR501 PIR - stop false positives?

#40 Post by riker1 » 24 Apr 2018, 07:25

edautz wrote:
10 Apr 2016, 07:40
----
I solved this with the next solutions:
A: Used a 47uF and 102pF power decompling consensator soldered over the pir power connections at the ESP8266 side.
B: Put the ESP in 802.11G mode instead of 802.11N mode. I think the Rf spectrum will be less in G mode.
C: Put the ESP in wifi STA mode only.
D: Lower the ESP wifi output power to 10dBm.

I noticed I had to apply ALL the countermeasures together to mitigate the false positives.
Hi
having the same problem.
soldered a capacitator on the pir pin 12-13

could you show a picture for your solution A.

how and where did you set solution for B,C,D?

Thanks Thomas

edautz
Normal user
Posts: 13
Joined: 10 Apr 2016, 07:16

Re: HC-SR501 PIR - stop false positives?

#41 Post by edautz » 24 Apr 2018, 21:08

Hallo riker1,

I don't have a picture for solution A, but if you use a nodemcu or another board with a esp8266 installed, soldering the two capacitors on the ESP8266 board to stabilize the power of the pir shouldn't be a problem.

I program my ESP8266/ESP32's from scratch, not using EASYESP or other code.

Solution B has proven to have no effect, so you can use WIFI in 802.11G mode.

Solution C & D if you van program the ESP yourself.

My snippets of code to accomplish this:

Using board manager 2.0.0/higher version and a ESP8266 board:

Enabling low level SDK commands (for boardmanager 2.0.0):

extern "C" {
#include "user_interface.h"

}

wifi_set_phy_mode(PHY_MODE_11G); // SDK command boardmanager 2.0.0 enables WIFI 802.11G mode.
// WiFi.setPhyMode(PHY_MODE_11G); // Command boardmanager > 2.0.0 (tested 2.2.0) same as above.
system_phy_set_max_tpw(value); // // SDK boardmanager 2.0.0 Value max 81 (dB = value/4) max Wifi send power.
// WiFi.setOutputPower(wifioutputvermogen);// Command boardmanager > 2.0.0 Value max 81 (dB = value/4) (tested 2.2.0) same as above.
WiFi.mode(WIFI_STA); // Force ESP in STA(tion) only mode.
WiFi.begin(ssid, password);

The are new board manager out, but I didn't use them, perhaps in the future.

After appling those measuresI noticed still false positives, but far less :

Direct expose to bright sunlight will trigger false alarm, solved to install 2 pir on different places, but working together, triggering alarm at daytime when triggerd together two times in short time. No problem at night, that they work indepently.

Sometimes the pir's produce a series of false positives, all with a pulse time <2800 ms. Those pulses filtered out in the ESP code.
After powerup the ESP with Pir, sometimes a false positive occur, In code suppressed the pir output for 30 seconds.


After all this measures I got 1 a 2 false alarms for my system in a year. Alarm is activated every night and when we are not at home.

Hope this helps,

Kind regards,

Edautz

riker1
Normal user
Posts: 303
Joined: 26 Dec 2017, 18:02

Re: HC-SR501 PIR - stop false positives?

#42 Post by riker1 » 25 Apr 2018, 07:24

Hi Edautz,

thanks.

A: Used a 47uF and 102pF power decompling consensator soldered over the pir power connections at the ESP8266 side.
which pins did you use? I am not an expert so?

Thanks Thomas

edautz
Normal user
Posts: 13
Joined: 10 Apr 2016, 07:16

Re: HC-SR501 PIR - stop false positives?

#43 Post by edautz » 25 Apr 2018, 15:51

If you look to this picture:

https://www.elektor.nl/nodemcu-microcon ... gI0hvD_BwE

(assuming you use a nodemcu 1.0 ESP8266 board) You see Vin and GND pin. Vin is also 5V.

You can solder both capacitors to this pins. Be aware of the polarisation of the electrolytic capacitor.

Then connect the HC-SR501 power pins to this pins on the ESP board.

riker1
Normal user
Posts: 303
Joined: 26 Dec 2017, 18:02

Re: HC-SR501 PIR - stop false positives?

#44 Post by riker1 » 25 Apr 2018, 16:45

ok, thanks
will try

olleman
Normal user
Posts: 39
Joined: 27 Aug 2017, 08:10

Re: HC-SR501 PIR - stop false positives?

#45 Post by olleman » 16 Aug 2018, 16:20

I'm having big problems with my PIR sensors as well - to the extent that they aren't really usable. Is there a working solution that actually works? I'd like to continue using ESPEasy so programing the 8266 by myself isn't really a solution for me.

Andre BUHART
Normal user
Posts: 1
Joined: 04 Nov 2018, 18:41

Re: HC-SR501 PIR - stop false positives?

#46 Post by Andre BUHART » 04 Nov 2018, 19:00

One solution I have tested with success is to put a ferrite core close to the PIR sensor. When the ESPeasy is too close (few cm) from the PIR, the WIFI HF is detected and generates false positives. Power and signal cables act as HF antenna.
IMG_20181104_183249.jpg
IMG_20181104_183249.jpg (25.62 KiB) Viewed 11198 times
Pass the 2 power cables and the PIR signal cable through the ferrite. If you can, you can make additional turns to improve the efficiency.
You can buy cheap ferrite core on Ebay.

Regards

André

Domosapiens
Normal user
Posts: 286
Joined: 06 Nov 2016, 13:45

Re: HC-SR501 PIR - stop false positives?

#47 Post by Domosapiens » 04 Nov 2018, 19:51

André,
do you have a triple-screen presentation for this?
Regards
Domosapiens
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.

rvdhorst
Normal user
Posts: 1
Joined: 16 Jun 2019, 19:39

Re: HC-SR501 PIR - stop false positives?

#48 Post by rvdhorst » 16 Jun 2019, 19:42

edautz wrote:
12 Apr 2016, 22:12
I use the Arduino IDE 1.6.8 with board manager v 2.0.0 to program the ESP8266

Using the following commands to set the requested wifi settings:

wifi_set_phy_mode(PHY_MODE_11G);
system_phy_set_max_tpw(powervalue max 82); divide by 4 for dBm value
WiFi.mode(WIFI_STA);
This helped me with the SR505 on my ESP-01s from getting false positives! Tx!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests