Controlling a Solenoid Valve via a Windows XPPC

Discussion in 'The Projects Forum' started by OSidPhoto, Nov 8, 2012.

  1. OSidPhoto

    Thread Starter New Member

    Nov 8, 2012
    Hello Everyone.

    I am a newcomer to this forum. I tried to look around different discussions, but couldn't find one which could be of help on my specific subject.

    I am a total novice at electronics, however, I have managed to assemble a few functional DIY circuits using semantics and part lists from the web and assembling these circuits for my personal usage on bread boards... so I can safely say that I can follow instructions and guidance if clearly provided.

    I am also an absolute novice at computer programing, except for one odd experience where I tried to use a notebook computer to drive a stepper motor using the computer's printer port and a small circuit on a bread board, while passing the instructions to the board using a downloaded free software.

    I am a semi pro photographer and like to do a lot of DIY stuff to be used in my photography, and have recently been trying to build a water drip system that can be controlled precisely to the millisecond.

    I am trying to look for a way to control a Solenoid Valve using a Windows XP notebook through its Parallel (printer) or Serial port. (I am not sure if Windows 7 and a USB connection would be capable of doing this or not, hence my selection of an old XP notebook which has serial and printer ports built in)

    To achieve this, I believe that I would be needing a software script in basic or some other language, a connection between the computer and a circuit board (a bread board in my case), perhaps one or two timer and other IC's and a few other electronic components, which would finally connect to a Solenoid valve on one end and a power supply on the other.

    My usage objective is as follows:
    1. There would be a liquid storage source which will be connected to the Solenoid Valve. The storage source would provide a consistent flow/pressure of water/liquid to the valve (Mariotte Siphon).

    2. The software/circuit needs to be assembled in such a way that I can send instructions to the Valve on, When to open, how long to open, how long to remain closed and when to open again and for how long.... and this turning into a repeated series of events, until the program instructs the valve to stop and stay closed.

    3. The duration of each event, needs to be in milliseconds or finer if possible.

    What I know so far, is that I can possibly grab a solenoid valve from our local electronics component market. Most likely, I would be able to get one which can operate on a 12 volt battery (alternatively, I believe I can also power the solenoid valve using a 220v AC to 12 volt DC power adapter... please correct me here if I am wrong)

    I genuinely seek some guidance and help, which can bring me closer to achieve the above. Any help in this respect would be very highly appreciated.

    I would like to thank you all in advance.

  2. wayneh


    Sep 9, 2010
    How confident are you in your strategy? I mean, water drips based on a lot of factors - like orifice size and shape and fluid surface tension - that influence drop size. Controlling a valve upstream of the drop may have little effect other than starting and stopping the drip formation process.

    In modern labs there are all sorts of pumps and equipment for precise control of small flow rates. HPLC pumps come to mind, or automatic pipettors for µL quantities.

    If you really want to control a solenoid at the ms time scale, you have to consider that it is a mechanical device with finite movement times.

    Do you have a budget for this project? One thing that would give you a leg up is a data acquisition device such as a Labjack U3HV, which costs about $120. This device and others like it are easily programmed to do the kind of control you described. You may not use it for its normal use, to acquire data, but it has many output channels as well. It's powered by and communicates to your computer over the USB port. Any programming language that can open, read and write a file can control the device.
  3. tshuck

    Well-Known Member

    Oct 18, 2012
    Like wayneh said, you are trying to control a mechanical device in the ms range. To accomplish this correctly, you'd need a rather large and complicated control system to control the solenoid based off of all the parameters necessary in creating and timing a water droplet(surface tension, viscosity, temperature, etc.).

    Instead, what I would suggest, as I've seen it done before, is use a photo-interrupter to detect the presence of the droplet and time the shutter release accordingly.

    Now, simply controlling your solenoid valve is easy... a RS-232 to TTL converter can give your computer access to a microcontroller which can control the valve for open, closed, delay-open/close, etc. but, you should not rely on this happening within 1ms.

    All this could be accomplished for ~$15 depending on whether, or not, you have the hardware.
  4. GetDeviceInfo

    AAC Fanatic!

    Jun 7, 2009
    you may want to do a bit of research into ink jet systems.