How to stop my motor from resetting my microcontroller?
Separate the microcontroller DC supply from the motor supply, with a schottkey diode and a large capacitor on the microcontroller side. This should allow it to ride out short voltage dips on the main supply. 

You should do this before the 5V regulator, then the microcontroller will have a completely stable DC supply.