After a long and confusing battle wondering why my interrupts were being activated constantly I've found that it has something to do with a pulse generated by the solid state relay. How do I filter this out? I've seen some solutions such as putting a capacitor between the ground and pin of the solid state relay or filtering the signal out using programming. I'd rather use the capacitor approach because I want to keep the program as simple and fast as possible. My main issue is I don't know what kind of capacitor to use or that it would even solve my problem. My solid state relay is switching 120VAC at 6amps.
Hi, Many questions here:
WHAT are you switching with the SSR?
How is all this wired up???
WHERE is "Ground"...
Sounds like the usual "electromagnetic Interference" subject. Suggest you start here:
Let us know what you decide...
I'm switching the leadshine Dm1182 stepper motor driver. The stepper driver is powered by a plug from the wall, the hot wire goes into the relay and out to the driver while the ground goes straight from the wall to the stepper driver.
I'm using an Arduino mega and breadboard to wire it up. Pins 2 and 18 are being used as interrupts for the end stop and home buttons, their data pins are directly plugged into the arduino while the ground and power are connected to the breadboard which are connected to the 5v out and ground of the arduino. The SSR is connected to the same ground and to pin 24. I'm powering the arduino with my laptop however I plan to run it off a 12v wall jack once the project is finished.
After reading what you linked it seems like I might just have to isolate the wires instead of just having them placed randomly. However the end stop button is next to both the relay and stepper driver and the home button is about a 18inches away from the SSR and driver; they are both giving me the same problem. Although the arduino, breadboard, SSR and stepper driver all within a foot of each other.
If it helps the end goal of the project is to have the endstops, and other sensors connected to interrupts while the stepper motor is moving so that if any sensors would trip the arduino switches the relay off stopping the motor.
Sounds like your interrupt pins are floating except when the switch is pressed.
A simple schematic drawing of your setup is way more telling than a thousand words. I still can not picture the whole setup. I also don't really understand how you use a single relay to control a stepper motor.
A floating pin may indeed be (part of) the problem, that's a common cause of random triggers.