1

I'm trying to use a little pump with my arduino nano:

void setup ()
{
  pinMode(waterPump, OUTPUT);
}
...
  while (val < valueWater)
  {
    Serial.println ("in while"); // testing purpose
    digitalWrite(waterPump, HIGH);
    delay(1000); // 1 second
    digitalWrite(waterPump, LOW);
    val = analogRead(sondeEau);
  }

When I try this one, pump isn't working. When I unplug the waterPump pin, I see "LED3" that run, and when I plut it, LED3 is not running, why?

I tried to plug pump directly on 5V on arduino, pump works well...

This is the pump I bought: http://www.dx.com/p/hsyy01-water-pump-motor-w-hose-white-silver-236808

Thanks in advance to help me!

1
  • 2
    You can't plug a motor directly into the arduino, you need an appropriate driver circuit, or for simplicity, a "motor shield". Further, you should not try to a run the motor off of USB power or through the Arduino's voltage regulator. Aug 7, 2014 at 17:42

2 Answers 2

3

You plugged this directly into your Arduino? You might as well have dropped your Arduino in the water you are pumping...

The Arduino can only supply 40mA per pin. However, you pump requires 800 mA!!! Often, when overloading a pin, the Arduino chip is fried. Even worse, a typical USB port can only supply 500 mA, so you could have fried your computer if using USB.

You'll need a motor driver. Like mentioned in the comments, the Arduino motor shield is a great place to start. If you don't to spend all that money, you have a few options:

  • A relay is an easy way that works with almost all voltages and any reasonable amount of current.
  • If you want something a little more professional, a transistor, like a MOSFET would be the way to go. They're fairly cheap, but you have to know which to pick (that's hard to do in practice).
  • You can also get a half H-bridge which I think would work well for your situation.

When I unplug the waterPump pin, I see "LED3" that run, and when I plut it, LED3 is not running, why?

The motor is likely taking up all the current.

tl;dr: get an external power source and get a proper motor driver.

4
  • 1
    Pretty much any logic level power mosfet will do, driven through a 120 ohm resistor. Plus a flyback diode across the motor. I think that's the cheapest and lowest component count solution.
    – user2973
    Aug 7, 2014 at 19:01
  • I would not qualify a relay to "wok with any reasonable amount of current". Using a relay typically implies using a transistor (not a high-current) AND a diode to protect against emf currents.
    – jfpoilpret
    Aug 7, 2014 at 19:32
  • @jfpoilpret I meant that a relay *shield*/break out board might be better than a transistor (as far as ease of use for some users). Aug 7, 2014 at 19:34
  • I used a relay I had and an other power source for the motor. Thanks for your infos, very appreciate!
    – clement
    Aug 8, 2014 at 7:54
4

As Chris says, you should never plug a high current device like a motor directly into a pin on your Arduino. That motor is rated at 800 mA, which is more than you can draw from the entire 5V supply on the Arduino!

The digital pins are rated for 40 mA max, if I remember correctly. You tried to draw 20 times that much. There is a decent chance that you burned out the driver for that digital pin. I would try hooking an LED through a 220 ohm resistor and to ground and see if it still lights up when you send it a HIGH logic signal.

For a simple DC motor you should be able to use a high current transistor and an external power supply to drive it.

Edit: If I were doing this I would use a logic-level MOSFET to drive the pump directly, plus a flyback diode. To use a relay, you will still need a transistor to power the relay coil, AND a flyback diode. Your circuit might look like this:

enter image description here

(Note that I made no attempt to pick the RIGHT kind of diode and transistor. Ignore the part numbers shown in the schematic. I just used the defaults.)

2
  • All is ok, all pin works. I finally used a relay and 5V 2A input source, it works well.
    – clement
    Aug 8, 2014 at 7:52
  • Did you put a flyback diode on the relay? (VERY important!) And are you driving the relay with a transistor? A relay's coil will almost certainly draw more than the 40 mA max from an Arduino digital output pin.
    – Duncan C
    Aug 8, 2014 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.