I've got a 3-12V water pump, a raspberry pi, a relay (5V 10A/120VAC, and a breadboard power supply supply 3V-5V.

The questions are :

Is it possible, to rspi to breadboard power supply usb, and a pump to it's 5V output? I don't want to burn rspi 5V, but I'm assuming that when I connect it to independent power supply on breadboard, I can have a nice and safe solution with just one DC cable, am I right?

I also have 4*1.5V AA batteries pack, which I can also use for powering the water pump, but still don't know what's the better & safer solution, and I can't find any tips on connecting this. Can I connect a 6V batteries pack to 5V relay?

What's the best solution guys? I'm very happy that I found this small pump which should be flexible, but don't know how to bite this topic in a best way without crashing any component.

3 Answers 3


It will be best to power the Raspberry Pi using a good 2Amp power supply.

You will still need a transistor to drive the relay.

enter image description here

But really relays are for high power, 24volts up to 220volts and heavy loads that use dedicated power supplies not connected to Micro controllers.

You can get rid of the relay and just use a 2N2222 / TIP127 transistor to drive the motor in one direction. Use a Diode for flyback protection across the motor.

enter image description here

To be able to drive it forward or backwards you create a simple H-Bridge with 3 more transistors and 1 extra GPIO.

enter image description here


I used a simple solid state optical relay to drive a 12V solenoid. You can find details here: https://spin.atomicobject.com/2014/06/28/raspberry-pi-gardening/

  • Your project? Its awesome. I also like the optical relay you linked. Looks like a easy way to switch stuff :)
    – WillyWonka
    Jul 21, 2014 at 9:04
  • Thanks Willy, I'm currently working on a custom PCB to power both the solenoid and pi off a single 12V power supply with a nice shutdown button as well.
    – shawn42
    Jul 28, 2014 at 6:39

The simplest thing you can do is to use optocoupler. This allows you to power the pump with whatever voltage you like without any electrical connection between your Pi and pump and you will be still able to control it from Pi.

Check this video for example: https://www.youtube.com/watch?v=pYENAGK8qH4

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.