LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Relay control via time

Solved!
Go to solution

Hi everyone,

 

 I am fairly new to Labview. I want to control pump using Arduino UNO circuit, Relay, and Labview. My assignment is running a pump for a certain period of time like 2 min or 5 min. I tried by using "Elapsed Time" option of LabView but can't turn off the relay after elapsed time.

 

I have attached my LabView code here. please suggest me for a solution. Thank you for time and assistance in advance.

 

Download All
0 Kudos
Message 1 of 13
(6,277 Views)

Hi Milon,

 

once the time has elapsed you finish your loop and close the connection to the Arduino.

How do you want to control the relay without having a communication to the Arduino?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 13
(6,260 Views)

While it is fine to post pictures of your Arduino board, it is not so helpful to post pictures of your code.  Please post your actual VI (i.e. attach the file that has the extention ".vi").

 

Bob Schor

Message 3 of 13
(6,230 Views)

try inserting a "not" function at the bool output of your timer, connected to your "write".  Smiley Wink

 

Message 4 of 13
(6,208 Views)

Hello Mr. GerdW,

 

At first thanks for your quick response. Actually, the relay is connected to Arduino UNO (Powered from Arduino circuit and Digital I/O pin is also connected). I thought If the loop is finished, Arduino circuit along with relay will be closed. but the relay is not closing. Here is the problem....

0 Kudos
Message 5 of 13
(6,190 Views)

Hello Mr. Bob_Schor'

 

Thanks for your quick reply. Here is my VI Code...

0 Kudos
Message 6 of 13
(6,189 Views)

Mr. Apok'

 

Would you explain your suggestion? Apologies, I can't find out that place....

0 Kudos
Message 7 of 13
(6,177 Views)
Solution
Accepted by topic author Chowdhury_Milon

No need to create 3 messages to reply to different people and attach the same VI twice.

 

Your VI runs for 5 seconds.  During that time, your relay will open or close each time you press your switch.  Once the time is up, the loop ends.  It will leave the relay in whatever state is was the last time you pressed the button.

 

If you want to do something when the loop ends, then create another digital write outside the loop that executes before you close the connection.

Message 8 of 13
(6,174 Views)

Realy.png

 

 

Try this Method

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
Message 9 of 13
(6,171 Views)
Solution
Accepted by topic author Chowdhury_Milon

Hello PalaniveIT,

 

Thanks for the guidelines. I made a code according to your guideline. but two problems occur 1) after elapsed time (5sec) it starts automatically, 2) It runs for 4 sec, not 5 sec. 

 

Time will be adjusted but I want the relay off permanently after 5 sec. I have attached the code for your verification.

0 Kudos
Message 10 of 13
(6,164 Views)