Arduino hangs due to EMI

I’m sorry I don’t know how to do it. Anyway it’s very simple I connected DC in to Vin and ground, also DC in jack supplies the relay module. Vout 5V and ground from Arduino to the RTC and the display. A04 and A05 supply clock and data to both modules. Pin 7 as an output controls the relay operation.