LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

actuator program

 
Hi
I am using a linear actuator to simulate the breathing conditions of a breathing machine i'm designing.
I have designed a user command interface that will accept 0-5V as the signal to position the actuator infinitely
from 2cm to 7cm. ( 0 V signal => actuator fully closed ; 5V signal => actuator fully open )
I'm using a potentiometer to control the motion with 1V signal corresponding to 1cm displacement.
I will be using NI 6008/6009 DAQ card for the control.
I have designed a VI for this program and have attached it.
The only control is the dial for breathing rate(breaths/min).The control is as follows:
0-12 breaths/min.-Below Normal breathing
12-20 ''-Normal
above 20-Hyperventilation

I want the program to run in such a way that when the user turns the dial, the normal indicator turns on and the
actuator moves forward and back(one cycle) corresponding to the slider postion from 2cm to 7cm and back from 7cm to
2cm all in that corresponding time period.
For hyperventilation option,same thing happens in 400 ms.
The amplitude and frequency are just indicators of the actual actuator motion in form of chart.
I dont expect you to design the program for me but can you guys give me pointers as what to use and where because
i'm really confused.
Thanks
0 Kudos
Message 1 of 12
(4,723 Views)
Hi,

Let me make sure I understand your application.  You want to be able to control the output amplitude and frequency of a USB 6009.  How will the signal ramp up in voltage from 0V to 5V?  Will the breath look like a sine wave or will it need to ramp up and down at different rates? 

If it is just a sine wave output you can set up the amplitude and frequency of the signal before starting the DAQmx task.  If you need to change the frequency, you will need to stop and start the task with the new frequency.  You may want to check out some of the Analog Output examples (assuming you are using the USB 6009 to output a signal) that ship with LabVIEW to get an idea of how to program your application.  You can find the examples in LabVIEW by going to Help » Find Examples...then select Hardware Input and Output » DAQmx » Analog Generation » Voltage. 




Best Regards

Hani R.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 12
(4,676 Views)
Hi
Im sorry i was unclear.I guess i got it wrong.I want to control the motion of the actuator using Labview and just display the frequency and ampltude of the patterns in the form of sine wave in the chart.
How can i do that?Will i stilll measure the frequency of the DAQ?
0 Kudos
Message 3 of 12
(4,664 Views)
 

Hi,

Seems like you are trying to output a voltage between 0 and 5V and from what I understand you also want to be making some measurements at the same time?  Looking at your code, it does not seem like you have any kind of data acquisition code yet.  Do you have the DAQmx driver installed already?  If you do you should be able to use the regular DAQ assistant to get started.  You can use one DAQ assistant to set up an analog output task and another one to set up an analog input task.  Using that you should be able to output and input voltage at the same time.

If it is an analog input that you are trying to get, you should also be able to make frequency measurements using Express VIs in LabVIEW, specifically the Spectral Measurements Express VI.

Hope that answers your questions.  Here are a few links on Data Acquisition that you might find helpful.

10 Functions in NI-DAQmx
Complete DAQ Tutorial
Which DAQ System Is Right for You_

Regards,

 
Raajit L
National Instruments
0 Kudos
Message 4 of 12
(4,623 Views)

Hi

Thanks Raajit.That was great help.I am trying to output a voltage between 0-5V.I havent got the DAQ USB yet so i haven't put the DAQ code in the program yet.Regarding the measuements,these are not really measurements.I am trying to display the freq and amplitude of the breathing conditions i have selected and displaying them on chart instead of measuring them and displaying them.i.e. the freq and amplitude of the breathing options will be specified in the code.

Could some show me an example of a code where i could select an option with specific conditions (like i have three breathing optons here) and the corresponding freq and amplitude shows up on the chart.

 

0 Kudos
Message 5 of 12
(4,605 Views)
 
 

Hi,

There are a bunch of options that you could try.  It sounds like all you need is a case structure.  With a case structure, you can select different sections of code based on user input or programatic calculations.

You might want to take a look at this link for more information on case structures.

https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/structures/case-structure.html

Something else you could try is using tabs on your front panel (three for all of your breathing conditions).  You can then select the appropriate case based on the tab that is selected on the front panel.

If you are trying to get a specific plot to show up on your chart instead of another plot, then you might want to try using property nodes inside your case structure.  You can just select an active plot and then select the visible property node and set that to visible or not visible. 



I am not sure if that answers your question.  Please let me know if there is something else that you are looking for.

Best Regards,

 



Message Edited by Raajit L on 02-28-2008 07:31 AM

Raajit L
National Instruments
0 Kudos
Message 6 of 12
(4,573 Views)
Hi
Thanks for the option.It really helped.I tried using the case structures here for the three conditions.SO i made 3 case structures.Now the problem is i am using the dial as control and want those three tabs(the 3 breathing conditiond which i am using as indicators not control)to lit up whenever that dial is in that range.Can u tell me how to code this
eg. here option 2:Normal
If breaths>12 & <20
then normal=true

Likewise for all 3 options.What do u suggest using for this?
0 Kudos
Message 7 of 12
(4,543 Views)

amatuer_actuator,

You can use the “In Range and Coerce.vi” to detect a specific range for your dial control. 

Take a look at the example I have posted along with this forum and let me know if something is unclear.



Message Edited by Ryan N. on 03-03-2008 03:15 PM

Message Edited by Ryan N. on 03-03-2008 03:15 PM
Ryan N
National Instruments
Application Engineer
ni.com/support
Download All
0 Kudos
Message 8 of 12
(4,502 Views)
amatuer_actuator,
 
If you would prefer a cleaner, easier solution you can specificy your range directly into the case structure by using a ".."  For Example "1..3" would be used for any value between 1 and 3 on your dial.
 
 
 


Message Edited by Ryan N. on 03-03-2008 05:19 PM
Ryan N
National Instruments
Application Engineer
ni.com/support
0 Kudos
Message 9 of 12
(4,489 Views)
Thanks.Can you send me the example in labview 8.0.I can't open it here because you wrote it 8.5 version.
Thanks again.
 
0 Kudos
Message 10 of 12
(4,452 Views)