MOSFET Switching Problems


#13

Your 220 ohm resistor to ground is probably too small. If R1 is also 220 ohms, the voltage at the MOSFET gate will only be 1.65 volts (half of 3.3 v) when D0 is HIGH. The threshold voltage for your MOSFET is 1 to 2 volts, so it might work for some devices, and not for others. A 10k ohm resistor should be more than adequate to make sure the gate stays low if D0 is in a high impedance state.


#14

To illustrate the meaning of your flyback diode D1 I’d actually move the coil of your solenoid into the main route.
This should also help to see that the polarity of D1 is wrong. Flyback diodes are meant to be blocking in normal mode and only short back the negative EMF that’s produced when the magnetic field collapses.

Also the polarity of your battery is inverted - you got the + pole on GND.


#15

I have made the changes to the circuit per your suggestions. do you think 100nF is enough capacitance for my application? I am slightly confused by your change regarding the flyback diode but after some googling i believe I have it right. Does this look correct?


#16

I have wired up the above circuit and the simple code that I am running to test it. And am still having the problems that led me to open this topic.

When I plug in the power supply I the valve, normally closed, opens but no switching. I have tried the above circuit with and without the 10Kohm, to no avail. When the power supply is unplugged the valve slowly closes. When I measure the drop across the diode it reads ~12v. I feel their is something I am missing. here is the code I am running;

#define valve1 = D0

void setup(){

  pinMode(valve1,OUTPUT);

  digitalWrite(valve1,LOW);

}
void loop(){

digitalWrite(valve1,HIGH);
delay(500);
digitalWrite(valve1,LOW);


}

#17

@jjlee32
One thing you definitely need is another delay after digitalWrite(valve1,LOW);


#18

ah good catch, but did not fix my issue


#19

I don’t understand what your problem is. In a post you made 7 days ago, you said, "Grounding the data pin has worked!"So what’s changed since then? Didn’t you have it working at that point?


#20

Sorry for the lack of clarity, as I am just frustrated with this circuit.

Grounding the data pin did work initially, but sparingly. Sometimes I would have to unplug the valve then replug it, then it would switch as intended. Other times it wouldn’t switch at all just be open until I unplugged it. I know that it’s something simple and when I get it ill kick myself for stressing this much about it, but in the moment it sucks.

I feel that every change that is suggested works for a few cycles of turning on and off the power supply and/or the photon, but nothing has working consistently? Is their a set of guidelines i should follow?

Thanks for your help, I don’t know what’d i’d do without this forum.

EDIT: here is a picture of the trouble maker, I spread the components out to try and make sure it was all correct, the power supply plugs into the rails that are second closest to the camera.


#21

This sounds like some kind of hardware problem, I think your setup is ok (as far as I can see). What valve are you using?


#22

If by values you mean the values of the components,

Resistor - 220 ohm
Diode - rated for 12V 5W -1N5349B (and no change when its removed)
N-Channel MOSFET - RFP30N06LE

I’ve been moving the circuit and switching the wires out out to try and avoid any sort of contact problem


#23

Values? I asked about the valve you’re using.


#24

Wow, I completely misread that HAHA. Its this one. I have two and have switch them them out periodically also.


#25

The specs for that valve have this statement: “The valve has a gasket arrangement inside, so there is a minimum pressure requirement of 0.02 Mpa (3 PSI)”. I’m not positive what that means, but I think it means the valve needs to be under a minimum pressure to operate properly. Are you testing it when it’s hooked up to a liquid source with at least that minimum pressure, or are you testing it dry?


#26

Thats correct, I have been running it dry. Even when running it dry I can feel and hear the solenoid switching on and off when I had it working initially. I tried blowing the valve when it was open and it did require a little pressure before allowing air through.


#27

I think you need to test it with the proper water pressure applied to it, in order for the test to be meaningful.


#28

I successfully add a Mosfet to Arduino to control power and speed to 3 x 12v high-speed fans. It should also work just fine for your project even if you don’t need to PWM the power to the 12v pumps.

Just ignore the potentiometer in the Arduino schematic, I didn’t use that, just wire the MOSFET up like you see it on the breadboard and pull the Gate PIN high and you should get power flowing to your 12v motor.


#29

I cannot see the 220Ohm resistor but a 10k between D0 and the Gate pin.
The 10k should be between Gate and common ground.
I can’t seem the cap either.

Maybe you replace the valve with an ordinary 12 relay or any other 12V component to check the circuit first.


#30

I removed the cap to troubleshoot the circuit, as the cap serves more the to the opimzation of the ciruit than the overall function. I have been trying each time I wire it up with and without the 10K resistor to see if it works.

The tutorial i found here has neither the cap or the 10k resistor. It also seems that in that tutorial they don’t connect it to water, as there is no mention of it. When I wire it up the way listed in the above link, it switched for a few moments then the solenoid went to a high frequency humming, as if it were switching on and off but not fully coming to a stop, which to mean means noisy signal so i tried the 220ohm and the 10K as mentioned in this post and that change somehow managed to have me measure 0v across the diode. I feel as though i’m chasing a ghost.

ill have to think if I have any 12V components laying around to test the circuit.


#31

I had a problem wiring this one up, when i ignore the potentiometer for which i assume is for PWM I get no power to the diode I appreciate the link it did have a lot of useful information for if i do try and control using PWM


#32

Are you using logic level MOSFETs?