Power problem and what to use besides relay

Hello,

I have made my first usable sketch. It waters plants when the soil is dry.
Pretty simple, using a moisture sensor and relay to toggle a pump for xx seconds if moisture sensor falls below a threshold.
Cool.

It works when using separate power to run the pump and arduino nano, but if I try to power the pump and the arduino from the same power source, the arduino resets when the pump turns on. I've tried using both analog and digital outputs, high power inputs... no difference.

Am I missing amps? There must be a way I can use one power supply for both purposes?

Also, is there something smaller, cheaper, I can use rather than a relay to turn the pump on/off ? using between 7 and 9 volts

thanks!

It is most likely the interference from your motor. If not the the power supply could be being dragged down by the motor. Have you measured the voltage when the motor turns on? What current does the motor take? What current capacity is your supply?

How long is the wire from the circuit and pump to the supply ? a long wire will act as an inductor and when the pump comes on there will be a sudden demand for current and the inductance in the wire will slowly allow current to increase so the result is the voltage dips and resets the arduino. you need a really large capacitor in parallel with the project or better put a diode in series with the arduino and put a small to medium capacitor after the diode on your arduino. The capacitor will hold enough current to deal with the dip and the diode will stop the capacitor supplying current to the pump instead.