Hi. I've been working on this project of a system that takes care of a plant: its water and light. I'm having an issue: the system resets itself each certain time. Sometimes I've catched the reset and what happens is that the LCD is cleared, then it starts filling up with complete dark characters until the reset as such happens and the program starts again. I don't know if this issue is due to a hardware failure / miss connection or due to a software bug. I first wanted to generally ask like under which circunstances a reset would occur. I'm not sure how to procede in these kind of bugs. I thought about sharing the circuit diagram, to check in case I have connected something wrong. If the connections are ok then I'd procede to post the code. I'm also looking forward debugging the code, it would be my first time for Arduino and would use Visual Code + Arduino extension.
The program / system already works with some features like: sensors, automatic or manual control for light and plump (their relay), access using push buttons and LCD, access through ethernet and it shows the time/date in the main screen.
Arduino Mega 2560
Ethernet shield W5100
Soil Moisture Sensor FC-28
Temperature and humidity sensor DHT22
2 Channel 5V Relay Module
Real time clock RTC DS1302
LM7805 voltage regulator
3 push buttons
EDIT, the whole system working drains about 400 mA. I'm powering everything with a 9v 1A AC/DC adapter: The board through its power jack and other parts through a LM7805 voltage regulator. The NO/NC relay pins are not connected yet. JD-Vcc jumper is ON (the idea is to switch on/off an AC 110v lamp).
EDIT. Here the schematic by sugestion of PaulRB:
I'm sorry if there are any typos, I'm from Colombia. Thanks a lot for the help.
EDIT. I forgot to mention that long time ago I had experienced issues connecting the board to the IDE programmer due to the ethernet shield. The solution at that time was to bend the ethernet shield's reset pin so it wouldn't be wired to the Arduino one and to do the same with ICSP reset pin as well. I wonder if this pin manipulation could be causing somehow the unwanted resets.