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!