Context:
I'm trying to automate my plants watering. For this, I'm using an arduino nano, 3 moisture sensor and 3 pumps. To separate the power (pumps) and the control (arduino output), I'm using S8050 NPN transistors. The Arduino is powered by USB, connected to an external battery (USB output 1). The power is connected to the same external battery, but from a separate output (I basically dissected an USB cable, and plugged one side on USB output 2, and the other side to + and - on my breadboard). I connected the ground pin of the Arduino to the ground of the power
The wiring looks like this (sorry about the watermark, I used the first free wiring diagram maker I could find):
The code is very simple: if one sensor detects a too low moisture, it activate the corresponding pump for 5 seconds, else, it just waits 1 second and check again. I made sure the pumps only run one after the other.
Problem:
Everything works fine until a pump is activated. Then, it pumps water for 5 seconds as expected, turns the pump off, and after a few seconds, the external battery seems to turn off (both the Arduino and the sensor leds goes off). Most of the time, it will restart, but once in a while, I have to manually restart it by pressing the power button.
My wild guess is that I'm missing either a pull-up/pull-down resistor or an anti return led somewhere, but I'm not an electronics expert, and I rather have some advice from more experienced people.
Disclaimer: I'm new to electronics.stackexchange and I'm not yet familiar with it. If this question doesn't meet the site standards, please provide feedback on how to improve it.