PIR Sensor: false positive detections
MZ-BER last edited by MZ-BER
Hey folks - Ive added a new gadget to my MagicMirror: HC-SR501 PIR sensor. I was able to set it properly up with MMM-NewPIR. But I noticed that I have a lot of false positive detections (every 4-5 min.). Even if my sensitivity is as low as possible.
Do you have any recommendations to reduce the false positive rate?
Hi @mz-ber ,
That is strange, do you have any movement at all or none?
I am using a different module (MMM-PIR-Sensor) and mine is working perfectly.
For starters I’d eliminate magic mirror and just observe the behaviour on the command line, there are python libraries to monitor the sensor and to check that it is working correctly independently of magic mirror.
Hope this helps at least a bit,
@stefan723 May be, a so called “Step Down” resp. “Step Up”-resistor is needed. The PI has built-in Step Down/Up functionality.
The issue may arise due to interferencies from other parts around the sensor and the PI. First follow the idea of @Stefan723 and try to use short cables.
Use Google to search for “Step Down/Up and Raspberry PI”.
But I’m a programmer…not an electrician:-)
I had the same issue for some time, it turned out to be the time in between detections was too long. the sensor would detect movement and keep that state until the set time and then checks again. Play around with adjusting one of the orange screws on the sensor until the detection time is very low.
I’m with @Stefan723. I had used MMM-NewPIR in the past but switched back to MMM-PIR-Sensor again for reasons. MMM-PIR-Sensor is simple, robust and does the job reliably. May be you have some intereferences, too, which trigger false positives.
Due to the proximity of the Vout and GND wires to the WLAN module, unwanted interferences may occur which might prevent the PIR sensor to switch from high (motion detected) to low state (no motion detected). The wires work like an antenna in that case. As a result, the display will stay on. A ferrite bead attached to those wires, e.g. taken from an old VGA cable, reduces the interferences and allows for correct state change.
Hope that helps.
@fozi I also had false triggers. It turned out that my PIR was too close to my Pi and the WiFi chip induced EMF into the PIR. By moving the PIR further away and introducing a low pass filter i solved my issue. Have a look at my circuit and comments
@zoltan Really nice build!Congrats!
Yeah, a low-pass filter can solve the interferences from the WiFi module, too, of course. But due to my lazyness and impatience I sacrificed an old VGA cable and re-used the ferrite bead
MZ-BER last edited by
Hey folks - thanks for your answers. I decided to goahed with a RCWL-0516. But have the same issues. I’m testing the sensitivity with a python script. I also covered it in alu foil - no change. Now I ordered a ferrite beat and will add to the cables (around all of the them or only GND, 5v or Output?)
I’m also thinking about adding a low pass filter, but I have no experience with that. Where do I have to add that? GND & Output?
@mz-ber Just put all wires through the bead.
With the RCWL-0516 you should note that they can be very sensitive (up to 7m on free sight) and detect motion even through walls. First I went the alu foil route, too, but then modded my RCWL-0516 with a trimmer. Now the mirror is triggered when I approach the mirror less than 1m. Check the link in my signature for details, if you like.
MZ-BER last edited by
@fozi Yes! I followed your instructions in detail - that was very helpful. And yes, I noticed how sensitive it is. In your tutorial you removed the the tiny SMD resistor soldered and replaced that. What if I just remove it and not replace it. Is the range than completely gone and doesent work anymore?