# Solenoid Valves Controlled By USB?... Help Needed

#### timpickup1

Joined Apr 2, 2015
11
Hi All,

I am very new to this. I have a project idea for work and i need help figuring out the software and electrontic elements to this.

I would like to have 6x Solenoid Valves linked at a Computer which can be controlled from the computer using software such as Scratch (Open to other options). I would like all 6 solenoid valves to be connected via one USB slot and then from there the program to choose which one to open. The idea is for the solenoid valve to open to release liquid. An example of the basic function i want it to do is:

Open Solenoid 1
Wait 5 Seconds
Close Solenoid 1
Open Solenoid 4
Wait 12 Seconds
Close Solenoid 4.

Is this at all possible and if so what do i need to do to be able to control the solenoid valves independtly from the computer.

Thanks,

Tim

#### ErnieM

Joined Apr 24, 2011
8,055
This is very possible and not very complicated. Several manufacturers produce ready to go USB to serial chips, such as Future Technology Devices Inc (FTDI) or Microchip just to name the two on top of my head. If you want a complete solution there are ready to go boards in housing available again from many sources (National Instruments being one I know but is very \$).

If no one bangs back with specific product recomendations I can search some later. EBay from China should get you something good (I just can't access them from where I am now).

Joined Jul 18, 2013
21,402
First you need to find out or specify a voltage/current DC/AC etc rating for the solenoids you have in mind.
What is the degree of control you need? Automatic or semi-automatic?
Max.

#### timpickup1

Joined Apr 2, 2015
11
Last edited:

Joined Jul 18, 2013
21,402
Do you really need PC control? Do you need a full HMI or just simple start/stop etc.
There are a few options without going to the need for a PC, such as Smart Relay, which has multiple counter/timers and a simple HMI.
There is a discrete IC's which will require deeper circuit design, and then also a small Microprocessor design.
A PC is a bit of a large stick to to tackle what appears to be a simple project.
Max.

#### timpickup1

Joined Apr 2, 2015
11
I thought i would need a computer as there will be multiple sequences on the program...

For example, one of the sequences may be Open Solenoids 1,4 and 6. But another may be open 2,3,5...

I didn't think this was possible without a computer.

The application of this is a drinks machine where the contents would be changed. My idea was that the computer would hold the program files for different drinks in a folder and when clicked the programmed sequence for that program would open the solenoids designated by the code...

Joined Jul 18, 2013
21,402
Well it sounds like you don't need the HMI/screen display a PC would offer?
All or any of the options I listed in #5 should work, as I see it you need maybe a P.B. selection and Ind light feedback.
How many possible combinations do you expect?
Max.

#### ErnieM

Joined Apr 24, 2011
8,055
Max, do you get out much? Last time I was at Dairy Queen the soft drink dispenser had a 20x20" menu driven touchscreen to choose from between dozens and dozens of drink choices. It's 2015 and humans have evolved to now have brightly colored touch screen computing devices embedded into their hands demanding constant attention. If you want them to pay attention to something else you MUST make it bright and shiny.

timpickup1: I don't know nuthin' 'bout no solenoids though they do look like they would work. They don't seem very expensive if you want to get a few to experiment with.

You can do this with a PC as the main computing controller. I found a bunch of inexpensive boards for this but they don't show up on EBay.co.uk, just ebay.com, so you may want to search there. The lowest cost devices will need a few parts to drive that solenoid, we can talk you thru that when the time comes.

Of course, just a few push buttons could be used as the "user input" device. Then there are several ways to go for the timing part, but while it has a learning curve I would strongly suggest some sort of microcontroller or single chip computer to toggle the solenoids on and off.

Joined Jul 18, 2013
21,402
Max, do you get out much? Last time I was at Dairy Queen the soft drink dispenser had a 20x20" menu driven touchscreen
Oh Yes I can do Glossy when the need arises, I generally use Maple Systems products for this, everything from keypad/3line display to HMI panel mount PC's with touch screen.
http://www.maplesystems.com/
It depends on the budget for the intended product.
Max.

#### timpickup1

Joined Apr 2, 2015
11
Ideally a display would be useful. I would like to be able to easily code a new sequence for a new drink and the drinks in the holders may change. Could you possibly post some links to the things i would need to do this?

Evidently. cheaper is better.

#### ErnieM

Joined Apr 24, 2011
8,055
My choice for display is a ubiquitous alphanumeric LCD display, with a 4 lines of 20 characters being my sweet spot:

They are inexpensive yet good devices. A bit of a pain to get to work the first time but well worth the effort.

You can combine these with some simple push buttons to walk menus and make selections.

This is assuming you are using a micro controller, and that means picking which family and which controller.

#### timpickup1

Joined Apr 2, 2015
11
This looks great if i am able to program this different sequence and create programs for the different sequences of valves. An example would be

Click To Program 1
Open Solenoid 1
Wait 5 Seconds
Close Solenoid 1
Open Solenoid 3
Wait 20 Seconds
Close Solenoid 3

Then Program 2 would be something different like
Open Solenoid 4
Wait 5 Seconds
Close Solenoid 4
Open Solenoid 2
Wait 20 Seconds
Close Solenoid 2

If this is possible through this, Could you tell me more about the micro controller i would need to do this and how to wire the controller to this and then to the Solenoid valves.

#### ErnieM

Joined Apr 24, 2011
8,055
The problem now is not if some kit or device can do these delays but which one do you want to use? There are dozens and dozens of devices that can do this, so many in fact that the problem is picking ONE device to buy that suits you.

And we do not know you, that's another problem. When you start off doing projects like this you have to write some code, make a board to hold the electronics, get the code into that board, run the project and tease out programming errors and electrical errors until it all works.

I would suggest starting out with some sort of preassembled and tested board. The Arduino series has many supporters, it is bases on boards that plug together called "shields" to combine functions. It has a large following with tutorials around many places. Another device is the Basic Stamp: the company that makes them is devoted to educating people in small these computers.

I'd suggest you Google those two devices and see what seems interesting.

#### timpickup1

Joined Apr 2, 2015
11
I already have a Raspberry Pi B, would this be able to be used to individually activate the solenoids and if so how would i do this?

Joined Jul 18, 2013
21,402
Are the solenoid valves existing or not been spec'd in yet?
If not you need to source them and determine the specs based on what voltage you desire to work in.
Max.

Joined Jul 18, 2013
21,402
I don't use that processor but It appears to have sufficient I/O?
Depending on the load, you may be able to use a ULN2805 output array to drive the loads.
Max.

#### ErnieM

Joined Apr 24, 2011
8,055
Yep, that should work fine for you. The relay contacts are beefy 10 amp units and the solenoids you posted only need 1/4 A each so that is good. You'll also need a "catch diode" to keep from burning out the relay contacts when the thing switches off, anything like a 1N4001 or better will work for that.

The board says "Windows software examples: VB6, BCB6, Java (netbeans), VB.NET 2010 Express, C++.NET 2010 Express" so you have lots of options to code this thing.

Joined Jul 18, 2013
21,402
Looks like you just need a application to write the necessary Windows DLL's according to the spec sheets.
Max.

#### timpickup1

Joined Apr 2, 2015
11
How would i wire in the catch diode into the circuit?