Making a simple but very robust alarm system with arduino

he following simple diagram shows a concept which I'll try to execute in near future. Since I am new to Arduino, I'd appreciate any help. The alarm is mainly used for several window and door contacts (normally closed) in series. It will activate upon opening of any contact. The problem that I've had with previous circuits based on simple logic gates was the false alarm. I don't what was the source but my best guess is RFI noise due to long wire etc. By using Arduino I should be able to make more intelligent system which needs to meet some conditions before it can activate the alarm.

  1. At the start all outputs are low. The power on delay starts and continue for 5 min. This is indicated by a LED. If any of the contacts are faulty i.e. open contact, the system won't proceed and the LED will be off.

  2. After 5 min exit delay period, sensors I/O (analogue out/in) sends a current through wire and sensors. The sensor input pin also has low pass filter ,10K/0.01uF (not shown) to block RFI noises. The system goes into standby mode. I am going to use one of the sleep libraries to minimise the current consumption.

  3. When any of contacts opens, the system won't react immediately, it waits 100ms and read again, repeat for three times. If the input pin reading is still lower than predetermined threshold voltage, the system then would react and sound the alarm. Any false alarm due to external noises shouldn't cause issue anymore.

Please let me know what do you thing and if you have any suggestions to further improve it. Help with coding is also greatly appreciated.

More usual for an alarm system is to have a resistor across each contact (say 1k) so a fault condition (cut cable etc.) can be detected even if the alarm is not in active mode and that, if the alarm is in active mode, it is not possible for an intruder to disable a contact the alarm by shorting it out.

if you want good noise immunity with long wires then you need a low impedance circuit. Use pull-up or biasing resistors so that a wire is never allowed to 'float' otherwise it'll behave as a radio antenna picking up interference.

mikb55:
if you want good noise immunity with long wires then you need a low impedance circuit.

This is the actual input filter that I didn't include in the original circuit. This should give a degree of immunity. The input delay that I mentioned before should take care of rest though, right?

https://i.imgsafe.org/063891f72f.png

DDT12:
This is the actual input filter that I didn't include in the original circuit. This should give a degree of immunity. The input delay that I mentioned before should take care of rest though, right?

https://i.imgsafe.org/063891f72f.png

Try a few hundred ohms instead of mega ohms.
If current consumption is a problem use a mosfet to apply a pullup voltage only when the Arduino has woken up from its sleep state.

mikb55:
Try a few hundred ohms instead of mega ohms.

Yes it sounds good. I have a question though, In the shown diagram, in the standby mode, the analogue-in pin is kept high and goes low by pull down resistor R3 when the contacts open. The other way would be keeping analogue in pin low and then when the contacts open it goes high by the same resistor, but tied to VCC. Both would be similar, but in terms of RF immunity which one would be better?