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):

Wiring diagram

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.


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.

  • \$\begingroup\$ Do you have a multimeter with MIN/MAX mode? That's a very useful function for seeing if there's any voltage droop or swell on the power rail during the events of interest, almost as useful as an oscilloscope and much, much cheaper. \$\endgroup\$
    – Ben Voigt
    Jun 10, 2022 at 21:41
  • \$\begingroup\$ @BenVoigt I do have a multimeter, but sadly, it doesn't have a MIN/MAX mode \$\endgroup\$
    – F.Carette
    Jun 10, 2022 at 21:43
  • \$\begingroup\$ hmmm. If you have a diode and a capacitor, you could make a simple latching peak detector. You'll also want a resistor to short across the diode in order to reset it. By changing the diode polarity, you can capture either min or max peak \$\endgroup\$
    – Ben Voigt
    Jun 10, 2022 at 21:45
  • 4
    \$\begingroup\$ So you are powering that from a USB power bank? Some of them turn off after a phone has ended charge. When pump turns off, the powerbank determines it is now time to turn off. They are not intended to power arbitrary loads but to charge phones. \$\endgroup\$
    – Justme
    Jun 10, 2022 at 21:45
  • 1
    \$\begingroup\$ @Justme I'm indeed powering from a USB power bank. This could totally be the reason it stops after the pump turns off. Thanks for the tips :) \$\endgroup\$
    – F.Carette
    Jun 10, 2022 at 21:47

1 Answer 1


OFTEN issues like this are caused by inductive spikes which occur when coils are powered off. These produce spikes on the power wiring and cause processor maloperation.

If not already installed, add a reverse biased diode across each coil, mounted as electrically near the coil as possible.

Report back.

JustMe notes that USB "power banks" often/usuallu turn off their outputs when current drain drops below a preset level for a preset period. However, as your system sounds as if it runs indeflintely under computer load prior to solenoid activation this does not sound like an overly likely cause.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.