-
The PIR sensor will be managed by a NodeMCU wifi module
The chosen module is the 'Wemos D1 Mini'.
This module provides a simple clean interface and is easily programmed 'Over the Air'.
.
------ Wemos D1 Mini NodeMCU:
-
- To test the behavior of the PIR a Test-Bed was constructed to experiment with the PIR settings.
-
.
"PIR Circuit - NodeMCU (Wemos) Test Bed":
.
.
.
"PIR Circuit - NodeMCU (Wemos) Schematic Test Bed":
.
.
The above Fritzing diagrams show how the NodeMCU and the PIR are wired up.
As an initial setting adjust the 'Sensitivity' to half way, and the 'ReTrigger Time' to fully anti-clockwise.
Now we have to program the NodeMCU to run the test program.
Run the Arduino IDE and open a new 'Sketch' which contains some suggested code.
Select and Copy the all text from the following window.
Paste all the text (overwriting the new 'Sketch' suggestions).
'File => Save As' the Sketch 'NodeMCU-PIR-Test-01' .
Ensure that the 'Tools => Board:' is set to 'Generic ESP8266 Module'
and the board is selected as 'Node MCU' to ensure the correct names for pins
'Verify / Compile' the Sketch.
Connect the NodeMCU to a USB port,
Click on 'Tools => Port' and note the Port number is correct
Click on 'Tools => Serial Monitor' which will open a window showing all the serial comms
Down the bottom of that window ensure the speed is set to '9600 baud'
'Upload' the Sketch.
The Green 'Clock Tick' LED will start flashing (about 5 times per second)
When movement is detected by the PIR the Yellow 'PIR Detected' LED will light up.
---
'NodeMCU-PIR-Test-01'
.
- ---
- Slowly adjust the 'Sensitivity' Potentiometer screw until the optimum PIR Sensitivity is set.
.
.
.
.
.
.
.
.