Maximum consumation Arduino

And there is the whole of your problem. :face_with_raised_eyebrow:

The "Vin" terminal - or the "barrel jack" is simply useless for any serious project.

You need a 5 V regulated supply to power the Mega and all your 5 V devices. Connect the 5 V to the "5V" pin except when connected to a PC via USB.

Do not expect a pin to provide more than about 25 mA.

Just simple rules.

Slight confusion here.

A relay module - which you need in order to control the relay from an Arduino pin - includes a transistor as well as a diode to suppress "kickback" from the relay coil itself. If you are using the relay to control a solenoid (with DC - AC is a different matter) then you really should have a diode across the solenoid coil. You certainly need one with the FET module you cite, as best I know (because it is not properly documented) it does not include one.