LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed control of a Relay switch using Arduino through LINX

Hi everyone,

 

I have been tasked with the assignment of controlling a relay switch with specific durations and iterations. I have found the program seen below and modified it for my needs. At the moment, the button controls the relay with user input. Please note that the type of trigger I want is a simple press then release immediately (this will change the instrument from OFF to ON, or viceversa).

 

For my purpose I wish to have user input on how many times that press release action (how many loops) are to be made and how much delay should occur between each action (loop delay). I am relatively new to labview and completely new to the LINX add-on. Please let me know if you have any ideas about what to do about it.

 

Thanks!

 

 

0 Kudos
Message 1 of 4
(4,083 Views)

Well on the LabVIEW side of things here are the standard links we give for free training.

 

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

 

Learn NI Training Resource Videos

3 Hour LabVIEW Introduction

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training

 

As for LINX there is a dedicated forum to it if you have specific questions.

 

https://www.labviewmakerhub.com/forums/viewforum.php?f=12

 

But generally opening a VI, looking at the inputs it takes, the outputs it gives, and opening the context help to show the description should be enough to get going.

 

One thing you'll need to keep in mind is that this control of the Arduino is going to be software timed.  A serial request will go out to the Arduino to perform some action, then it will perform that action, then it will send back a serial reply back to the PC.  Only after these actions take place will the loop go back around and request another action.  What I'm saying is don't expect to turn on and off a relay in say less than 5ms consistently.  You might be able to get it down to 1 or even less, but it will probably have +/- 3ms.  Have you ever been using a PC and the mouse stops responding?  Or the UI locks up?  There is a good chance that during that your requests will stop going out too.  Just be aware that this type of setup might work just fine for you, but for safety critical, or timing critial operations, a different setup would probably be better.

0 Kudos
Message 2 of 4
(4,046 Views)

Thank you for your help! This control scheme I am using is to inflate/deflate a blood pressure monitor sensor. Most of the experimental schemes require performing a press-release sequence every 5-10 seconds. For this puspose, timing is not that critical so the margins you mention are quite good considering what I need. I tried using typical loop counters and techniques but, like you mentioned, the way the arduino control is set up does not work with these techniques. 

Thank you for commenting on the set up as well. Do you have any suggestions about another possible way I can do this?

 

0 Kudos
Message 3 of 4
(4,033 Views)

@taxochacon wrote:

Most of the experimental schemes require performing a press-release sequence every 5-10 seconds......like you mentioned, the way the arduino control is set up does not work with these techniques. 

 


On the contrary, I was trying to state that you shouldn't use an Arduino and LINX for tight timing (less than a couple of ms) but that you should probably use it for slower control.  5-10 seconds is slower control so this setup should work fine for you.  You can probably start with an array of numerics on the front panel, which represents the time between presses, then in a for loop perform a wait, turn turn the digial on (with a boolean constant) then off (another boolean constant).  Sorry I don't have 2014 so I would have to back save, and and I don't have LINX so there are missing VIs, I don't know if it will open right for you.  You'll need to wire up the broken wires between functions, and wire the boolean constant.

Message 4 of 4
(4,017 Views)