Safest option for home alarm

I think I have 2 options here, but not sure which would be the safest choice on 2 counts :

  1. having wiring running through the roof of the house to the door contacts carrying 12v, or
  2. protecting the Arduino board from interferance on the cables.

One option is to connect Ground to the contacts, and the feed back from the contact direct to the input pin.

Second option is to use an optocoupler (see attachment), but this would mean running a current through the wiring to / from the door contact.

Advice appreciated please.

DRAWING11_final_door contacts.jpg

Most of the alarm systems I worked with drive their sensors with 12V, so running that voltage is the same as in commercial solutions. yo might add some short circuit protection to prevent accidents or tampering.

In the circuit you are showing, you are sharing a common ground. There is no need to do that if you are using an Optocoupler.

You will allways be running a current to the door contact. how much depends on different factors.

You can quite easily protect the Arduino pin against interference and transients, see diagram.