user63649: I'm building a system as follows:

There are two pumps which lower and raise the level of the water
There is an ultrasound detector which measures the level of the water
While the water is too high, water is pumped out
While it's too low, water is pumped in

There are thresholds to prevent micro-adjustments, the system doesn't flip-flop back and forth.
However after a short while the ultrasound sensor stops working, until I power the system off and on again. My electronics knowledge is extremely rudimentary, but I know motors can be nasty to other components?
I've included my circuit diagram, should I be doing anything about that? I'm using reed switches to turn them off and on, but the ground and 5v rails are all tied together, and powering the arduino too via VIN.


user75880: Motors are inductive loads (they contain coils) that generate voltage spikes when switched off. These voltage spikes can indeed be nasty to other components.
You need to add a flyback diode in parallel with the motor, with the cathode connected to Vcc.
It will normally not conduct current, but when the motor is switched off, because the voltage spike is negative, it will provide a path for the current and allow to dissipate it through the coil's internal resistance.
As pointed out in the comments, it's also a good idea to (always) add an electrolytic capacitor (> 100 µF) close to the ultrasonic detector to filter out this kind of spikes.

63649: <p>I'm building a system as follows:</p>
<ul>
<li>There are two pumps which lower and raise the level of the water</li>
<li>There is an ultrasound detector which measures the level of the water</li>
<li>While the water is too high, water is pumped out</li>
<li>While it's too low, water is pumped in</li>
</ul>
<p>There are thresholds to prevent micro-adjustments, the system doesn't flip-flop back and forth.</p>
<p>However after a short while the ultrasound sensor stops working, until I power the system off and on again. My electronics knowledge is <em>extremely</em> rudimentary, but I know motors can be nasty to other components?</p>
<p>I've included my circuit diagram, should I be doing anything about that? I'm using reed switches to turn them off and on, but the ground and 5v rails are all tied together, and powering the arduino too via VIN.</p>
<p><a href="https://i.stack.imgur.com/eSU4s.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eSU4s.png" alt="enter image description here" /></a></p>
 75880: <p>Motors are inductive loads (they contain coils) that generate voltage spikes when switched off. These voltage spikes can indeed be nasty to other components.<br />
You need to add a <strong><a href="https://en.wikipedia.org/wiki/Flyback_diode" rel="nofollow noreferrer">flyback diode</a></strong> in parallel with the motor, with the cathode connected to Vcc.<br />
It will normally not conduct current, but when the motor is switched off, because the voltage spike is negative, it will provide a path for the current and allow to dissipate it through the coil's internal resistance.</p>
<p>As pointed out in the comments, it's also a good idea to (always) add an electrolytic capacitor (&gt; 100 µF) close to the ultrasonic detector to filter out this kind of spikes.</p>
