Solenoid valve controlled by a PC

Hi everyone,

I’m a research chemist, and I’ve got a piece of equipment that runs on a constant flow of argon which needs to be switched off at the end of use. So I don’t have to wait around all night to do it manually, I really want to plumb a solenoid into the line so I can program it to be switched off at the end of a run. Ideally, I’d control the solenoid from the instruments windows computer and put together a little autohotkey script to turn everything off in the instruments software, as well as close the solenoid at the end of a timer. I’m just not sure how I can interface the solenoid with the PC. Can anyone recommend a solid way to do this?

From my research so far, I’m thinking I can just wire the solenoid into a USB relay with a snubber diode and then program that on the PC. But I don’t really trust myself. Is there anything I’m missing, or would there be a better way to do all of this? Any recommendations would be greatly appreciated.

There’s several options. I’ve highlighted 2 here, others may come up with different ideas.

  1. use a Rapsberry Pi. This is a small computer, running Linux and has IO pins to interact with your test environment. As it also has a network jack, you can connect to it remotely, even from home.

  2. use an Arduino Uno. This is a microcontroller, also with lots of IO pins and a USB connector for communication. There is a plethora of cheap Chinese clones available.

There are several (high level) programming languages available for the RPi, most prominent Python, but also C/C++ and variants, Java and loads more. For the Arduino platform most commonly used is C/C++, but it has a well established IDE with a large community to help you out. Btw, so has the RPi :wink:

HTH!

1 Like

If you want Windows.

It uses the built-in Microsoft drivers.

https://www.ontrak.net/ADU200.htm

Use a smart USB power strip and plug the solenoid into that. Insert USB when you want it open, remove when done.

Thanks for all the suggestions! The USB relay idea seems like the best option for me. The software the instrument uses has an SDK for developing plugins, so I’m going to enlist the help of a few friends to develop a plugin that controls the USB relay straight from the software!

depending on what your equipment is you have to take into consideration any possible emf feedback it may produce
supply wiring and control signal wiring will often need shielding.
controlling argon gas?
any computerized device may be susceptible to feedback damage if it is not adequately protected.
in many cases you want an opto-coupled relay to isolate the control signal from power supply of the solenoid
a magnetic relay can feedback an unwanted pulse of current when the generated magnetic field collapses
(this was a source of a lot of damage to vfd drives at our work place. (contractors installed the vfd drives without clamping circuits and every time we lost power even for a second the rapidly collapsing magnetic fields in the conveyor motors would back-feed a pulse over 10,000 volts) = kentucky fried vfd!)
research clamping circuits and magneto theory.

you can control the solenoid via serial or parallel port but again use a optocoupled relay or cascaded read relays to protect the computer, raspberry or arduino.