Magnetic Contact Sensor shows Open when NC

Moderators: fantom, leecollings

Post Reply
virtualfreak
Posts: 11
Joined: Friday 29 June 2018 13:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Magnetic Contact Sensor shows Open when NC

Post by virtualfreak »

I just purchased a raspberry pi 3b with piface digital 2 interface. I wired my existing magnetic door contacts (MDC) from my old security system directly to the piface inputs and selected type as "Door Contact" in Domoticz and it reports the open/close reversed. Domoticz reports NC (Normally Closed), as door "Open" and visa versa. Does anyone know if I can correct this via a software configuration change? I can live with it but I'd be nice if the door state was reporting correctly in Domoticz.

My setup:
- 5 hardwired MDC to piface inputs (0-4)
- Domoticz v4.9700 running on raspian stretch lite 4.14
- Echo-Dot connected as BT speaker (used to send audio when door event triggers)

I appreciate any suggestions. Thank you.
SweetPants

Re: Magnetic Contact Sensor shows Open when NC

Post by SweetPants »

You can also add in inverter circuit or transistor to the input to invert the signal?
virtualfreak
Posts: 11
Joined: Friday 29 June 2018 13:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Re: Magnetic Contact Sensor shows Open when NC

Post by virtualfreak »

Yes, if the "inversion" isn't a simple variable change I can make in either the Domoticz or piface configuration software then I'll look at using an external circuit to do the same thing. Thank you very much for the suggestion.
virtualfreak
Posts: 11
Joined: Friday 29 June 2018 13:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Re: *Solved* Magnetic Contact Sensor shows Open when NC

Post by virtualfreak »

Success!! I was able to invert the signal. Here's what I did:

Since I have a PiFace digital 2 board. in ~/domoticz/piface.conf I changed the pin_type to "inv_level". Rebooted and problem fixed. (Thanks to Robin Stevenhagen for writing the PiFace driver the easily allows this access to the GPIO).

I did find other information regarding configuring the Pi GPIO directly using files if you don't have an interface connected to the Pi like a PiFace. These were helpful resources in helping me understand the basic concepts:

https://projects.drogon.net/raspberry-p ... o-utility/
https://wiki.domoticz.com/wiki/index.ph ... low_relays
https://luketopia.net/2013/07/28/raspbe ... the-shell/
http://raspberry-projects.com/pi/comman ... mmand-line
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests