Using that algorithm after the relay activation would have to be followed by the rest of the initialization procedure.
No, it didn't help you, possibly because you didn't do it correctly.
What you are doing is delaying the sending of any commands by the LCD controller until after those transients have died down.
I've built a thermostat that works as I want it, except that the LCD goes bananas sometimes (not always) when the relay switches between on and off (which connects/disconnects a freezer). Thought I'd post it here, to see if anyone else has seen this kind of behavior (see attachement).
What happens with any unchanging information written in setup() when you use this method? I thought the display controller memory was getting scrambled, and the gibberish on the display was independent of any new data being written.
Note that the root cause has not been fixed by inserting a delay, it is just stopping the noise from affecting communication by ignoring it for a while. This is a bit like driving a car and finding you hear a loud bang when the brakes are put on, the solution is not to get some ear plugs and carry on driving!
Well the option of placing capacitors everywhere is also just preventing the noice from reaching the microcontroller, plus it doesnt really seem to work for anyone.
The only way to fix the spark in the relay is to like add some complicated timing so that it only breaks the current at zero-crossing, or does these arc suppressor prevent the arc, or just prevent the disturbance from reaching outside the relay?