Well, this is yet-another motion sensor summary. A well-written tutorial from Adafruit is linked at the end of step 1. This tutorial is the part 2 on the topic of current limiting for LEDs, MQTT, and motion sensor. Part 1 is here.
PIR (Passive infrared sensor) or motion sensor is as its name implied detects a heat source that moves. Human, dog, cat moving across the front of the sensor triggers a HIGH signal. Here is a very nice diagram from Adafruit about the PIR sensor. PIR sensor is lost cost, and the response time is instant. The sensor can be configurated into several setups. Three setups covered in this writing included are:
Here is what we are working. A motion sensor signal is sent by ESP8266 wirelessly, and the data is used to turn on/off a light or a SQL database.