PIR sensor

Switch Input - Switch NORMAL CLIMATE

../_images/P001_PIR_sensor_1.jpg

Introduction

A big difference from the regular tactile buttons and a PIR is that a PIR will output a high or low Signal without someone actually pushing a physical button. The PIR uses a pyro detector which will detect change in radiated heat. A person or an animal is always radiating some level of heat and when someone enters the vision of the PIR the amount of heat will change and the PIR will trigger a signal.

Specifications:
  • Motion (change in heat)

  • Power needed: 5V (typically)

  • Output voltage: 3.3V (typically)

Note

Some PIR sensor boards have a jumper which will allow you to have the unit send a single pulse when the motion is detected or send a single repeatedly as long as motion is detected. Good boards also have a sensitivity adjustment and time delay setting which lets you tweak the way the unit is behaving, that could be really helpful if the default settings are triggering too much or not enough.

Wiring

ESP               PIR
GPIO (X)   <-->   I/O or OUT

Power
5V         <-->   VCC
GND        <-->   GND

Setup

../_images/P001_Setup_PIR_sensor_1.png

Task settings

  • Device: Name of plugin

  • Name: Name of the task (example name Motion)

  • Enable: Should the task be enabled or not

Sensor

  • Internal pull-up: Check if you want to use the internal pull-up of the ESP (not all GPIO pins have this internal pull-up.)

  • Inverse logic: Sometimes you may want the physical high value to be published as a low value. For example if the button is triggering a high (1) value when you push it you maybe use it to turn of a LED so the Switch#State would then logically be preferred to be set as 0 and thus used as a variable for controlling that LED. See rules example below.

  • GPIO: Which GPIO should be used, recommended to not use a latching switch that may set the ESP into flash mode if left to high/low.

  • Switch type: Set the switch type to either “Switch” or “Dimmer”. PIR is a “Switch”.

    • Switch: The default way of handling a switch is by a on/off button. It’s either on (1) or off (0).

    • Dimmer: Not used by PIR switches, if you still want to use it you can have a look at the Switch page.

  • Switch button type: Set the type of switch, “Normal switch”, “Push button active low”, or “Push button active high”. * Normal switch: This is the general setting to use for a door (reed) switch.

    • Push button active low: Not used by PIR switches (in general), if you still want to use it you can have a look at the Switch page.

  • Send boot state: If checked the unit will publish the switch state when booting. If not checked you may find yourself with a latching switch caught in limbo. This means that the unit is registering a low/high value but the physical state of the switch might be the opposite. If you use a mechanical switch that may be physically set to a state you should check this option.

Advanced event management

  • De-bounce (ms): How long should the pulse (the time you press the button) be, if set to high you need to have it published for a longer time before the unit will register it as an state change. You could experiment with this setting to find a good behavior of the button if you feel that it’s not responding according to your preferences.

  • Double click event: Not used by PIR switches (in general), if you still want to use it you can have a look at the Switch page.

  • Double click max interval (ms): Same as above..

  • Long press event: Same as above..

  • Long press min interval (ms): Same as above..

  • Use safe button (slower): Same as above..

Data acquisition

  • Send to controller 1..3: Check which controller (if any) you want to publish to. All or no controller can be used.

  • Interval: How often should the task publish its value (optional for switch plugins).

Rules examples

on Motion#Detection=1 do
  timerSet,1,1
endon

on rules#timer=1 do
 if [Motion#Detection]=0
  //Action if NO motion is detected
 else
  //Action if motion is detected
 endif
endon

Where to buy

Store

Link

AliExpress

Link 1 ($)

Banggood

Link 2 ($)

eBay

Link 3 ($)

$ = affiliate links which will give us some money to keep this project running, thank you for using those.

More pictures