Chat freely about anything...

User avatar
By WinkyWalia
#42167 I am sure this topic has been discussed in some other post. I am a programmer and new to electronics, so I apologize for my ignorance.

I am trying to connect PIR Motion Sensor HC-SR501 with ESP8266 NodeMCU 12E. It works fine with the following components and setup:

Components:
YWRobot
ESP8255 NodeMCU 12E v.1.0
PIR Motion Sensor HC-SR501
Micro USB from computer to power ESP
Breadboard

Connection using Micro USB:
PIR Output to GPIO5 (D1 on NodeMCU)
YWRobot 5v and ground output to Breadboard, and 5v, gnd input to PIR from Breadboard
Connected GND from Breadboard to ESP
Micro USB power to ESP

Arduino IDE is being used for programming and I am using Interrupt to check PIR HIGH/LOW. This setup is working fine. However when I try to make it work without the Micro USB input from computer, it behaves very differently. Here is how I am setting this up without Micro USB:

Connection without Micro USB:
YWRobot 5v and ground output to to PIR
YWRobot 3.3v and ground output to to ESP
PIR Output to GPIO5 (D1 on NodeMCU)

For some reason, ESP GPOI is getting HIGH/LOW frequently every 30-60 seconds (depending on how much delay provided in my coding), regardless if there is any motion or not. I have tried different connections, with/without breadboard, but same result. Can someone please tell me what am I doing wrong. I really appreciate any help.
User avatar
By Barnabybear
#42194 Hi, sounds like with no usb connection you have lost the ground to near by devices and some RF from them is triggering the PIR. One simple answer is to wrap tin (aluminium / baking) foil around the PIR just leaving the domed sensor open. Make sure you dont short anythng out on the board.
User avatar
By jonn26
#49433 I tried the HC-SR501 along with about 3 other types of PIR sensors and would always get false positives. It seems that for some reason when wifi on the esp8266 would send any data it would trigger the sensor.

I finally found a sensor that works, is MUCH smaller and runs off of 3v without modification. Hope this helps someone not have to go through the pain I did : )

http://www.aliexpress.com/item/5Pcs-Hot-Sale-High-Quality-Mini-IR-Infrared-Pyroelectric-PIR-Body-Motion-Human-Sensor-Detector-Module/32655046726.html
User avatar
By NeilCee88
#49452 Hi jonn26,
If i may add a theory to your situation....

I encountered something similar and it very much could be the voltage supply...
I found that my similar circuit (using standard Household PIR converted for 5v and Esp8266_01), all was fine until the ESP8266 transmitted, then the supply would drop to around 3 v,.
Reading the datasheets for the esp8266, the current consumption for the esp8266 in tranmit mode can be as much as 250mA or more, so if your supply is already at its limit, when the esp opens up to transmit...the supply is loaded and voltages drop causes all sorts of reboots, spurious readings etc.
So, as a suggestion,
1. measure the supply voltage during the full cycle and watch for fluctuation.
2. measure and calculate the total power consumption of your circuit, then compare this with the power that your power adaptor is supplying, ideally you would need the supply to be 1.5 X demand.

Good luck in your adventures.