04-24-2024 12:44 PM
Hi,
I am a PhD student and would like to simulate breathing for a medical simulation. My background is not EE but human factors and biomedical science . While I taught myself labview and have been using it in the lab to mainly acquire data and apply filters and graph signals in the past I never used it to drive and control motors. Due to my background I am limited in the concepts behind things like state machines etc and would like . I have been advice which is easy to understand. Looking and many posts I manged to put something together by mixing and matching sample vi and suggestions of posts. I am using 2019 version of Labview evaluation version.
This is my set-up:
I am using two motors, one for filling a ballon (simulated lung), the other one for sucking the air out, it is based on this simple set-up I found
https://www.instructables.com/Nonliving-But-Breathing-Model-of-Lung-Alveoli/
For my experiment I need to control and synchonise other data and another pump, which simulates pulsatile blood flow, so I want to replace this simple set- up with one, which can be controlled in labview.
I am using a mydaq aquisition card, 2 adafruit motors 4700 , (DC Motor - 4.5V, 1.8 LPM) and a L298n motor driver. I connected the PWN pins of the motor driver to AO0 and AO1 and DO channel 0and 1 to In 1&2 and 3&4 to the L298n. I used and adapted what I found here
But Metazoa just wanted control one motor. I need to control 2, where one is off and the other one is running and then switch. So instead of using the Elvis user interface, I found a NI Elvismx digital writer vi. It works, but but worried there is no start and stop. Maybe this is connected to the problem I have?
I would like motor1 to run for 2-3 s and then stop, switch to motor 2 for 2-3 s and stop and run motor 1 again and so on. So far I have achieved to run motor1, stop it then move motor 2 and stop. However I would like to continuously run the motors one after the other in a loop, so once one cycle with motor 1 and 2 is done repeat the cycle until stopped. I read, easiest way is to put the sequence or case structure in a while loop. Also saw that many are not fond of sequence structures so I also tried with case stucture (both attached) but no difference. Nothing ever happens, the two motors do not turn on again. So I thought maybe somehow the first motor needed to be restarted, so I tried some suggested solutions like state machine or two while loops but nothing manages to restart motor one, so the sequence or case structure cannot be rerun over and over again.
As this is just a technical realisation for my experimental set-up, not my research per se and my background is not programming or EE I really need some help with this. I was hesitating to write as many suggestions seem to assume a lot of knowledge or refer to study basic LabVIEW things, which I have attempted, but so much material, which I am lacking knowedge to understand, so much to learn to fully understand these posts, so I hope there is some simple way of doing that if at all possible. I tried also replacing mydaq with Arduino but couldn’t even get any labview programs working with the arduino, nor did the motor even turn on, while mydaq works like a treat. Thank you so muich for your help in advance.
04-26-2024 05:12 PM
Hi Sonja
Thank you for sharing your problem, I have extensive experience with medical applications for pulmonary studies. I developed a data acquisition system for medical doctors to collect data from patients, monitoring pressure, flow and volume from respiratory studies.
What you are trying to achieve is not difficult. You need to split your problem in small pieces. wich you already have.
If I understand you correctly you need one motor to simulate inspiration and a second to simulate expiration then run continuously until you are done. Is this correct ?
What does this Elvis code do ? do you need it ?
then on this part of the code, there is a waveform being generated every iteration (inside of the for loop) before it's written on the Waveform output.
if the waveform is the same (never changes) it can be generated outside of the big while loop and just write the waveform, even without the loop. What kind of waveform you need ? is a sinewave ? Step ?
Try to create a code one for each motor, turn it into a Subvi, create one subvi for each motor, then connect them one after the other, and put them on a loop
04-29-2024 04:11 AM
If you make your user name your email address, the address will be spammed for eternity (the longer it's on the worse it gets).
I strongly recommend you change your user name to something less directly connected to your contact details.
04-29-2024 05:03 AM
Thanks for drawing attention to that. I was not aware of it at all. Thanks. I This is so dangerous and should be changed. I investigated what might have happened. First there is no way in the community profile to change the screen name. After goggling fot a while I found out the one can only change the screenname the NI Profile, but there is no option which is related to the screen name. Only in the profile there is a field called alias. This was automatically completed for me and automatically filled in my e mail. I was not aware of that this will be used as the community screenname, nor did I notice this alias field. It should be explicitly labelled screen name or similar for NI community profile. This is Very, very bad usability and so dangerous. Considering all the international users this should be made explicitly clear and the user ,when filling in this form should be informed that the alias aill serve as the community screen name, and the prefilling of this field should be definitely disabled..! Unbelievable I actually did choose a screen name, but somehow this didn’t get accepted. When I tried to change it I chose the same name and it said it was already in user. I suspect there is some serious bug in there!!! I love to complain about that as this is disclosing identities...Who could I address the complaint to? Would you be able to point me to the relevant responsible? Thank you so much again.
04-29-2024 05:06 AM
It's your alias you need to change in your MyNi Profile tab.
04-29-2024 06:12 AM
yes, thank you. as mentioned I found out that I had to do that. I actually cfreated a test account and it is indeed prefilledin when registering for NI community! While is is not updated in the NI Profile. Bad, bad usability!
04-29-2024 06:41 AM
@SonBio1 wrote:
yes, thank you. as mentioned I found out that I had to do that. I actually cfreated a test account and it is indeed prefilledin when registering for NI community! While is is not updated in the NI Profile. Bad, bad usability!
Sounds serious, although a 1 time annoyance. probably the reason nobody reported it...
NI actually listen pretty well to forum problems here Feedback on NI Community - NI Community.
04-29-2024 06:43 AM
Hi SonBio,
@SonBio1 wrote:
Bad, bad usability!
There's a "Feedback" board where you can post questions/reports/improvement suggestions regarding the forum!