07-11-2017 08:04 PM
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
Solved! Go to Solution.
07-12-2017 02:09 AM
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…
07-12-2017 02:28 AM
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?
07-12-2017 02:31 AM - edited 07-12-2017 02:32 AM
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!
07-12-2017 04:17 AM
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.
07-12-2017 09:30 PM
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
07-13-2017 01:42 AM - edited 07-13-2017 01:43 AM
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?
07-14-2017 03:58 AM
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.
07-14-2017 04:46 AM
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:
07-14-2017 10:01 AM
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).