I have some electrical issues with a circuit and could really use some advice.
I have made an ATmega328 based custom board that controls an ancient motor for an electric garage door. Circuit attached.
The door motor has a builtin controller that starts or reverses the motor when two external connectors are shorted. Just a brief pulse is needed to start the door or to make it reverse if it was already running.
The voltage at the connectors is 24VAC. The continuous current going through when I keep the pins shorted is 700mA. I don't have a possibility to measure any spikes.
What I'm trying to do is to use a small relay to short the connectors on the motor. Relay datasheet: http://documents.tycoelectronics.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=108-98007&DocType=SS&DocLang=EN
It's possible to close the relay briefly to open and close the door just as I want but I'm suffering from spikes that makes the ATmega go crazy from time to time. In some cases it just resets the ATmega but sometimes it triggers my interrupts that should normally only be triggered by a push button (S1 in the schematic). Sometimes it hangs until power is removed.
I'm driving my relay with an NPN transistor, I'm using a flyback diode on the relay coil and I have coupling capacitors on the ATmega and on my voltage regulator but I wonder if it's enough.
Oddly enough I don't even have to trigger the motor using my relay to experience these problems.
If I open or close the door using a manual switch (S2 in the schematics) or if I short the connectors on the motor I experience the same thing.
I suspected that I could be suffering from noise on the power supply because the motor and the wall wart for my Arduino is in the same outlet but I have tried running the Arduino from batteries without any difference.
Any recommendation would be highly appreciated.