My project switches on various outputs, including a 5V relay switching mains power. It has an override reset interrupt (on rising) on pin 3 which changes the value of a [global] variable which is polled throughout the program, when the variable is high it resets all outputs. The pin is pulled to ground through a small resistor.
I'm having issues with the interrupt being triggered the instant the relay is switched, which is wrong. When I take out the AttachInterrupt code, the components all work as they should. Unfortunately the reset is the vital part. I could just use the on-board reset (which I use when the interrupt is removed) but I really need an external interrupt generated by a sensor.
The relay is set up according to Arduino Playground - HomePage, with a P2N2222A transistor and 10kOhm resistor. It is connected with twisted pair wires to reduce inductance in surrounding components/pins but still seems to generate a signal at pin 3 which is interpreted as an 'interrupt'.
I am at my wits end as I've tried all sorts, including moving all the other I/Os as far away from pin3 as possible, separating the circuits onto different breadboards, even using coaxial cables.
What am I doing wrong?