Hi,
I'd like to implement a sensor node (for a home made sensor network) using an arduino (pro mini). The pro mini has two interrupt pins and one is used for "maintenance" (a button that sets resets the node). So I am left with one single interrupt pin.
I would like to use this pin to signal the arduino that it needs to read other pins which contain the sensor data.
The specific node i am building uses magnetic switches to indicate that windows are opened. Whenever one switch changes the state, the interrupt pin should wake up the arduino and send a signal to a base station.
Using one switch is no problem: I just connect the sensor and the int pin to the switch. But mulitple sources for the int pin doesn't seem to work. Especially the fact that I do need to register the change of any source seems to be the problem. Current implementation uses two transistors each connected to one magnetic switch. I do receive the change of one source.
Do you have any advice on what component I could use to implement an interrput pin that notices the change of two sources?
That is actually pretty easy to do. Instead of using the two external interrupt pins (pin 2 and 3 off the top of my head) use Pin Change Interrupts to detect whenever any of the switches change state. Read the status of all the switches in the ISR and go from there.
The problem is that I can only use one interrupt pin for both sensors. And when one sensor gets to HIGH state, the change of the other from LOW to HIGH will not be noticed
That's right, that's why you need to use multiple pins. You can set it so that the Pin Change Interrupt fires whenever any of the sensor pins changes.
I use the Arduino Pro Mini and in the spec it says that it only has two INT-Pins:
(Arduino PRO — Arduino Official Store)
External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt function for details.
External Interrupt 2 is used for another purpose so I am left with only External Interrupt PIN 3.
Or is it possible to use the other pins as external interrupt as well?
Sure is, here is a pretty good explanation of Pin Change Interrupts.
Cool, thank you very much! This seems by far easier than I thought 