edit -added pin 9 as output in setup and now HIGH/LOW code works. -When the pump is set to LOW it turns on, when it goes HIGH it is disabled. So when I plug the arduino in, by default the pump turns on before it reads any code. Is there anyway to set a pin to HIGH (by default) so that it doesn't pump when plugged in? ...I talked with the manufacture again, and it seems like they sell another model that doesn't pump when it's low... so for now, they suggested putting an on/off switch between the red wire and 5V pin.

end of edit

I'm trying to control a 5V piezo pump (micro pump) with my Arduino uno, but I'm having some difficulty getting it to work properly. This is the pump I'm using.

I'm not sure if I should be using a separate power supply to run the pump, or if I can get away with using the 5V pin from the arduino. The pump uses 0.05-0.25W... so at 5 V, it should have a max current draw of 50mA. Would a resistor be enough to protect the arduino and run the pump (I'm using a 470 ohm resistor, not sure if it should be more of less)? The pump has a red wire(5V), black wire (grd), and a yellow wire (PWM control).

This is the code I'm using (trying to turn the pump on then off)... the code worked when I left the yellow wire unattached and sent the black wire through an N-Channel MOSFET... but it pumped very slowly. When I hook up the pump like the picture below, it runs loud for a second, then slightly less loud for a second and repeats... (it just pumps then sputters)

The manufacture told me I need to program PWM with certain duty ratio per 1 second period and that the pump is set to operate at a default frequency of 50Hz.

void loop() {
tone(9, 50, 1000);  // 9=PWM pin, 50 = freq (Hz), 1000 = hold freq. for 1 sec.

noTone;             //turn pump off

I also tried this to no avail (assuming that it would run at the default 50Hz when set HIGH/LOW)

void setup{

void loop() {

Any help in getting this to work would be greatly appreciated. Thanks!

enter image description here

  • \$\begingroup\$ What actually happened what you simply set the pin high/low? \$\endgroup\$ – brhans Apr 7 '15 at 20:22
  • \$\begingroup\$ The pump just stays on and continues pumping. \$\endgroup\$ – Matty D Apr 7 '15 at 20:36
  • \$\begingroup\$ I don't see any need for the resistor. The yellow wire is just a control signal and shouldn't draw much current from your arduino - so the resistor shouldn't be necessary. But by the same reasoning it also shouldn't have a negative effect ... I'd still try without it though. \$\endgroup\$ – brhans Apr 7 '15 at 20:41
  • \$\begingroup\$ ooops... didn't set pin 9 as an output in the setup :S sorry.. The HIGH/LOW code seems to be working now lol (without the resistor). But, not the tone example.... maybe I can't change the frequency with the version I have (fixed flow rate STD version)? About the resistor though, if it reaches 50mA, isn't that bad for the pin? People usually recommend 20mA (with 40mA being the absolute maximum). \$\endgroup\$ – Matty D Apr 7 '15 at 20:59
  • \$\begingroup\$ The 50mA supply current for the pump should be flowing through the red/black wires, not the yellow. \$\endgroup\$ – brhans Apr 7 '15 at 21:04

Default pin state on reset for the ATMega328P is input tri-state. Therefore, adding an external pull-up resistor to the signal line will keep it HIGH at startup. Connect a 10K - 100K resistor from the yellow wire pin to 5V.


pinMode(9,OUTPUT); enables the output, however startup config is LOW. Try:

pinMode(9, OUTPUT); 


N-Channel MOSFET between black wire and ground. Connect gate to digital IO pin on board. Pull down pin using 10K resistor to ground. Now setting pin HIGH will turn on MOSFET and allow current to flow through pump. Problem with this approach is there is another current path through the signal wire so even if the MOSFET is off it could still run.

  • \$\begingroup\$ Connect yellow wire to 10K resistor, pin 9 and 5V? and have black to ground and red to 5V? \$\endgroup\$ – Matty D Apr 8 '15 at 0:49
  • \$\begingroup\$ I a little hesitant to try that before making sure that's what you meant... I talked with the manufacture again, and it seems like they sell another model that doesn't pump when it's low... so for now, they suggested putting a switch in between the red wire and 5V pin, which would work too I guess. \$\endgroup\$ – Matty D Apr 8 '15 at 4:17
  • \$\begingroup\$ All of your existing wires stay as-is. You add the 10k resistor with one leg on pin-9/yellow and the other leg on 5V/red. This has the effect that when your arduino isn't actively driving pin 9, it will be gently pulled up to 5V. \$\endgroup\$ – brhans Apr 8 '15 at 12:45
  • \$\begingroup\$ hmm... it still seems to be doing the same thing with a 10K resistor in between the yellow and red wires. I tried a 1M ohm resistor too, and it still seems to do the same thing. Maybe it's something to do with the internal driver of the pump? Or maybe 10K is too high? \$\endgroup\$ – Matty D Apr 9 '15 at 18:59
  • \$\begingroup\$ 10K isn't too high. Possible pinMode(9,OUTPUT) pulls the pin low. See answer above. \$\endgroup\$ – geometrikal Apr 10 '15 at 1:15

The pump´s datasheet is not very clear, in some cases it refers to a 12 V input. I would try to get better information. With more precise wiring diagrams we can help you. Regarding the 470 ohms resistor, it doesn´t seem necessary, but won´t hurt if keeping it.

  • \$\begingroup\$ 470 seems to be too much... Now that it's working with the high/low code, it pumps out one drop when it's supposed to be off. 220 seems to be fine though. :) \$\endgroup\$ – Matty D Apr 7 '15 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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