I am using a 12v DC water pump with a 20 l/min flow rate, a raspberry pi 3B and a distance sensor. I would like to use a relay and an external power supply to control turning on/off the water pump. so the idea would somehow be like: when distance > = ____, the water pump is turned on.

I am not sure what kind of relay and power supply should I use. Maybe a 5v relay and a 12v power supply with a raspberry pi? Will that work...?

Here is a graph of how the setup might look like an example from this website). The difference is that this example uses a 5v waterpump, which is compatible with a 5v relay and power supply. image What kind of voltage output of the relay and the power supply would work for my case? Thank you very much in advance.

1 Answer 1


12V pump will require 12V PSU. 20LPM is a pretty reasonable flow rate for a small pump so your pump PSU will need to have enough power to drive the pump - check the max current draw on startup (which will be higher than the running power draw) and size the PSU accordingly.

Check the contact handling voltage/current for your relays.

"5V" relays (as described) are more likely to be "5V trigger" (i.e. the coil requires a 5V signal to activate) rather than 5V contact (which would be a very small relay contact voltage). Most relays will have contacts rated with both a maximum voltage (V) and maximum power handling (VA). The maximum power handling for your contacts needs to be higher than the maximum power draw for your pump (as previously noted - this usually occurs on startup). I would factor in at least twice the "running power" requirement if you don't have startup power specs.

Also note that the contact PSU must be fully isolated from the RPi PSU. This is how most of the relay HATS are designed - as it protects the RPi from overvoltage. Also a small flyback diode (watch polarity on DC) will help to protect from transients (voltage spikes) that can be created when the contacts open/close. This may already (read should) be supplied on the relay HAT if properly designed.

Looking at the spec sheet (http://www.circuitbasics.com/wp-content/uploads/2015/11/SRD-05VDC-SL-C-Datasheet.pdf) for the relay blocks supplied in the image (SONGLE SRD-05VDC-SL-C) the relay is 5VDC trigger but the contacts are capable of handling :

Resistive loads : 7A/28VDC 10A/120VAC

Capacitative Loads : 3A/28VDC 3A/120VAC

Max Power : 800VAC/240W

So, if your motor falls within these specs (i.e. less than 240W power draw on startup) you should be able to use the circuit in the image. Just swap the 5V pump PSU for a 12V PSU and the 5V pump for a 12V pump.

  • Thank you very much for your detailed answer! Your answer solved my question, thank you again.
    – Juye C
    Jan 2, 2020 at 22:08
  • May I ask you another question please? I decide to connect a 12V 5A power supply and my pump works at 35w to 45 w. I would like to wiring up the pump with a dc cord adapter connector(pigtails) and connect the connector with the adapter. On Amazon it says that the connector works at 12V 5A but only gives a max. of 48W.....If I connect it with the 12V 5A (60W)power supply, will it work out?
    – Juye C
    Jan 2, 2020 at 22:12
  • I am not sure why the max. power output of the pigtail adapter connector is 48W..
    – Juye C
    Jan 2, 2020 at 22:13
  • You say you're running a DC pump - so I'm going to assume the PSU is 12VDC. The pump will only draw the current it needs to run (so about 3 - 4 AMPS@ 12V) - the connector is rated at 48W (so 4 amps @ 12 V) - so the connector should be fine (but may get warm). Be careful of dead shorts - the PSU will then dump its full load via the short (>5 amps @ 12V) and the connector could become compromised depending on where the short is. The pigtale adaptor probably has limited internal power dissipation capacity - hence the 48W (4amp@12V) limit. Jan 2, 2020 at 22:17
  • Health Thank you very much! So...In conclusion, it is suitable to purchase a 12V 5A power supply and a 12V 5A connector(can't find ones with 4A), right?If the power output of the dc adapter (60w) is larger than that of the connector(48w-60w I assume), will it still be fine?
    – Juye C
    Jan 2, 2020 at 22:24

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.