Most “my project works on USB but not on battery” problems are power problems. Here is the short version of what we explain at the shop every week.
Separate logic and motor power
Motors draw large current spikes. Feed them from their own supply through a driver, and share only the ground with your microcontroller.
Use a buck converter, not a resistor
An LM2596 steps 12V down to 5V efficiently. A linear regulator wastes the difference as heat.
Charge lithium cells properly
Always use a TP4056 or a BMS board. Never charge a lithium cell from a plain power supply.








