I'm making a timefountain and I want to control the speed of the 12v pump im using. I'm using a MOSFET to control the pump and a potentiometer as variable input.
I thought a simpel fade script should do the trick but when I turn up the potentiometer the pump only makes a difference between on and off and I can't get control over the speed.
I'm using the following script:
int pumpPot = A2; // Analog input pin for first potentiometer
int potValue = 0; // value read from the pot
int pump = 9; // PWM pin that the pump is on
int ledPot = A0; // Analog input pin for second potentiometer
int led = 5; // PWM pin that the led's are attached to
long onTime = 250;
int minDelay = 1;
int maxDelay = 100;
long strobeDelay = 0;
int pumpPot = A2; // Analog input pin for first potentiometer
int potValue = 0; // value read from the pot
int pump = 9; // PWM pin that the pump is on
The test code is just to verify if you can get smooth speed control of the pump ... just a quick operational test of your PWM circuitry to see if your pump can smoothly ramp up its's speed. Used the same pin numbers as your code but that's it ... pwm is ramped up slowly over a number of seconds and repeats in a sawtooth pattern.
I used:
MOSFET: "N-Channel Power MOSFET 2N60 Low Gate Charge 2A 600V TO-251"
Pump: 12V, 4.8W, DC (on the pump is: IP68)
potentiometer: "10K OHM Linear Taper Rotary Potentiometer 10KB Pot with XH2.54-3P Wire BK19"
arduino: UNO R3
external power supply: 12V DC
the arduino is powered by my USB
I don't really know how to draw everything so ill try to describe it as detailed as possible and add photo's.
the positive pole of the pump is directly wired with the positive of the power supply.
the negative pole of the pump is connected to the drain of the MOSFET (middel pin/black wire) the source of the MOSFET (right pin/brown wire) is connected to the negative site of the power supply and to the GND of the arduino.
the gate of the MOSFET (left pin/yellow wire) is connected to the arduino (PWM able pin).
The potentiometers are connected on the other side of the board to the 5V, GND and two analoge pins.
The MOSFET you're using can't be controlled properly with a 5V signal on the gate (see fig 2). You'll need to use a suitable logic level MOSFET or NPN transistor. http://aosmd.com/res/data_sheets/AOI2N60A.pdf
Thanks for all the response but i get mixed ideas now
dlloyd:
The MOSFET you're using can't be controlled properly with a 5V signal on the gate (see fig 2). You'll need to use a suitable logic level MOSFET or NPN transistor. http://aosmd.com/res/data_sheets/AOI2N60A.pdf
It does work for my LED's in the same set-up, which MOSFET of transistor should be more suitable?
Boardburner2:
That has a brushless motor.
Internal electronics do the commutation.
Its not possible to control those.
Any idea what kind of pump should do the trick, or is it easier to just use a valve at the and of the hose?
Im saying that you should check that that pump can be controlled before you waste time playing with programming when you might have a perfectly workable programme.
Its fairly easy to check your programming and circuit withe the tests i have described.
Varying the dc voltage into the pump will tell you if its controllable.
The 2 main problems to resolve - the type of pump (as mentioned by Boardburner2) and the PWM MOSFET circuit.
Logic Level MOSFET: IRL530
EDIT: Your existing MOSFET circuit will only control a very small amount of current (see figure 2 in the datasheet as mentioned earlier). Compare this with the IRL530 which will switch up to 15A with 5V on it's gate.
Further to that , just because the mosfet you have runs the motor on off it does not mean it will correctly switch pwm, you would need a scope for that.