Git Product home page Git Product logo

nodemcu-motion_detector's Introduction

Notes on HC-SR501 PIR motion sensor

Sample Code

motion.lua

Connect output of sensor to D6. If sensor is in 'hold HIGH' mode, a line will be logged while motion is being detected. If sensor is in 'motion event' mode, a line will be logged for every motion event.

Specs

  • power: 5v
  • jumper on middle and inside: holds output pin HIGH when motion detected.
  • jumper on outside and middle: output is raised HIGH once / "motion event". No motion for X interval ends a motion event.
  • with jumper on the left, left-most dial is sensitivity (3m-7m), right dial is 'time delay before triggering' (300ms - 5s).

Notes

  • attempting to run off < 5v results in the output flapping. HC-SR501 includes a 5v -> 3v regulator that could be bypassed if 3.3v supply is required.

Helpful links

nodemcu-motion_detector's People

Contributors

dan-cleinmark avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nodemcu-motion_detector's Issues

sensor will send a signal With or without movement

connections:
pir501 VCC-vin(5v) nodemcu
pir501 OUT-D4 nodemcu
pir501 GND-GND nodemcu

console print out:
ESP8266 Started
Compile File:motion_test.lua
Remove File:motion_test.lua

Motion detected!
[DEBUG] start: 5, last: 0, break: 5
motion ended after 4 seconds.
[DEBUG] start: 5, duration: 4
Motion detected!
[DEBUG] start: 14, last: 9, break: 5
motion ended after 4 seconds.
[DEBUG] start: 14, duration: 4
Motion detected!
[DEBUG] start: 24, last: 18, break: 6
motion ended after 5 seconds.
[DEBUG] start: 24, duration: 5
Motion detected!
[DEBUG] start: 34, last: 29, break: 5
motion ended after 5 seconds.
[DEBUG] start: 34, duration: 5
Motion detected!
[DEBUG] start: 44, last: 39, break: 5
motion ended after 5 seconds.
[DEBUG] start: 44, duration: 5
Motion detected!
[DEBUG] start: 55, last: 49, break: 6
motion ended after 4 seconds.
[DEBUG] start: 55, duration: 4
Motion detected!
[DEBUG] start: 65, last: 59, break: 6
motion ended after 5 seconds.
[DEBUG] start: 65, duration: 5
Motion detected!
[DEBUG] start: 76, last: 70, break: 6
motion ended after 4 seconds.
[DEBUG] start: 76, duration: 4
Motion detected!
[DEBUG] start: 86, last: 80, break: 6
motion ended after 5 seconds.
[DEBUG] start: 86, duration: 5
Motion detected!
[DEBUG] start: 96, last: 91, break: 5
motion ended after 5 seconds.
[DEBUG] start: 96, duration: 5
Motion detected!
[DEBUG] start: 108, last: 101, break: 7
motion ended after 4 seconds.
[DEBUG] start: 108, duration: 4
Motion detected!
[DEBUG] start: 117, last: 112, break: 5
motion ended after 6 seconds.
[DEBUG] start: 117, duration: 6
Motion detected!
[DEBUG] start: 129, last: 123, break: 6
motion ended after 3 seconds.
[DEBUG] start: 129, duration: 3
Motion detected!
[DEBUG] start: 138, last: 132, break: 6
motion ended after 5 seconds.
[DEBUG] start: 138, duration: 5
Motion detected!
[DEBUG] start: 148, last: 143, break: 5
motion ended after 5 seconds.
[DEBUG] start: 148, duration: 5
Motion detected!
[DEBUG] start: 159, last: 153, break: 6
motion ended after 4 seconds.
[DEBUG] start: 159, duration: 4
Motion detected!
[DEBUG] start: 169, last: 163, break: 6
motion ended after 4 seconds.
[DEBUG] start: 169, duration: 4
Motion detected!
[DEBUG] start: 181, last: 173, break: 8
motion ended after 4 seconds.
[DEBUG] start: 181, duration: 4
Motion detected!
[DEBUG] start: 190, last: 185, break: 5
motion ended after 6 seconds.
[DEBUG] start: 190, duration: 6
Motion detected!
[DEBUG] start: 201, last: 196, break: 5
motion ended after 4 seconds.
[DEBUG] start: 201, duration: 4
Motion detected!
[DEBUG] start: 211, last: 205, break: 6
[DEBUG] start: 169, last: 163, break: 6
motion ended after 4 seconds.
[DEBUG] start: 169, duration: 4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.