LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I switch a relay then one second later switch it back?

I am currently doing an experiment where I need to send a digital output signal to a relay, the relay switches, then one second later switches back. I have connected the relay to the CB68-LP board and I can get it to manually switch when I click, but I need this to be an automatic response.

I just need to click a switch so the relay changes and 1s later changes back again. Any ideas?
0 Kudos
Message 1 of 6
(3,179 Views)
So you already did most of the job !
I suppose that you built some kind of a VI, where you can switch the relay upon switching a boolean control. Let's call it "Relay.vi".
One very simple solution :
Build a new VI, with a sequence structure with 4 frames :
in the first frame, put a waiting loop, which will wait until a switch button is pressed;
in the second frame, wire a True boolean constant to your Relay.vi
in the third, place a wait node, and wire a 1000 ms constant to the input
in the forth, place another instance of your Relay.vi, this time connected to a False constant.
It's bot very elegant, but that's the simplest thing that you can achieve.
May that could do to start with ?
More help ?
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 6
(3,179 Views)
> I just need to click a switch so the relay changes and 1s later
> changes back again. Any ideas?

Why not just a sequence with three frames. First fram close, second fram
Wait 1s, third frame open relay?
0 Kudos
Message 3 of 6
(3,179 Views)
The first frame has to wait until the user decide to close the relay. Of course this can be done when the user press the vi "run" button. But that's a bit different since such a vi could not be run in "Run when opened" mode...

To maintain things very basic, my preferred solution would be to put a 3 frame sequence, inside a case structure, triggered by a "Close Relay" boolean, inside a while loop with a stop button.
How many more refined solutions ?
CC
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 6
(3,179 Views)
Why bother with a sequence structure? Use an event structure with a time delay between two relay operations and tie them together with error in/error out.
0 Kudos
Message 5 of 6
(3,179 Views)
Hi Dennis !
"How many more refined solutions ?"
That's one !
I knew that somebody should comment about the inopportunity of sequence structures !
:-))
Chilly Charly    (aka CC)
0 Kudos
Message 6 of 6
(3,179 Views)