Why does my Arduino sometimes glitch up?

Alright, here's a crude Wiring Schematic I made on Tinkercad. And just in case you need clarification I used a much smaller 6 pin relay that can be turned on just by the arduino pin. Also this battery is what I used for the CNC shield to power the CNC shield which has an input voltage range from 12V-36V. Here's some of the only data I could find on the shield CNC-Shield and then if you need it here's some for the DRV8825.

I know there are some capacitors included in the shield for the DRV8825 drivers but other than that I did not use any capacitors in my circuit.