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.