Control 12V 3 Wire Ball Valve with Uno and 2 Channel 12V Relay

Greetings all! I hope this finds everyone doing as well as can be in the current circumstances.

I am piecing together a project to control the water output from a Reverse Osmosis (RO) system I use to collect water for home brewing. The input to the RO system is a garden hose valve and the output is 1/4" pvc hose. I plan to measure the output water with an inline flow meter and once the volume of collected water is reached I want a motorized ball valve to close the supply. The issue I’ve been trying to work through for some time is configuring the ball valve.

For parts I have the following:

-Elegoo Uno R3
-U.S. Solid 3/4" GHT Motorized Ball Valve 9-24V AC/DC and 3 Wire Setup, model USS-MSV00019 or or manufacturer’s site with embedded “how to use” video
-HiLetgo DC 12V 2 Channel Relay Module with Isolated Optocoupler High and Low Level H/L Level Trigger Module Triggered by DC 12V or other site with more technical detail
-Breadboard
-9V batteries
-Smattering of wires necessary for connections

To start with the motorized ball valve, there are several instructional sites I have found that detail how to control a 2-wire solenoid/valve with a relay. There are also demonstrations aplenty on controlling other 2-wire devices with a relay. Hooking up the 3-wire version to a relay is befuddling me. The following two forum posts have clues as to how I should be wiring the ball valve and relay, but I still cannot figure it out:

-Arduino Controlled Ball Valve - Code Help

-Arduino with 12v relay

I’ve attached a wiring diagram from the ball valve showing wiring to a power source. I know the valve works due to the fact that the valve opens when I apply the red wire to the positive post of a 9V battery and the yellow to the negative post. To close, I apply yellow once again to the negative post, but blue to the positive post.

For the 12V relay I have also found several sites that deal with 5V relays that are powered by the Arduino. I have learned that with 12V relays an outside power source must be used. To this end I have tried attaching a 12VAC @800mA Class 2 wall power supply to the relay. The led lights up showing power, but the relays do not make the audible click that they do when I attach a 9V battery instead. I have done most of my testing with 9V battery since it seems to properly energize the relay coils as noticed by the audible click when power is applied. The IN1 and IN2 inputs on the relay have been wired to the digital out pin 3 and pin 4, respectively. With that wiring and 9V battery power I run the following code:

#define relayPin1 3
#define relayPin2 4

void setup() {
  digitalWrite(relayPin1, HIGH);
  digitalWrite(relayPin2, HIGH);
  
  pinMode(relayPin1, OUTPUT);
  pinMode(relayPin2, OUTPUT);
}

void loop() {
  digitalWrite(relayPin1, HIGH);
  digitalWrite(relayPin2, LOW);
  delay(5000);
  digitalWrite(relayPin1, LOW);
  digitalWrite(relayPin2, HIGH);
  delay(8000);
}

The led lights connected to each relay light up in an alternating fashion as I would expect. At the outset, I hear the audible click of the relay being powered and once again on the first switch. After that the clicking does not repeat as I would expect, but the alternating of the led lights continues. With that being played out indefinitely, I tried numerous configurations of wiring of the red, yellow, and blue wires of the ball valve to the NC1, COM1, NO1, NC2, COM2, and NO2 posts on the relay including a 9V power on the posts as well (see Ball Valve Arduino Wiring Diagram 9V Battery attachment). I would expect one of the numerous configurations to take power from the DC+ and DC- side of the relay and transfer the requisite voltage to the ball valve to open it, however none of them do. The only time the valve opens is when the 9V power hooked to the NC1 and NO1 posts is met with the red and yellow wires, respectively.

The direct questions I am seeking guidance on are the following:

-Does power need to be supplied to both sides of the relay or just the DC+ and DC- side?
-Is 12V required to the DC+ and DC- side? If so would 12V batteries be acceptable? If wall power would work, what type of power supply should I look for? I have found these on Amazon I’m considering purchasing.
-If power needs to be supplied to the output side of the relay, is a 9V battery a good choice or should it be 12V? If 12V should it be battery or wall power?

If anyone can steer me in the right direction I would be much obliged. I’ve learned a lot along the way and look forward to learning even more. Thank you for your time and consideration.

RO Arduino Controlled System.png

Why not simply use a solenoid based valve?

The hook up on their website is pretty basic:

ballvalve.jpg

You aren't very good at reading specs, are you? The relay module is a 12-volt device, and the spec says:
"Note:
This relay will be triggered by DC 12V, can not trigger with the arduino signal at 5V."

Same thing on the ball valve- the spec says 12 Volts. I doubt you could even get it to move with 9V, or for very long as the ball valve will eat the battery pretty fast.

Your conclusion that reversing the polarity on the ball valve is wrong. Again according to the video on their website, Yellow is ground, Red is Open and Blue is Close.

You are right that you need two relays. One to control the power to the second relay (common), and the second relay for the direction.

So, set the direction with relay2, then turn on the valve with relay1.

ballvalve.jpg

SteveMann:
You are right that you need two relays. One to control the power to the second relay (common), and the second relay for the direction.

Or simply use 2 mosfets.

bluejets:
Why not simply use a solenoid based valve?

That was actually my plan B. I was thinking that it would be better to use a sturdy brass ball valve to cut the supply from the garden hose spigot. I’m wary of the solenoid I have holding the pressure for long, but I really have no basis for that reservation.

SteveMann:
You aren’t very good at reading specs, are you? The relay module is a 12-volt device, and the spec says:
“Note:
This relay will be triggered by DC 12V, can not trigger with the arduino signal at 5V.”

Same thing on the ball valve- the spec says 12 Volts. I doubt you could even get it to move with 9V, or for very long as the ball valve will eat the battery pretty fast.

Admittedly I am definitely a novice when it comes to reading wiring diagrams and specs. This is really the first non-tutorial type project I’ve done. I’m appreciative of some expert help while I am attempting to level up.

I was able to get the ball valve to open and close several times with a 9V battery, but I’m sure you’re right that it is wearing the battery down quickly. The specs on their site do state it has a voltage range from 9-24 volts. Despite the valve being actuated by 9V, I assume that using 12V is still the preferred option since the relay requires 12V, right? To that end, the specs on the relay state it takes 12V AC. Would something like this suffice?

Would I need two power supplies, one for the DC+/DC- side of the relay and one for the Common/NC side?

SteveMann:
Your conclusion that reversing the polarity on the ball valve is wrong. Again according to the video on their website, Yellow is ground, Red is Open and Blue is Close.

You are right that you need two relays. One to control the power to the second relay (common), and the second relay for the direction.

Given the diagram you provided, does this circuitry complete the picture correctly (image attached)? Specifically, is the negative lead of the 12V power supply connected to the ground (yellow) wire on the ball valve correct?

SteveMann:
So, set the direction with relay2, then turn on the valve with relay1.

Turning on the valve with relay 1 equates to sending the high signal to relay 1, correct? Then setting the direction is done by sending either high or low signal to relay 2?

I sincerely appreciate everyone’s assistance on my project. I hope this might help others who might be configuring a similar setup.

nordaj:
the specs on the relay state it takes 12V AC. Would something like this suffice?

Nooo. The description clearly says "AC Input: 100V to 240V, DC Output: 12 volt at 2 amp rating." You want one that reads AC output at xxx.

nordaj:
Would I need two power supplies, one for the DC+/DC- side of the relay and one for the Common/NC side?

The valve description says it will run on AC/DC. If everything runs on AC you just need a supply with sufficient current capacity that doesn't violate the voltage limits on any connected device.

Did you note this: WarningLead content ~ 3.05%. It cannot be applied to drinking water.

"Turning on the valve with relay 1 equates to sending the high signal to relay 1, correct? Then setting the direction is done by sending either high or low signal to relay 2?"

Yes.

"Specifically, is the negative lead of the 12V power supply connected to the ground (yellow) wire on the ball valve correct?"
Yes. Yellow wire is ground, as it says on the product webpage.

The spec for the valve says "9V-24V AC/DC". The relay modules need DC (note the DC_ and DC-). If you send AC to it you may likely smoke it. The relay module and the ball valve both work on 12V DC, so you only need one power supply.

The reason for two relays is because this way you can't accidentally command the servo to open and close at the same time.

The Amazon page, the specs section and the datasheet all clearly state the valve power supply as 9-24V AC/DC. So it’s not DC only but the relays cannot handle AC so let's not get things any more confused than they already are. 12V DC is supply voltage to use.

The Amazon power supply you referenced here is a good choice for the permanent installation.

Only one relay is required as the valve has it's own internal relays to turn off power when it reaches either end of travel. I do not have a decent spec sheet for those relays so my drawing isn't the best but it should give you an idea of how the valve is wired to the relay.

edit: Originally, brass always contained a small amount of lead. That is until the peoples republic of California decided the minimal amount of lead was poisoning their subjects. So, all the plumbing fitting manufacturers had to reformulate their casting lines. About five years ago, there where brass fittings you just couldn't buy as lead was eliminated from the brass. Now things are back to normal with everything available in lead free and regular brass. Most of the 1/2" and 3/4" valves/nipples/unions/etc are only available in lead free, especially in the big box stores. Larger stuff is available for non-potable applications, it is always cheaper and is marked "not for drinking water".

dougp:
Did you note this: WarningLead content ~ 3.05%. It cannot be applied to drinking water.

Thank you kindly for that consideration. As WattsThat noted, due to California having low tolerances manufacturers must post that warning. I've dealt with brass fittings in the brewing industry and encountered the same restrictions. In my application, this fitting will be acceptable. Plus I'm not in California so I'll be fine :grinning:

WattsThat:
Only one relay is required as the valve has it's own internal relays to turn off power when it reaches either end of travel. I do not have a decent spec sheet for those relays so my drawing isn't the best but it should give you an idea of how the valve is wired to the relay.

The image and the explanation drive it all home for me. Thank you WattsThat, dougp, and SteveMann for your thoughtful replies. I've placed an order for the 12V AC to DC power supply and once it is here I'll wire it all up. Once I have it working I'll report back if anyone is interested.

I was living in California when that moronic Prop65 was passed. It was a good intent, but I saw the immediate problems that you see today everywhere in California. You can't buy a product or enter a store without seeing Prop65 warnings.

It's a modern "boy who cried wolf" and a tremendous waste of effort since all any business needs to do to comply is to post the sign at the entrance. So, they all do.

I finally have it all up and running! As it turns out I really did only need a one channel relay. Here is a diagram of my current wiring:

The water sensor detects the depth of water and reports back a reading that is higher the deeper the water. Once at the desired depth the program sends a signal to the ball valve to close the supply water. Here is the info from the Amazon posting I purchased from.

If anyone has any other questions about the project I'd be happy to share more. Thanks again for the help you all have offered. I would still be struggling without it.