rimagui:
As I told you,
The Arduino is always connected to the supply using an independent transformer.
Yes you have said that,
But just because the Arduino is using an independent transformer doesn't mean it is always powerd.
You never said whether or not the power to it was being switched over as well.
It was not until just now that you said:
Arduino, lcd and rtc is permanently powered.
So far you are slowly dribbling out details. Details that matter.
For example, initially you only said that things failed after running for a while and that some relays were involved.
Then you mentioned this strange power switchover that happens at 4PM.
On the other hand, there are another connections to power supply, which are used to power the other devices. This supply is which change every day.
During the switching, only the power of the devices switches.
You have also mentioned 220 VAC and 24VDC but I still can not fully figure out how things are hooked up and controlled.
The term "power supply" and "transformer" are vague as those could mean many different things and seem to mean different things when you are describing things.
Using the words "220 VAC"or "mains power" might be more helpful if you really mean mains power.
And then there is the term "power supply" which could mean mains power, AC stepped down transformer power, 24VDC or perhaps something else.
For example, I still have no idea how your are actually powering your Arduino.
24VDC is too much voltage for the Arduino but that is all you have mentioned so far.
And I can't tell if you are just switching over the 220VAC power for the pump or are switching over all the power between the apartments. i.e one apartment loses power when the other gets power.
And then when does it switch back, or does the power switch back and forth each day and stay connected for 24 hours?
I'm having to make some assumptions about how you have things hooked up and are controlling things which is not good as it may be incorrect.
And I really don't like guessing as it wastes time.
It sounds like you are using the Arduino to control a relay that is controlling a contactor that is switching some amount of 220VAC at 4PM.
But what isn't clear is what loads are on that 220VAC when this switching is happening.
I think a drawing of how this is all hooked up would help explain things better.
From my perspective, there are still lots of unknown details,
but suspicion is that you have a fairly large load on the 220VAC power when the switching is occurring so you are getting a spike on the mains power and perhaps even across relays controlled by the Arduino or even the contactor.
This may be causing a power spike on the 220VAC power that is connected to the power supply that is powering the Arduino.
--- bill