Connecting a pump for 5-10 seconds
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- jaxelsson
- Posts: 10
- Joined: Mon Nov 27, 2017 11:06 am
Connecting a pump for 5-10 seconds
I'm trying to run a simple mini water pump for 5-10 seconds every time someone presses the button. I know simple, right? But I can't figure out how I need to wire it, or what I'm doing wrong with my current logic. I've hooked it to a MOSFET ...but with the Trinket not having debugging, I have no idea what's going on. Can anyone give me some advice on what I'm missing?
- Attachments
-
- Screen Shot 2023-02-16 at 8.00.28 PM.png (182.72 KiB) Viewed 195 times
-
- 61o7M8ybUXL._AC_SL1500_.jpg (37.07 KiB) Viewed 195 times
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: Connecting a pump for 5-10 seconds
If you post the code you are using, we can have a look.
- jaxelsson
- Posts: 10
- Joined: Mon Nov 27, 2017 11:06 am
Re: Connecting a pump for 5-10 seconds
Code: Select all
#define SWITCH 0
const int PUMP = 1; // the PIN number of the pump control MOSFET
// the setup routine runs once when you press reset:
void setup() {
// initialize the SWITCH pin as an input with a pullup
pinMode(SWITCH, INPUT_PULLUP);
// initialize the PUMP control MOSFET pin as an output
pinMode(PUMP, OUTPUT);
digitalWrite(PUMP, LOW); // Pump off
}
// the loop routine runs over and over again forever:
void loop() {
if (! digitalRead(SWITCH)) { // if the button is pressed
digitalWrite(PUMP, HIGH); // Pump on
delay(5000);
} else {
digitalWrite(PUMP, LOW); // Pump off
}
}
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: Connecting a pump for 5-10 seconds
And how are you powering the Trinket?
Driving a motor of any size from the Trinket's 3.3v pin is a bad idea. The 3.3v regulator on the board is not designed for high current loads.
You also should have a kickback diode wired in parallel with the motor to protect the rest of your circuitry from the inductive kickback from the motor. The diagram below shows the diode.
Driving a motor of any size from the Trinket's 3.3v pin is a bad idea. The 3.3v regulator on the board is not designed for high current loads.
You also should have a kickback diode wired in parallel with the motor to protect the rest of your circuitry from the inductive kickback from the motor. The diagram below shows the diode.
- Attachments
-
- arduino-motor.png (71.05 KiB) Viewed 190 times
- jaxelsson
- Posts: 10
- Joined: Mon Nov 27, 2017 11:06 am
Re: Connecting a pump for 5-10 seconds
I was hoping to power it off the USB via the 3v pin since it's a mini pump (and will only run for a moment) as shown in my Fritzing. And plug it into a wall based USB adapter. The pump is DC3V with a load rated current of 0.18A.
I'm only getting some tiny jerks, but can't tell if the problem is my wiring/thinking or something else. Is my wiring diagram/thinking even correct? Is this not doable at all off the board's 3V? How critical is the diode to testing this out?
I'm only getting some tiny jerks, but can't tell if the problem is my wiring/thinking or something else. Is my wiring diagram/thinking even correct? Is this not doable at all off the board's 3V? How critical is the diode to testing this out?
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: Connecting a pump for 5-10 seconds
Then you should power the motor from the USB pin.I was hoping to power it off the USB v
You are likely overloading the 3.3v regulator, and the lack of a diode is pumping negative voltage spikes back onto the 3.3v rail. Either condition is likely to cause processor resets and eventual damage to the circuitryI'm only getting some tiny jerks
Probably not. And it is totally unnecessary if you are powering from USB. Use the 5v from the USB pin.Is this not doable at all off the board's 3V?
Only as critical as preventing the negative voltage spikes from destroying your MOSFET and Trinket.How critical is the diode to testing this out?
- jaxelsson
- Posts: 10
- Joined: Mon Nov 27, 2017 11:06 am
Re: Connecting a pump for 5-10 seconds
Thank you. Now that you point out the USB pin I feel silly for not even noticing it. Makes sense. So other than that, the Diode is the key? Can you tell me what type it should be for this? See new diagram attached.
- Attachments
-
- Screen Shot 2023-02-16 at 9.27.26 PM.png (196.95 KiB) Viewed 172 times
- jaxelsson
- Posts: 10
- Joined: Mon Nov 27, 2017 11:06 am
Re: Connecting a pump for 5-10 seconds
I’m guessing an IN4001 1 amp 50 Volt diode is the right choice?
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: Connecting a pump for 5-10 seconds
Diode selection is not super-critical. It just needs to be rated for at least the voltage and current it will be seeing. 50V @ 1A is plenty.
Please be positive and constructive with your questions and comments.