So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By HuberDe
#85000 Hi all,

I'm just started doing my own small ESP8266 projects with a WEMOS D1 mini and I'm quite happy with this small toy :-)

Last day I recognized that a ESP8266 which is used as PIR Sensor publish movement although there was no one in the room. I checked the logs of my openHAB installation and found, that the sensor already toggled since the whole last day. I replaced the PIR sensor on this device, but the behaviour was the same. So finally I had to replace the ESP itself to get it working again.

The solution is pretty simple. I connected the PIRs gnd and vcc to the ESPs gnd and 5V. The signal PIN is connected to D7. All this worked like a charme for a few weeks now, before the issue began.

Can somebody tell me what is the issue here? Do I need a resistor or anything else between the signal PIN of the PIR and the D7 input of the WEMOS? Or is there anything else?

Thanks,
Denis
User avatar
By btidey
#85031 PIR sensors can be prone to false triggers when there is a strong wifi signal near them. So the esp8266 wifi itself can be the cause of spurious toggling. In extreme cases the PIR sensor will just toggle on and off all the time without any movement.

There are various solutions to this.

Move the PIR Sensor well away from the esp8266.

Shield the main electronics of the PIR sensor.

Intelligently manage the wifi transmission if possible. For example, you can start with wifi off and only turn it on when the PIR signal is detected, then signal the trigger over wifi and turn it back off again till the next real trigger. This solution works really well with battery powered deep sleep operation. In this case the PIR trigger wakes the ESP8266 from deep sleep which then signals the trigger over wifi and re-enters deep sleep.

See https://github.com/roberttidey/SecuritySensor for an example of deep sleep approach.
User avatar
By HuberDe
#85032 Hi,

Thanks for the answer. The point is, that it worked for weeks now until it started to make problems and with another ESP it's working again at the same place with the same PIR and the same houslng. But thats a good hint. I will check if it works better with the "damaged" ESP if I deactivate the wireless module.

About the deep sleep. I already found such an solution. My problem with that is, that it needs 4-5 seconds until wifi is connected after the PIR wakes the ESP. This is much to long for me for a motion detector which switches a light.