Adding interrupts to my security system project

Hello everybody,

Please help me to setup a security system by pointing me the right direction :)

This system would work as follows :

Based on a Mega 2560, it would be connected to 10 detectors (with "NO" and contacts) and should trigger different kind of actions each time a detection occurs (light activation, siren activation, sms sending, etc.) .

I would really appreciate if somebody could provide me with an example of a simple and commented code supporting multiple interrupts (at least 10) and also quickly explain how "multiple interrupts" works

Thanks in advance for your help !! :) CSA75

Unless for some strange reason it is necessary to detect the security breach within a few microseconds I can't see any need to use interrupts. I strongly suspect it will be sufficient to detect a breach within, say 1/10th of a second and that can easily be done using polling.


you just have no concept of what an "interrupt" means in the context of a microcomputer/ microcontroller. That said, this is a somewhat common trap for "newbies", so don't be dismayed. :D

"Pointing you the right direction" will start by having you explain to us (in reasonable detail) what your prior experience is, what exercises you have performed so far with your Arduino system (and what system or systems have you at this point, including just what sort of "detectors"). A Mega 2560 may or may not be the most appropriate way of implementing your system.

You require to learn progressively about "de-bouncing" contacts, how the Arduino (or more specifically the ATMega chips) works, protection circuits (you probably do not realise just what circuits are inside security systems), and you need to build up your system and test it step by step.

One question is - to what extent should we write it for you? In fact, we sometimes do, but usually not the whole from scratch. It's a bit like the boys and girls game: "You show me yours, and I'll show you mine!". :astonished:

Suffice to say interrupts are completely inappropriate in this context, and you just need to forget about them and start with demonstrating some concept code that you have worked on - for just a few of the simple functions.