I've finished my first IoT project based on Arduino Yun. It's a remote control for my sauna. Everything is working as expected in test mode (relay is not connected to contactor so there is no real load), I was able to test this system for hours without any problems.
When I hook up contactor to relay, it turns the heater on and off, and everything seems to be working, but after a while (absolutely random, it could be an hour or a few minutes) LCD screen freezes, or sometimes, starts flashing random symbols, server is not responding to commands, rotary encoder isn't working and it seems Arduino freezes. The only workaround is to turn off the power and reset the system. After it restarts, everything is back to normal.
What are your suggestions? Why is it acting up like this under the load? What should I do to debug it?
P.S. I'm deploying release bits to Arduino over network
Post your code - although it sounds more like a wiring issue; is the relay module opto-isolated from the Yun? Another possibility is that your power supply is getting pulled down when the heater kicks in - can you power it from battery as a test?
It would be my guess the issue is not in the code but in the sensitivity of µcontrollers to fast voltage spikes.
Most likely when you open your contactor voltage spikes are generated as the contacts open (there will be some arcing).
The best approach is to filter the I/O lines using capacitors.
Based on your diagram I would start with:
Lines from the power supply (both power and gnd)
Lines to the Door and Temp sensor
Lines to the relay board (all three).
The capacitor should be grounded as close to the Arduino power ground as possible and all go the the same point. Also, lead length is not your friend, keep the capacitor leads very short. I would start with 0.01µF capacitors.
If you have room, you could make a voltage spike (EMI) barrier. See the attached.
In addition, I would look into the watchdog function on the processor.