LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to program a simple relay ON/OFF automatically

Hello Everyone,

Can anyone please tell me how to program a simple relay ON/OFF automatically using DAQ assistan? I want that the relay switches for each second to the other relay automatically (I have four relays side by side) ? should I use  DAQmx write.vi  or DAQmx read.vi?

 

BR 

0 Kudos
Message 1 of 7
(3,289 Views)

What are you connecting the relay to? Most DAQ cards do not have the drive capability to operate most relays. I say most, because there are relays that can be driven directly, and there are DAQ cards with sufficient drive capability to operate  _some_ relays. As to whether to use read or write, you are trying to "output" a signal, or "write" an output, to the device. You say switches to "the other relay", are you trying to switch back and forth between two relays or just switch one on and off, or is it between two relay positions. A simple loop with the DAQ vi that controls the pin driving the relay, with a shift register on the loop, pass a boolean into the shif register at the start, pass that value into the DAQ vi, invert the signal and connect to the shift register on the right side of the loop. Now, on every iteration of the loop, the value to the DAQ will switch. Put a timer in the loop, wired with what ever loop time you want.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 7
(3,276 Views)

Hello LV-pro,

 

At first I want to read a Signal for one sec.  from relay 1, then output this signal and switch automatically  to the second relay should the same thing happend as in the Relay 1 ( Signal input for one sec. output this signal and then switch autmatically to the third relay...etc)

0 Kudos
Message 3 of 7
(3,268 Views)

I have Idea: at first Create Channel -> Clock-> start task -> ( in loop Read.vi ->  Write.vi) -> clear.. Ist it right? But how I can doing to switch automatically to the other relay? 

0 Kudos
Message 4 of 7
(3,258 Views)

Now you say you want to read. Read what?

 

I have no idea what you mean by 'Clock'.

 

How are your relays connected. Digital outputs? Are they sequentially wired? You can walk a pattern to four outputs (i.e. 0001,0010,0100,1000).

0 Kudos
Message 5 of 7
(3,238 Views)

Hello Deniss, 

I have more Input Signal and only one output, my relay are  sequentially wiredand.  with this realy I can define which input signal I want read it . in each relay is one  Input signal connected. So i want to read the Singal from each relay for one sec so I think i can  use sample clock , After read the signal from one relay i want to output this signal immediately so i thnik i can use Write.vi after read.vi? is´nt true?


BR

 

0 Kudos
Message 6 of 7
(3,229 Views)
You still haven't explained what you want to read. Analog, digital? What frequency and amplitude?

I still don't understand how the single digital line is controlling four different lines but all you have to is write a 1 and then a 0 in a loop. Connect your DAQ Assistant that does the analog/digital input to the one that does the write with the error in/out connections. This controls execution flow.
0 Kudos
Message 7 of 7
(3,220 Views)