What you need:
PIR i use a HC-SR501
PowerSupply for outdoor use
USB 3.0 Port to program and run the nodemcu (I do not know USB 2.0 can work,too. But 3.0 has more Power)
I use Arduino IDE 1.6.8 with NodeMCU ESP8266 libraries
Make sure your setup works, with a blink example sketch, or similar.
Step 1: Load the Data From My GitHub and Set It All Up
Load the files to your webspace:
Get it from my GitHub: https://github.com/Landixus/NodeMCUMotion
setup your files in add_data.php and dbconnect.php (You need to setup these files, they are commented)
You need a mySQL database on you webspace:
The SQL file with 1 entry is in my GitHub, you can execute the SQL Statement for example with phpMyAdmin.
try that it works with:
it must add an entry and send you an email, if you get your entry and mail, go to Arduino ide and load the code in the NodeMCU after you setup
your SSID and Password, also the other values for your website. (documented in code).
my PIN is: "int pirPin = 4;" (D2)
in line 88 / 89 you find the data to change for your website, also with an .htaccess example for serious use.
Step 2: Wire Up
The pir HC-SR501 works with 3.3V.
See my Video, you can power it with 3.3V the PIN next to the Trigger Jumper.
Power from 3.3V right from the UBS Port from the NodeMCU and bring GND to GND
The PIR is really Sensitive, you can try to make a pipe over the sensor to make it less sensitive:
Beware of much mails! The best location is INSIDE for use.
Outside, you get many fake detects during light changing.
If you are running in trouble just drop me a comment, and i try to help.