Operating a Valve with UNO

I am working on my first project and I am looking for assistance on whether or not my idea will work or if there is a better way to accomplish my goal. What I want to build is an automatic glass filler. The idea is that a button will be pressed and the valve will open long enough to release the appropriate amount of liquid and then close off.

The items I would use (besides an UNO, a breadboard, jumper wires, and a power supply for the Arduino):
12v Solenoid Valve - 1/4" NPT 12V DC Electric Solenoid Valve 12-Volt DC NC RO Air Water BBTF | eBay
2 Channel Relay - Amazon.com
Push Button - Amazon.com

My design idea would be to have the switch hooked up with a digital pin on input (set to high at all times) and an analog pin set up on the output side. So when the button is pressed (just momentarily) the analog pin will get a different reading. This change in reading will trigger the relay to send 12 volts to the valve to open it. A small delay will be set, long enough to dispense the proper amount, and then the relay will turn off those closing the valve and the glass should then be filled.

So will this idea work and do I have the proper materials?

Any and all suggestions welcome. Thanks for reading!

ARosch:
My design idea would be to have the switch hooked up with a digital pin on input (set to high at all times) and an analog pin set up on the output side. So when the button is pressed (just momentarily) the analog pin will get a different reading.

That's kinda over-complicated. A better way would be to wire the switch between ground and a digital pin, set the pin as an input, then set the pull-up on the pin (see how here: http://arduino.cc/en/Tutorial/DigitalPins). When the pin goes from HIGH to LOW - the switch is pressed (you'll need to add de-bounce logic or hardware too, by the way - but you would have had to do the same with your solution, too). In the end, one less pin is used (which you could use for something else).

ARosch:
This change in reading will trigger the relay to send 12 volts to the valve to open it. A small delay will be set, long enough to dispense the proper amount, and then the relay will turn off those closing the valve and the glass should then be filled.

This would work for a quick demonstration, but also may end up with the glass only partially filled (or overfilled) - depending on a number of factors. However, you could consider solving those problems as a "phase 2" of your project. :slight_smile:

ARosch:
So will this idea work and do I have the proper materials?

Everything should work - the only problem would be potentially with your valve.

For this to work as you have described it, you would need to use a valve that is designed for a "gravity fed" system; as the way you are describing things, gravity would have to be working on the liquid to move it, correct? Most small solenoid valves, though, work similarly to sprinkler valves - they need the liquid or gas being controlled to be under pressure for the valve to work; if it isn't under pressure (and it must be at the rated pressure for the valve as well!) - the valve will fail to work properly.

That said - looking at the specs given on Ebay for that valve, it looks like it should work. It says that it is a "direct acting" valve, and requires no pressure for it to operate. It also says that it can be used on a "gravity fed" system - but that the flow rate will be very low due to the internal orifice size of 2.5 mm (which is pretty small - your liquid is going to come out as a trickle!).

Finally - it isn't readily apparent as to how easy it is to clean the valve. In systems that operate with food items, the valves need to be such that they can be easily cleaned (either by directly taking them apart and cleaning them, or via some form of disinfecting agent being ran through them). You need to keep this in mind if this is meant to be used as an actual system (vs simply a demonstration device). Otherwise, food-borne bacteria and other nastiness -will- crop up, and cause people to get very sick. So keep that in mind depending on what you plan to make (ie - if you are building an automated bar or similar, come up with a working cleaning procedure and follow it religiously).

I am a little confused at your suggestion for how to make this less complicated. Basically you are saying that I can run ground into the switch and the output will go to a digital pin that is configured as an input. When the switch is pressed the pin will switch from High to Low?

I have very little experience with debounce logic, could you elaborate as to what I would need or what hardware I could use?

This is the new valve I picked out, it has a larger orifice and is still a direct acting gravity feed valve. As far as cleaning it out, do you think that running alcohol through it would be sufficient?

Thanks for your help cr0sh!

I would add to cr0sh's post that the viscosity of the liquid(s) will be a major factor in how much is dispensed in any time period. Treacle [molasses] doesn't flow as fast as water.

The liquid will be of a low viscosity for sure.

I got the relay in and I have been working with it and trying to learn how to get it to output 12 volts.

I am still confused on what cr0sh meant by needing debounce logic or hardware to make it work. Any help?