LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help automating soil respiration measurements with LabVIEW! (Beginner)

Hi everyone,

 

I'm a complete beginner to LabVIEW and coding in general, and I'm working on a project to automate soil respiration measurements using a Soil Health Innovations SR-1 with a LiCor 850 detector. 

 

Project Goal:

I'm building a multi-chamber manifold system with automated purging to analyze multiple soil samples sequentially. The system uses an Arduino Mega, a relay module, and SMC VQ20 solenoid valves to control the airflow between the chambers and the SR-1.

 

Current Status:

I'm using LabVIEW to create a VI that controls the valves based on the status of the SR-1 software. I've designed the front panel with controls for each valve and a string combo box to simulate the different status states of the SR-1 software (e.g., "Standby", "Pump Only", "Ready for Sample", etc.). I've also implemented the "Pump Only" case logic, which activates the purge valve and deactivates all chamber valves.

 

Where I'm Stuck:

I'm currently working on the "Ready for Sample" case, where I need to:

  1. Deactivate all valves.
  2. Wait for a 5-second delay.
  3. Activate the valve for the next chamber in the sequence (1-4).
  4. Increment the chamber number and cycle back to Pump Only after 4.

I've managed to create the basic structure the first three steps, but I'm struggling with how to:

  • Store and increment the chamber number.
  • Use a Case Structure or other logic to activate the correct chamber valve based on the chamber number.
  • Ensure the chamber number cycles back to 1 after 4.

Specific Questions:

  • What's the best way to store and increment the chamber number in LabVIEW? Should I use a local variable, a shift register, or something else?
  • How can I efficiently use a Case Structure to activate the correct valve based on the chamber number?
  • What's the most effective way to cycle back to "Pump Only" after completing cycle 4?

Additional Information:

  • The SR-1 uses a LabJack U3-HV for communication and control. 
  • The SR-1 communicates with a lab PC via SR-1 software (custom).
  • I'm using Tera Term to send commands to the LiCor 850 to adjust the pressure.

Any help, guidance, or code examples would be greatly appreciated! I'm eager to learn and make this project a success.

 

Thanks in advance!

0 Kudos
Message 1 of 11
(301 Views)

I hope you have some guidance/mentor/instructor to "get you started in LabVIEW".  Please tell us:

  • Your Operating System (year, 32-bit or 64-bit), 
  • Your version of LabVIEW (year/patch and 32-bit or 64-bit).
  • Did you start by choosing "New Project"?  You really need to develop what you describe in the context of a LabVIEW Project!

To provide the best help, we need to see your LabVIEW code.  Best (if you have a Project contained in a Folder) is to right-click the Folder, "Send to:", "Compressed (zipped) folder", and then attach the .zip file it produces.  If everything is inside one huge VI, you can simply attach that VI.

 

Bob Schor

Message 2 of 11
(286 Views)

Take a look into State machines and how to implement them on LabVIEW.

Message 3 of 11
(268 Views)

Thank you Bob,

 

Operating System: Windows 11 Home 64-bit

LabVIEW Version: 2022 Q3 (32-bit) 22.3.4f8 (using Community version)

 

I did start by creating a new project (using Blank VI template), but to be upfront, I undertook this project with absolutely zero knowledge in any of this, so I am unsure what you mean by how to 'develop what I am describing in the context of a LabVIEW project'. I am happy to share any information or details, simply subject ignorance. 

 

I thought I had attached my VI to my original post, but will upload the current version to this.

0 Kudos
Message 4 of 11
(257 Views)

Just an FYI, LV Community Edition is for personal use only, generally not for commercial or academic use.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 11
(244 Views)

I will certainly dive into that, thank you!

0 Kudos
Message 6 of 11
(240 Views)

When you open LabVIEW and click the "New Project" button, it opens (or, at least in LabVIEW 2019, which I just opened), with the first item in the right-hand side being "Blank Project".  

 

How are you learning LabVIEW?  Are you taking any of the Tutorials, either on the Web or the series listed in the first page of this Forum?  Do you have a mentor/professor/friend to get you started?  [I'm trying to do a little of that for you ...].

 

Anyway, as you probably know, LabVIEW uses "Virtual Instruments" (VIs, for short) that have a Front Panel with Inputs and Outputs (also called Controls, because you can use them to "control" what happens inside the VI, and Indicators, because they can show you what values are expressed on the "wires" inside the VI.

 

LabVIEW is a Data Flow system.  It is programmed (on the Block Diagram) using Controls, Indicators, Functions, and Structures, connected by "wires", which are conduits for "data" (which include numeric quantities, arrays, strings, booleans, and other things).  There are Three Laws of Data Flow (that's my made-up name):

  • A Structure (VI, While Loop, For Loop, Case, etc.) or Function does not run until all of its inputs have data present on them.
  • Data doesn't come out of a Structure/Function until all of its outputs have data present on them.
  • If two (or more) Structures/Functions show no "pair-wise dependency" (meaning a wire goes from the output of one to the input of the other), then there is no way to determine "who goes first", i.e. they can be considered as running simultaneously.

(Sorry about the disjointed nature of this brief note -- just hoping to get you started).

 

A LabVIEW Project provides an environment to keep a "LabVIEW Project", meaning a body of code that you want to keep together, say in a Folder, that all pertain to one "Project" (meaning a specific Task or Tasks that this code "does for you") coherently organized on disk.  Often the Project file (which has the extension .lvproj), which is an ordinary text file (that you should not mess with!) that "organizes" the various VIs and other items you want to keep together as they cooperate to do What You Want The Code To Accomplish.

 

Can't look at  your code right now (the PC I'm using doesn't have LabVIEW 2022 or higher, so I can't yet open your VI, but my machine at work can ...

 

Bob Schor

0 Kudos
Message 7 of 11
(236 Views)

This is 100% a personal project based on my understanding, it just overlaps with one of the work tasks I have. To give a little background:

 

As I am the main operator of the SR-1, I have to read 100's of samples a day, which requires manual handling of each sample container individually. I dabble in 3d printing as well and designed a compact multi-chamber sampler to incorporate into the system and automated solenoid valved made the most sense, so wanted to take a crack at figuring out how to incorporate those into the system. I figured the best approach was to simulate as much as I could before ordering any physical parts, and after starting in WokWi, I was guided to LabVIEW. 

 

If this does violate the EULA/T&Cs, I will absolutely take steps to remedy that. It is not my intention at all. 

 

0 Kudos
Message 8 of 11
(231 Views)

That is certainly great information and adds a bit of clarity!

 

As for how I am learning LabVIEW, its a mix of trial and error, utilizing the help/guidance within program, and the old classic, google. I do not know anyone who does this specific type of work to act as an SME. I started my journey last Friday and am slowly making my way through the forum and will continue to do so!

 

0 Kudos
Message 9 of 11
(224 Views)

@ThenaTheGrey wrote:

This is 100% a personal project based on my understanding, it just overlaps with one of the work tasks I have. To give a little background:

 

As I am the main operator of the SR-1, I have to read 100's of samples a day, which requires manual handling of each sample container individually. I dabble in 3d printing as well and designed a compact multi-chamber sampler to incorporate into the system and automated solenoid valved made the most sense, so wanted to take a crack at figuring out how to incorporate those into the system. I figured the best approach was to simulate as much as I could before ordering any physical parts, and after starting in WokWi, I was guided to LabVIEW. 

 

If this does violate the EULA/T&Cs, I will absolutely take steps to remedy that. It is not my intention at all. 

 


I just wanted you to be aware, because it sounded like a work project.  I figured you probably already knew this, but I wanted to save you some potential legal headaches in case you didn't.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 11
(197 Views)