Hello,
I am using the Arduino 2560 to control a number of 120VAC solendoids. I use digital pins 22,24,26,28 to trigger the dc side of dc-ac optically isolated SSRs which then power the valves. This system works great, and has been in use for months. Recently, I added an interrupt option, and that's where the trouble begins. Here's the setup portion of the code:
void setup()
{
delay(1000); //Allow for full booting of board before operation.
pinMode(2,INPUT); //setup pin2 for use as interrupt1, Isolation.
pinMode(53,OUTPUT); //setup pin53 for signal to interrupt0.
digitalWrite(53,HIGH); //setup pin53 for signal to interrupt0.
attachInterrupt(1,Isolation,RISING); //Initiate Isolation procedure when int.0 is in the LOW state.
pinMode(V1,OUTPUT); //SSR trigger signal for V1
pinMode(V2,OUTPUT); //SSR trigger signal for v2
pinMode(V3,OUTPUT); //SSR trigger signal for v2
pinMode(V4,OUTPUT); //SSR trigger signal for v2
Serial.begin(9600);
}
I wanted a switch that would interrupt the repeating valve sequence and force a particular configuration on the system. It works as expected when triggered, but unfortunately it seems to trigger unexpectedly as well. Initially the switch functioned to break the circuit between pin 53(set to HIGH) and int.1 (using 10Kohm pulldown resistor), with attachInterrupt triggering on LOW. I changed to a switch that completed the connection and had attachInterrupt trigger on RISING. The same effect was observed, an unexpected triggering of the interrupt.
I was worried about bad connections, so I bought and soldered a protoboard, which looks nice, but did not solve the issue. I checked the DC input to the SSR, and the resistance is 7kohms, so I don't think I'm drawing too much current on pins 22,24,26,28.
There are sources of mechanical vibration and electrical noise (1/8hp DC motors nearby) which seem to coincide with the interrupt triggering. Is it possible that I am getting electrical noise? If there was a DC offset travelling along the frame, then the bad behavior should only be seen in the LOW or RISING trigger options of attachInterrupt, not both. That leaves me looking for sources of AC noise or bad connections. Any tips?