From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pump conteol

Solved!
Go to solution

Hello,

I want to control my garden pump such a way, so that the pump can irrigate/run 2min at every 15 min time interval for 24 hours/whole day. I will control the pump using Arduino UNO and relay. I have attached my "Pump control VI" here.

 

TIA

0 Kudos
Message 1 of 15
(3,916 Views)

Hi Milon,

 

I want to control…

Ok. And what is your problem?

 

run 2min at every 15 min time interval for 24 hours/whole day.

REPEAT
  switch pump on
  wait 2*60s
  switch pump off
  wait 13*60s
UNTIL stop

This pseudocode looks rather simple…

 

Recommendations:

- You might think about a state machine.

- Generally it's a bad idea to wait for 13min - it's much better to wait 156 times for 5s…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 15
(3,866 Views)

Hi Mr. Gerd,

 

Thanks for your reply. but where and how can I put this code in my attached VI? Would you modify my attached VI according to your suggestion, please?

0 Kudos
Message 3 of 15
(3,863 Views)

Hi Milon,

 

it's very basic code you need: a WHILE loop, two times the switch command and two times a wait function. I guess you are able to implement this on your own much faster than waiting for help from this forum… 😄

(I still recommend to use a state machine approach and no waits longer than 5s!)

 

If you aren't able to implement this you should take the LabvIEW beginner courses - offered for free on NIs website!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 15
(3,860 Views)

Just my 2 cent: 

Remember that your PC also needs to be on and connected to the UNO for this to work. Your LabVIEW code is not running on the the UNO, but on the PC and then talking to the UNO. 

Message 5 of 15
(3,850 Views)

Hello Mr. Gerd,

Did you mean this type (attached) of VI? It is not working on my computer. Actually, the "wait" function doesn't work now-a-days. Is there any alternative?

 

TIA

0 Kudos
Message 6 of 15
(3,828 Views)

Hi Milon,

 

It is not working on my computer.

Surely it's working - exactly as you programmed it!

In the loop you initialize an output pin, then you set it to zero. The loop will wait for 30s, then it will reiterate (most probably as there is a race condition). In the second iteration you again initialize an output pin and set it to zero. The loop will again wait for 30s, then it will stop (most probably as I don't know the internal settings of the ElapsedTime ExpressVI). After the loop stops the output is set to 1 and the device is "closed"…

Lesson learned: we cannot debug images!

 

Actually, the "wait" function doesn't work now-a-days.

What's wrong with the wait function? Does the loop take 30s to iterate - or does it behave different?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 15
(3,813 Views)

Hello Mr. Gerd,

I used the 'Elapsed Time' option to run the while loop for a specific time. I have explained my code in attached VI. Using 'elapsed time' option I can control my pump manually but I want to make an automated control code. I explained the time sequence in my 1st status. If I use only "wait" option, then the while loop doesn't stop after finishing the specified time. 

 

 

Message 8 of 15
(3,787 Views)

Hi Milon,

 

the pump can irrigate/run 2min at every 15 min time interval for 24 hours/whole day.

Why do you want to stop your loop at all? It should run until you stop your automatic control…

As described by the pseudocode above you need to switch on/off the motor inside the loop!

 

To give an idea:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 15
(3,784 Views)

Hello,

Thanks for your patience. I tried according to your suggestion. when I run the code, indicator boolean showed on and off state. But the problem is relay switch doesn't off (always on).

Download All
0 Kudos
Message 10 of 15
(3,775 Views)