Skip to content

mrnul/pir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Low-Power Motion-Activated Light

Overview

This is used to light a small room whenever movement is detected, using a PIR sensor (QB041/QB066 PIR), an esp32h2, fairy led lights and a bc337 to turn the lights on/off

Everything is battery operated (3xAA)

It is implemented as a finite state machine with 3 states and utilizes deep sleep to minimize power consumption

This is an alternative to https://github.com/mrnul/light


States

STATE1 - Idle (Light OFF)

  • PIR: PIR is LOW (no motion)
  • Action: Light OFF
  • Transition:
    • → STATE2 when PIR becomes HIGH (motion detected)

STATE2 - Motion Active (Light ON)

  • PIR: PIR is HIGH (motion detected)
  • Action: Light ON
  • Transition:
    • → STATE3 when PIR becomes LOW (no motion)

STATE3 - Grace Period (Light ON)

  • PIR: PIR is LOW (no motion)
  • Action: Light remains ON
  • Transition:
    • → STATE2 if PIR becomes HIGH (motion resumes)
    • → STATE1 if timeout expires

Diagram

stateDiagram-v2
    STATE1: STATE1 - Light OFF
    STATE2: STATE2 - Motion - Light ON
    STATE3: STATE3 - No Motion - Grace Period - Light ON

    STATE1 --> STATE2: PIR HIGH
    STATE2 --> STATE3: PIR LOW
    STATE3 --> STATE2: PIR HIGH
    STATE3 --> STATE1: Timeout
Loading

About

Low-Power Motion-Activated Light

Topics

Resources

Stars

Watchers

Forks

Contributors