# 5v piezo (micropump) with arduino

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.
delay(1000);

noTone;             //turn pump off
delay(1000);
}


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

void setup{
pinMode(9,OUTPUT);}

void loop() {
digitalWrite(9,HIGH);
delay(1000);
digitalWrite(9,LOW);
delay(1000);}


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

• What actually happened what you simply set the pin high/low? – brhans Apr 7 '15 at 20:22
• The pump just stays on and continues pumping. – Matty D Apr 7 '15 at 20:36
• 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. – brhans Apr 7 '15 at 20:41
• 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). – Matty D Apr 7 '15 at 20:59
• The 50mA supply current for the pump should be flowing through the red/black wires, not the yellow. – brhans Apr 7 '15 at 21:04

## 2 Answers

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.

Update:

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

digitalWrite(9,HIGH);
pinMode(9, OUTPUT);


Alternative

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.

• Connect yellow wire to 10K resistor, pin 9 and 5V? and have black to ground and red to 5V? – Matty D Apr 8 '15 at 0:49
• 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. – Matty D Apr 8 '15 at 4:17
• 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. – brhans Apr 8 '15 at 12:45
• 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? – Matty D Apr 9 '15 at 18:59
• 10K isn't too high. Possible pinMode(9,OUTPUT) pulls the pin low. See answer above. – 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.

• 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. :) – Matty D Apr 7 '15 at 21:10