ESP8266 - Motion Sensor
by DIYables in Circuits > Microcontrollers
13 Views, 0 Favorites, 0 Comments
ESP8266 - Motion Sensor
This is a compact build guide. The full tutorial, with the wiring diagram and a line-by-line walkthrough of the code, is here: https://newbiely.com/tutorials/esp8266/esp8266-motion-sensor
Have you ever asked yourself, “How can it do that?” when you come across places with doors that open and close automatically, light bulbs that turn on and off, or escalators that activate without any human intervention? If so, this tutorial will not only answer your question, but also show you how to make it happen by using ESP8266 and motion sensor. Let's get started!
Supplies
Everything below is what the build uses. The links go to the parts we make and test.
- ESP8266 NodeMCU ESP-12F
- ESP8266 D1 Mini NodeMCU ESP-12F
- ESP8266 NodeMCU ESP-12E (Uno-form)
- Micro USB Cable
- ESP8266 NodeMCU ESP-12F (SMD-form)
- USB Cable Type-A to Type-C (for USB-A PC)
- USB Cable Type-C to Type-C (for USB-C PC)
- HC-SR501 Motion Sensor
- AM312 Mini Motion Sensor
- Jumper Wires
- Breadboard
- Screw Terminal Expansion Board for ESP8266
- DIYables Sensor Kit (18 sensors/displays)
What It Is
The HC-SR501 PIR sensor is a module that can sense the movement of people (or animals). It is often utilized in many applications to detect the presence of humans, such as automatically turning on/off a light bulb, opening/closing a door, activating/deactivating an escalator, or detecting an intruder.
Wiring
The HC-SR501 motion sensor has three pins:
GND pin: This must be linked to GND (0V)
VCC pin: This must be linked to VCC (5V)
OUTPUT pin: This is an output pin. It will be LOW when no motion is detected and HIGH when motion is detected. This pin needs to be connected to an ESP8266's input pin.
How It Works
The HC-SR501 sensor is able to detect motion based on changes in the infrared radiation coming from a moving object. In order for the HC-SR501 sensor to identify the object, two criteria must be met:
The object must be in motion or vibrating
The object must emit infrared radiation
Code
esp8266-motion-sensor.ino - the sketch from the tutorial, unchanged.
Full Tutorial
The complete tutorial, wiring diagram and code explanation: https://newbiely.com/tutorials/esp8266/esp8266-motion-sensor