Posts: 6,259
Threads: 806
Joined: Oct 2020
Reputation:
151
PIR output is dry contact. you can connect PIR output to GPIO of ESP32 directly. PIR's COM with ESP32 GND.
Posts: 12
Threads: 5
Joined: Apr 2023
Reputation:
0
Thank you, a follow up question
I opened the sensor and i see there is a COM and then one NO and one NC connector.
If i connect the COM and NO it works as expected, but if i connect the COM and the NC to the esphome device it behaves exactly the same .... the binary sensor is OFF until motion is detected and then it switches to ON
I would expect the 2 type of connection to be inverse of each other and so if i connect "COM" to ground and "NC" to the GPIO input pin the binary sensor should be ON until motion is detected and then switch to OFF
what am i doing wrong ?
Posts: 6,259
Threads: 806
Joined: Oct 2020
Reputation:
151
ESPHome can set "invert" ture or false.
Posts: 12
Threads: 5
Joined: Apr 2023
Reputation:
0
Thank you.
I know but that is not the point. That will onlyaffect esphome
The problem is that if I connect "com" and "NC" or "com" and "NO" the sensor behaves the same. In both cases it behaves as if it was a Normally open connection.
It does look like there is something wrong with the relay
Posts: 6,259
Threads: 806
Joined: Oct 2020
Reputation:
151
that need check sensor with your multimeter.
Posts: 12
Threads: 5
Joined: Apr 2023
Reputation:
0
Will do. What voltage do you expect for NO and NC?
Posts: 6,259
Threads: 806
Joined: Oct 2020
Reputation:
151
you can use any voltage with NO, NC, it just a relay contact.
Posts: 12
Threads: 5
Joined: Apr 2023
Reputation:
0
04-29-2023, 09:12 AM
(This post was last modified: 04-29-2023, 09:55 AM by primeroz.)
> you can use any voltage with NO, NC, it just a relay contact.
Then i am not sure what do you want me to check with the `multimeter`
can you be more specific ? do you want me to check
* voltage when NO
* voltage when NC
* Resistance when NO
* Restistance when NC
?
Never mind, i moved the sensor to another board where i don't have such a mess of connections and configuration, simply configured as
```
binary_sensor:
- platform: gpio
pin:
number: 5
inverted: false
mode:
input: true
pullup: true # So that it fires when the sensor is disconnected and stop flapping
name: "PIR 1"
id: pir1_motion
device_class: motion
filters:
- delayed_on_off: $sensor_debounce_time
```
and it works as expected.
* When there is no sensor connected to GPIO5 -> Binary sensor is ON ( Good )
* When the NO is connected to GPIO5 -> Binary sensor is always ON and turn off when movement is detected ( Good )
* When the NC is connected to GPIO5 -> Binary sensor is always OFF and tunr ON when movement is detected ( which is what i need )
Thanks
Posts: 6,259
Threads: 806
Joined: Oct 2020
Reputation:
151
sorry, i am not understand your questions clearly. can you take a video of your problem and send to whatsapp number: +86-15381188302