relay board issue

I hooked up a seeed relay board to my pi using the John M. Wargo write-up, and everything worked great. I currently have nothing else hooked to the GPIO pins besides the seeed board. I am using a usb keyboard and mouse, as well as an HDMI monitor.



I can turn all 4 relays on and off using my python code as needed and never have any trouble whatsoever. However, after adding 12 volts DC (via a wall-wart style transformer) to the screw terminal side of the relays for controlling some simple 12v linear actuators, my program occasionally crashes due to random loss of communication with the relay board via I2C. Note that it is random, sometimes I can fire the relays and connected actuators 25 times on and off with no problems, other times perhaps it will only be a few times before i loose connection with the relay board.



The only way to regain connection is a complete shutdown/start cycle, rebooting does not solve the issue.

Also worth noting is that if I disconnect my linear actuators, the program runs indefinitely without issue, even with the 12v power supply still connected to the screw terminals.

In addition, I experimented with a lower voltage power supply (7v DC transformer), which was still able to throw my actuators, and the random connected loss is still present.



Any help would be appreciated.



Thanks,

rob

i think i solved the problem using flyback clamping diodes. i ran a few hundred cycles with the added clamping diodes and it seems to have fixed the problem.



in doing some reading, I believe there was some type of EMP or motor induction issue when the contacts of the relay were abruptly opened.



i came across a few other similar situations in looking at forums for some similar products. this particular thread did a pretty good job of explaining the problem and fix if anyone else comes across this problem… <LINK_TEXT text=“https://www.raspberrypi.org/forums/view … p?t=138427”>https://www.raspberrypi.org/forums/viewtopic.php?t=138427</LINK_TEXT>