Using an Arduino Uno. Problem is submersible pumps on a timer fail to restart after a couple of run-delay cycles.
They're cheap Ebay submersible 3-6v DC pumps (no other spec's included i'm afraid) & work every time when connected to 5V but I want to control 4 separately on different timers so must use the digital pins & after a couple of cycles fail to ever restart again. Have tried all digital pins & I tend to get 1-5 run-delays before they stop altogether.
Could this be insufficient startup current through the digital pins? Voltage sure seems less through these than the 5V output.
Also, iff insufficient startup current, I will buy a 4xAA battery pack & connect to the breadboard. Any suggestions for an elegant way to wire up the board to distribute power on timers to different pumps? Transistors?
Digital pins are not intended to drive motors. Get some transistors and power supply, the Arduino can control the transistors to turn the pumps on & off.
Thanks for keeping me on track guys. I went out & bought 4xAA power pack today & now have all (2 so far) motors running with diodes & transistors in place (digital --> base).
I have a new couple of issues now as I progress:
A)- I have one motor run as per code for 5 seconds then switch off. So far so good.
B1)- Then, the second is meant to run for 6 seconds then switch off, but the first motor comes in about 1 second into the second motor's cycle & starts running again. Not to mention the second motor usually does nothing more than pump for a quick, transient burst.
B2) Or sometimes after the first pump runs they both start running & won't stop!
We need to see your code. Please read the "how to use the forum" stickies to see how to format and post your code. Also, please describe how the sketch is supposed to work.
This may help solve your timing problems.
And this for program structure.
The fact that it keeps printing VOID SETUP would indicate your board keeps re-setting, since that's the only way the code will get back into setup(). That might be due to some problem with current, in spite of you using a transistor. So let's see your circuit diagram....
@groundfungus, sorry - i read the code posting rules & will post that way going forwards.
@manor_royal, OK I just read most ppl use Fritzing & created/attached this diagram that shows my what's happening in my project. (not sure if you can embed pic's, asks for 'url'?)
There are 2 totally separate motors running, no pins or code connect them. For 'fun' i completely switched all of the wires/transistor/diode/motor from one location on the breadboard to the other... so testing if the problem was anything physical... exact same problem - first (previously second) motor runs fine, then when it's the next one's turn all the problems begin! which makes me at least more confident it's not a dodgy transistor/wire etc..
What is the part number of the transistors that you are using? There should be a resistor between the base of the transistor and the Arduino output. 180 to 220 ohms is safe, I think. The resistor limits the current into the base.
According the diagram you don't have resistors on the base pins of the transistors.
I'm no expert, but I understand such a resistor is for limiting current. I don't know what the problem associated with no base resistor is, but it wouldn't surprise me if it's part of yours.
"I don't know what the problem associated with no base resistor is"
The problem is the base of a NPN transistor looks like a diode to Gnd (with NPN's emitter to Gnd).
Diode has ~ 0.7V drop, putting that on the output pin then clamps a high output to 0.7V.
Current will flow until either the larger external transistor blows, or the much smaller internal transistor connecting VCC to the output pin blows. Which do you imagine happens first?
So a resistor is used. (5V - 0.7V)/.025mA = 172, so a 180, 220, 270, in that range should turn on small signal transistors into their saturation range so they can act like a switch. Large signal transistors may need more current to turn full on. MOSFETs are better for large currents as they only need voltage to turn on, and not large currents.
I've added base resistors. I only have 330's, but the exact same problems persist now with resistors in place.
Updated diagram below & to summarise the problems:
1st pump works as per code for 5s, then 2.5s delay.
2nd pump starts on time but either just for a quick transient burst (followed by pump 1 starting up right after), or it keeps running for a long time. Rarely, but sometimes it will run for the correct 6s.
I would suggest trying different pins to the transistor bases. Pins 3 and 5 might have been damaged by driving the transistor bases without resistors. That is kind of a guess, but all I got.
@groundfungus, thank you so much for the tip. A couple of pins that I haven't used before work perfectly... at least after 3 runs through a few cycles each the project works as expected.
It seems that I have damaged at least two digital pins on my board.
Is there any way aside from buying a new Arduino Uno to fix the broken pins?