2

So, I would like to connect a water pump to my Pi and programatically turn the pump on and off.

I am looking at this pump: http://www.cooking-hacks.com/immersible-pump-water-tube-for-open-garden-and-open-aquarium

It says "3.5-12V DC input voltage".

Does this mean that setting this up would be as easy as connecting the positive end of the pump to a programmable GPIO pin (and have then negative side going to ground) and setting the pin high to turn the pump on and low to turn it off? Here is a quick diagram I (very quickly) threw together.

enter image description here

I am sure this is too simple because most people i see are using all sorts of extras like resistors or motor driver chips, etc.

Main Question: So is it as simple as I think? If not, could some explain why it won't work this way?

Bonus Question: If not, could someone explain how I would hook it up?

In Reference to Question Powering a 3-12V water pump on raspberry pi

I saw this question and couldn't quite make sense of what the OP was asking. In this scenario I have no relay or a breadboard power supply (unless the OP is referring to getting power from one of the GPIO pins). What really threw me off though was the sentence "Is it possible, to rspi to breadboard power supply usb, and a pump to it's 5V output?"

I am not sure if rspi is a type-o or an acronym but I don't know what that means. And I am not sure what a breadboard power supply usb is either or if it is even one thing. And wouldn't plugging the pump into the 5V output just constantly turn on the pump?

So I did see this question I just wasn't really sure how much of it was applicable.

It would be awesome if someone could explain/edit that question (That is if I'm not just being stupid and not understanding his question).

TheBlindSpring
  • 179
  • 2
  • 9

2 Answers2

5

NO. That setup won't work. The GPIO pins are not suitable to drive equipment directly, due to the fact that:

  1. They can only provide a very limited current (up to 50mA, although this might be higher on the rPi2)
  2. They have no protection against flyback currents etc., so driving a load with a motor or relay in it will possibly kill your rPi

You will need the following:

  • A suitable powersupply to provide sufficient current to the pump. Given the broad range of voltages the pump accepts, you could get 1 powersupply at 5V and supply both the rPi as well as the pump from this supply. Whatever you do, make sure the grounds of your rPi and your pump are connected together (especially if you use separate power supplies).
    • A relay to switch the pump (you don't mention the Amp rating of the pump, so I can only guess the specifications here)
    • If the switching current for the relay is too high for the GPIO pins, you might need to put a transistor in in between the relay and the GPIO pins to help switch the relay. If the power needs of the relay are not too big, you could potentially switch the pump with just the transistor.
    • A resistor (typically 10kOhm) on the GPIO line to further limit the current on that line to avoid overloading the GPIO pin.
    • Depending on the make and model of the pump, you might need to put a flyback diode across its + and - terminals - this will allow the flyback current generated by the dead weight of the motor to flow safely back into the motor itself
    • A flyback diode across the relay for the same reasons as above.

Net - this is not straightforward (but also not difficult). You might get better answers on the Electrical Engineering Stackexchange site - however, they will not design this for you - there are tons of people doing aquarium pumps with Pi's/Arduino's so you should easily find reference designs in a quick Google search (e.g. this one)

Phil B.
  • 5,053
  • 17
  • 30
0

Google is your friend and should be your first stop. Be sure to choose Images as you will get schematics and pictures that can lead to the hosting page. Most solution issues with I/O apply to RPi and Ardunio equally. The output pins similar have limits. Exceeding them will damage the controller.

Here is an example of a Google search for your issue. You can find many more yourself. https://electronics.stackexchange.com/questions/64575/turning-water-pump-on-off-using-arduino-uno-r3 Also several sites that sell RPi and Ardunio boards and shields offer tutorials for free that advance your knowledge base.