I have two pieces of hardware I'd like to interface with via USB. The first are 2002 Series Actuated Valves and the second is a Mass-Flo Controller for regulating gas exchange. To my (admittedly limited) knowledge of hardware interfacing, I imagine for example, as stated on page 38 of the MKS manual, I simply need to "apply a TTL low to pin 4" of the 15-pin connector to open the valve. I've purchased the following USB-DB25/DB15 cables, however am unsure of exactly how to apply this signal voltage through USB. The manufacturers sell their own cables like a DB15 to HD15/VGA but their prices seem a tad outrageous and the shipping times won't work. How can I achieve this task through USB?
The first thing to understand is that there is NO universal interface via USB. All USB interfaces need to load applicable drivers and you need to define what sort of programming interface you want to support. You can:
- Write your own USB driver. I don't think you want to go there.
- Use a supported USB interface such as those that present as a Virtual serial interface (FTDI FT232R).
- Use a supported USB interface such as those that present as a parallel interface (FTDI FT245R).
Your Actuated valves are like a solenoid valve (see page 20 on the datasheet), so you will need:
- An external power supply (they cannot be driven from your USB connection) of 12 or 24 VDC.
- A USB digital IO with either open collector (transistor) or open Drain (FET) driver.
Your Mass Flo valve is a TTL interface, so you could drive this directly from a logic output.
Only one of 'USB cables' you have bought could conceivably be used to drive the solenoid valves or the Mass Flo device.
The USB to Parallel port adapter has 8 TTL output bits available (LPT interface). You can drive these from all development languages, or can use simple pre-packaged applications to test.
Notice here you are not driving a USB interface, but a virtual LPT port in the PC. This hides all the complexity from your application environment, but may be more challenging depending on the HOST OS you are using (you might have to specifically load a driver).
In the case of the solenoid valves you would also need to construct a driver for the solenoids along with the external power supply.
Her you could on the simplest end of the scale use an interface such as this:
They are called Arduino FET switches and will support the voltage and current you need.
The USB-Parallel port can directly drive the signals on your Mas-Flo device. If you need more than 8 bits of signal level then you could use a second USB-Parallel adapter.
If you need more than 16 bits of IO or are building a more professional setup you would be well advised to choose a professional solution such as the NI USB-6525. This provides 8 outputs and 8 inputs per module, but you can use multiple units. You would still need an external power supply to wire up your solenoid valves.