Solenoid valve stops after 1 cycle (Nano, 12V power supply)

Hi All,

A bit of a novice here, so I apologize in advance if my description is poor.

My goal: cycle a valve (Amazon.com: HFS(R) Electric Solenoid Valve Copper Normally Closed for Water Air Gas (12V DC 3/4IN NPT) : Industrial & Scientific) for grass irrigation using arduino nano and a 12V power supply

Strategy: I followed this YouTube video (https://www.youtube.com/watch?v=Yh3TLXihUps see wiring at 7:05). The only modifications I did were to use a Nano and because there is no jack input for the power supply, I wired it into vin and ground with a splitter.

Problem: The valve fires the first time, but then it doesn't seem to be getting enough juice thereafter. I can hear it trying.

Trouble-shooting: When I plug the valve directly into the 12 V power supply w/ splitter it works just fine, indicating it is getting enough juice directly from that. So it must be something in my wiring that is causing it to not get enough juice on the second and consecutive tries. After that first firing, even if I resend the Arduino code, and unplug replug the power supply into the wall, it will not fire a second time. It seems like (maybe) some kind of charge has built up in the system that needs to be dissipated, because I ran the system on a smaller valve and it worked fine, and then when I went back to the big valve it fired again the first time and then failed to fire thereafter.

Additional troubleshooting: I unplugged the power supply from the wall for 3 hours, replugged it back in, and the valve fired again. But then it failed to fire thereafter when the power supply was left plugged in (even though it is programmed to do so on a cycle, and again, a smaller solenoid valve cycled continuously when hooked up to the same system in the larger valve's place).

I have put information regarding the code, hardware components used, and a wiring drawing below in the replies.

Any help is greatly appreciated!

Best,

Kirt

Hi, @kirt04
Can you please post your code?

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Thanks.. Tom.. :smiley: :+1: :coffee: :coffee:

Yes! Thanks Tom. I will post bit by bit. Here is the code I am testing with:

int SolenoidPin=2;
const unsigned long ONE_SECOND = 1000UL;
const unsigned long ONE_MINUTE = 60UL * ONE_SECOND;
const unsigned long ONE_HOUR = 60UL * ONE_MINUTE;

void setup() {
  // put your setup code here, to run once:

pinMode(SolenoidPin, OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:

digitalWrite(SolenoidPin, HIGH);    // START AT 2PM 6 second clicks to test
delay(ONE_MINUTE*0.1);
digitalWrite(SolenoidPin, LOW);
delay(ONE_MINUTE*0.1);
digitalWrite(SolenoidPin, HIGH);    // 6 second clicks to test
delay(ONE_MINUTE*0.1);
digitalWrite(SolenoidPin, LOW);
delay(ONE_MINUTE*0.1);
digitalWrite(SolenoidPin, HIGH);    // 6 second clicks to test
delay(ONE_MINUTE*0.1);
digitalWrite(SolenoidPin, LOW);
delay(ONE_MINUTE*0.1);
digitalWrite(SolenoidPin, HIGH);    // 6 second clicks to test
delay(ONE_MINUTE*0.1);
digitalWrite(SolenoidPin, LOW);
delay(ONE_MINUTE*0.1);
digitalWrite(SolenoidPin, HIGH);    // 6 second clicks to test
delay(ONE_MINUTE*0.1);
digitalWrite(SolenoidPin, LOW);
delay(ONE_MINUTE*0.1);

digitalWrite(SolenoidPin, LOW);
delay(ONE_MINUTE*59);

digitalWrite(SolenoidPin, HIGH);    // on 10 mins at 3PM
delay(ONE_MINUTE*10);
digitalWrite(SolenoidPin, LOW);
delay(ONE_MINUTE*50);
digitalWrite(SolenoidPin, LOW);
delay(ONE_HOUR*4);
digitalWrite(SolenoidPin, HIGH);    // on 20 mins at 8PM
delay(ONE_MINUTE*20);
digitalWrite(SolenoidPin, LOW);
delay(ONE_MINUTE*40);
digitalWrite(SolenoidPin, LOW);
delay(ONE_HOUR*13);
digitalWrite(SolenoidPin, HIGH);    // on 20 mins at 10AM
delay(ONE_MINUTE*20);
digitalWrite(SolenoidPin, LOW);
delay(ONE_MINUTE*40);
digitalWrite(SolenoidPin, LOW);
delay(ONE_HOUR*3);

}

Components:

Arduino Nano
Solenoid Valve: Amazon.com: HFS(R) Electric Solenoid Valve Copper Normally Closed for Water Air Gas (12V DC 3/4IN NPT) : Industrial & Scientific
Power Supply: Amazon.com: R-Tech12V 1A Power Supply, Power Adapters, Lighting Low Voltage Transformers 5 Pack, UL-Listed, Power Cord with 5.5x2.1mm Tips, AC 100-240V to DC 12V 1A for LED Strip Light, Camera, Router, etc.
MOSFET: ALLECIN IRF630 MOSFET Transistors 9A 200V IRF630PBF N-Channel Power Transistor 9 Amp 200 Volt TO-220 (Pack of 10Pcs): Amazon.com: Industrial & Scientific
1K Resistor
IN4001 Diode

Wiring Diagram (other info you asked for is in different replies):

Hi, @kirt04
Where is the gnd connection to the Nano?

Is your power supply capable of supplying more than 2A?
What is the part number of the MOSFET?

In fact you have the MOSFET wired so it shorts the 12V supply.

Do you have a DMM? (Digital MultiMeter)

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

Ah sorry I left those details out:

The gnd connection on the Nano goes to the - row on the bread board.

Looks like the power supply can only put out 1A (I now see that the valve says it requires 2A, however, it still fires just fine when connected directly to the power supply, so I'm thinking this is not the issue).

MOSFET part no. : IRF630N

I do have a digital multimeter, yes.

Can you explain how I could rewire the MOSFET so that it doesn't short the 12V supply?

Let me know if you think this is a good idea. I coudl redesign the whole thing with a relay that serves as the gatekeeper for the power supply being fed to the valve. It actually might be simpler in the end, I think (don't think I need diode or resistor if I'm imagining it correctly). But I'd still like to understand why my current build isn't working.

Look at piloted solenoid valves. They use the water pressure to do the actual valve operation. The solenoid just opens a tiny port to allow the water to flow to the actual valve diaphragm. They use VERY little current for the solenoid.

Hi, @kirt04
This may help;

Measure the 12V when the valve is actuated.

Tom.. :smiley: :+1: :coffee: :australia:

Thanks, Tom, I will try this, but I don't get what resistor 2 (R2: 10K) is doing. What is it's purpose? Am I correct that this is the only major change you instituted or am I missing something?

Thanks again!

Kirt

The MOSFET input gate is very high impedance, and if left disconnected, like during power up and the Nano has not finished configuring its outputs.
The MOSFET could switch ON unexpectantly.
The 10K keeps the gate connected to source so the MOSFET cannot switch on with no drive from the Nano.

Look at how you have connected the MOSFET to the valve, diode and power supply.
For a start you have the protection diode in series with the valve instead of in parallel with it.

Tom.. :smiley: :+1: :coffee: :australia:

1 Like

Did you read this on the Amazon page?

"[MATTERS NEEDING ATTENTION]: Amps power required by adaptor: at least 2A. As the product is normally closed solenoid valve, the working time shall not be too long, and the working time is recommended to be less than half an hour. "

Hi Tom. Just wanted to let you know that I rebuilt the system with a dc-dc buck converter so that I could take the 12V power supply and split it to power the Nano with 5V and then run the relay and solenoid on 12V. It works now, although I have no flyback diode in place, so I don't know if that means parts of the system are vulnerable to EMF from the solenoid. I did add your 10K resistor to ground for the D2 pin, although I didn't see a difference after I added it.

Thanks for your help, and for any additional advice you might have.

1 Like

Yes thank you! Just ordered a 12V 2A power supply. Also, I plan to only have the valve open for 5-10 mins at a time.

It keeps the pin firmly grounded during bootup, when the pin is not yet configured as output. The solenoid could briefly engage during boot without that resistor. The resistor has no function after bootup.
Leo..

OK just wanted to let everyone know how this wrapped up:

It turns out I simply needed to put a capacitor across the VIN and GND terminals of the Arduino Nano. Whenever the valve was actuating to open and then again when it would close, the Nano was losing power or getting discombobulated in some way. This occured even after I separated the 12V 5A power supply to the Nano vs the relay+valve using a dc-dc buck converter.

I found this odd (keeping in mind I am a novice) because the valve only calls for 2A power supply, but I suppose that is the current prescribed to hold the valve open, while in reality, when the valve opens there is probably a spike in the current it draws, and when it closes I'm not sure exactly what happens to disrupt the Nano (maybe someone else can explain the logic there to fully wrap up the story).

Hi,
Good to hear.
Can you please p0st a final schematic and images of your project for future use by others seeking to do the same thing as you?
Make sure you include all gnd connections.

Note that your post #6 schematic is not correct and will have the valve actuated all the time.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

Hi Tom,

Sorry for the delay. I will post a wrap-up summary with solutions the overcame the perceived problems from previous designs when I am completely satisfied with my system. We have a newborn as of late November so the project has taken a haitus.

Best,

Kirt