Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Mikejstb
#12338 My goal for this project was to make an ESP module that just monitors for presence using the PIR sensor - when it senses someone it will log an mqtt message to my Mosquitto server, to be processed & acted upon with Node Red.
Put them all around the house, sense movement, use time of day and other info to turn on lights, predict movement, check that movement is happening to the places that I expect, maybe some kind of alarm if movement is in unexpected directions - there are lots of possibilities here.

But I couldn't get the PIRs to work reliably with the ESPs. I tried -12, -201, & -01. All of them got RF into the PIR that made false triggers.

By using the repeating GPIO read function in Lua Loader I was able to determine that my PIR sensor would report intermittent triggers when the ESP radio was turned on.
Reliable - with the radio disconnected the PIR worked as expected, connect the radio to my AP and the PIR will trigger on its own.
I tried capacitors, shielded very short connections - nothing I tried was able to get rid of the RF messing with the PIR.

So the solution was this:
1. turn the radio off
2. turn interrupt on for the PIR gpio
3. when the PIR interrupts:
a. turn PIR interrupt off
b. start a timer alarm to ignore any more PIR activity for n minutes
c. turn radio on - connect to AP
d. when the radio connects publish the mqtt message
e. when the mqtt message is sent
1) turn the radio off
2) turn the PIR interrupt back on
all with alarms to repeat the process over and over

I was surprised that it worked early on - and I'm able to watch it with my new ESP-oled mqtt message center!

Now I can collect movement information and start figuring out fun ways to process it!
good times!
User avatar
By MK1888
#12341 Are you sure it was RF interference? Infrared isn't even close to the WiFi band.

I'm curious to try this. Which module are you using?
User avatar
By Mikejstb
#12343 yes, 100% certain that rf getting into the PIR sensor is causing false triggers.
My OP explains how I know this with certainty.

No - the rf is not doing anything IR - the RF is getting into the PIR sensor circuitry and influencing it.

Once I noticed this I did some searching on the web and there are actually RF "hardened" PIR sensors - apparently this is a known problem.