06-04-2017 02:28 PM
Hi, I'm new to labview and trying to find the best way to control my system.
There are 5 solenoid valves, 2 pumps and a stir plate which all have to be run every half hour in a strict sequence. It will run for 16 hours a day and the system will run for 3 or more months. I've been trying to use timed loops, but have seen a lot of stuff about state machines. Do state machines require user input every day? Or can I still use a state machine and have the code loop for me?
Each of the pumps/valves will only turn on for a few seconds to maybe a minute before turning off again. Is there a way I can time a case structure or something so that the pump/valve is only turned on for a few seconds before turning off again?
Any help is greatly appreciated (especially any screenshots of examples)!
06-04-2017 09:15 PM
Yes - you can do this with a state machine.
A recent example in the forums of a state machine with varying wait periods can be found in this thread. Although it won't do exactly what you want, you can see that it does something, then waits, then does something, then waits.
Given the very long waits you're considering (half hours) you might want to consider alternatives, depending on your hardware setup and if you need to use it for anything else. What hardware do you have, and do you need to use it for anything else? (For example, the computer?)
06-05-2017 08:52 AM
We have a computer set up in lab solely to run this experiment, so that shouldn't be an issue. Currently I'm trying to connect everything with a NI-DAQmx (USB-6008) to hook everything up to the computer, but I think I might have to get an arduino with relays to supply enough power to the valves (I think they will short out the DAQ).
Can I use both the DAQ and Arduino together, or would it be easier to just use one? And can I code for the arduino directly in labview, or must I use the arduino software with c++?
The example was very helpful, thank you!
06-05-2017 10:00 AM
Then you can go ahead and use a state machine, I imagine.
You can use both the DAQmx to DAQ board and Arduino code, but your picture made it look like you were using the Arduino to control the DAQ board, which I would guess is not the most straightforward method. There's a LabVIEW library for Arduino I believe but I'm not familiar with it.
06-05-2017 02:32 PM
@katistro wrote:
We have a computer set up in lab solely to run this experiment, so that shouldn't be an issue. Currently I'm trying to connect everything with a NI-DAQmx (USB-6008) to hook everything up to the computer, but I think I might have to get an arduino with relays to supply enough power to the valves (I think they will short out the DAQ).
Can I use both the DAQ and Arduino together, or would it be easier to just use one? And can I code for the arduino directly in labview, or must I use the arduino software with c++?
The example was very helpful, thank you!
Why not get relays that can be triggered using 5 volts and use the digital outputs of the DAQ to control them?
06-09-2017 10:08 AM
So I can wire the relays between the DAQmx and the instruments without an arduino board? Do they still require a power source, and the DAQ just signals them?
06-09-2017 10:14 AM
Yes, you can connect the DAQ to the relays. You need a power supply to power the valves through the relays.
06-09-2017 01:05 PM
Personally, for long-duration cycling, I would implement the cycle using a programmable logic controller (PLC). Once programmed no potentially unreliable computer (crashing) is needed.
-AK2DM
06-09-2017 01:58 PM
We have PLCs that we have used before, but my boss is very set on using a computer and labview. Do you know the pros and cons of each system?
(besides the PLC being easier and quicker to setup for someone who has never used labview before)