ESP8266 PIR Motion Detector

This project connects a PIR motion detector to an ESP8266 but it is especially battery efficient because the ESP8266 is turned off when motion is not present.

  • Adafruit Huzzah ESP8266 board
  • Adafruit PIR motion sensor
  • Batteries, 3xAA

Battery PIR     ESP8266 Huzzah
======= ===     ==============
POS --- 3-5V -- VBAT
NEG --- GND --- GND
        DOUT -- LDO cut pull up

The PIR maximum voltage is 5V. Four batteries produces 6V which is too high.

There is a pull up resistor on the LDO enable pin which is required when nothing is connected to LDO. In this case, the PIR DOUT signal is connected to the LDO pin so the pull up is not needed. To get maximum battery life, the resistor must be disconnected to prevent it from wasting power. In the following photo, the red line shows the trace to cut.


LDO is the enable pin for the 3.3V voltage regulator (VR). When grounded, it turns off the VR so everything on the 3.3V side is powered off. When the PIR does not detect motion, it drives DOUT low so the ESP8266 board is powered off. When the PIR detects motion, it drives DOUT high which turns on the ESP8266.

The PIR Time potentiometer determines how long the DOUT is high so set it to the maximum which is about 7 seconds on my PIR. On the PIR, set the Retrigger Setting Jumper set to the SW1 H position.

The sketch must connect to the AP and send a motion detected message (MQTT or HTTP or something else) as soon as possible. After it is done, the sketch should put the ESP8266 is deep sleep. DOUT could be high for as long as motion is present. Use deep sleep to save power until motion stops and DOUT goes low turning the ESP8266 off.

Comments

Popular posts from this blog

Defective Arduino USB Host Shield Boards

How to use USB RFID readers on an Arduino Uno

WeMos D1 R2 ESP8266 with USB Host Shield