Powering Arduino and Motor from one power source

Hello!

I'm making a self balancing robot and wondered how could I power both the Arduino and the motor with one battery. I know it's not optimal to have a common power source but due to weight and space issues it's not really possible for me to have a different battery just for the Arduino. When I switch the power on the voltage jumps above the configured 7.5V to over 12V but after the arduino boots it goes back to 7.5V. The problem is that this short voltage spike bugs the arduino and I need to press the reset button after every time I power on the device. After that everything works like normal, no problem even after hours of continous working. Can you tell me what's wrong with my wiring or how could I solve this issue?. Thanks in advance!

What's that diode doing in the GND lead of the Nano? Depending on the diode you use, it will lift the Nano's GND by 0.25-0.75V vs. the motor module. Same story with the diode in the 3.7>7.5V buck-boost converter - what's it doing there? These things only complicate matters.

Btw, why not just use a 3.7 > 5V buck-boost and bypass the Nano's linear regulator? It's only dissipating power as it is. Not much, but why have use it anyway if it's not necessary.

Where are the connections between the Nano, the level shifter and the MPU6050? I only see what seems to be GND.

Anyway, as to your problem, there's a likelihood your juggling with diodes is causing problems or at least contributing to it. Perhaps you've already included the cap between the Vin on the Nano and its (lifted) GND, but what value is it? If it's smaller than, say, 10uF, try something like 100uF or bigger.
If all else fails, you could include a small RC circuit on the Reset pin. Since a 1k (possibly depending on the Nano version you use) pullup is already present, you might try something like 1uF parallel to the Nano's reset button. This will hold Reset low for a bit as the power supply stabilizes. DC-DC converters do sometimes exhibit startup behavior that microcontroller's don't like.

Thanks Koraks! I put the diodes in for reverse current protection. I know it's not the best way but the circuit worked just like this before i put them in.

I have much more headroom if I supply the linear regulator as it can take 7-12V with no problem. The spike would have fried the board already.

It's a 470uF capacitor so it shouldn't a problem.

The mpu and level shifter connection is pretty standard and the problem occurs even if the level shifter and the board is not connected that's why I didn't bother to explain it further.

The reset pin is a good idea I will try that. Thanks!

I solved it by doing a simple software reset on every first start up.

digitalWrite(ResetPin,1);
reset = EEPROM.read(0);
if(reset == 0)
{
EEPROM.write(0, 1);
delay(50);
pinMode(ResetPIN, OUTPUT);
digitalWrite(ResetPIN,0);
}
EEPROM.write(0, 0);

Bit of a bootleg way to do it but it works. Thanks.