Voltage drop resets Atmega328P

I'm not much of an electronics engineer when it comes to this. I would put a solid electrolytic capacitor (470uF, possibly more) close to the microcontroller.

Note:
your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.