Our offices will be closed Saturday December 23rd through January 1st for the Holidays. Dismiss

LabVIEW Relay switching and Status acquisition 1

In this LabVIEW relay switching article we will learn how to on off a relay, how to check relay status, bank status. These LabVIEW relay drivers will work with most of the ncd.io industrial relay controllers. which can be found over here

Industrial Relay Controller For labview

A) Setting a Relay ON/OFF and getting Status in Current Bank

This guide shows how to turn a relay ON take status, then wait 5 seconds, turn it OFF and again take status.

This VI handles relay in current bank which is set with another command.

Related Example in Driver: Relay on off Current Bank status.vi

VIs Required:

–> Initialize (Main Palette)

–> Relay On Off Current Bank/ Relay On Off Poly (Action Status->Current Bank Directed Palette)

–> Read Relay Status Current Bank / Read Relay Status Poly (Action Status->Current Bank Directed Palette)

–> Close (Main Palette)

Following figure shows the steps for this guide. Their detail follows the figure.

 

Details of steps is as under.

  1. Port is initialized in Initialize VI with fixed baud rate of 115200.
  2. Relay On Off Poly VI is placed. This polymorphic VI supports 2 types of commands, one is for Current Bank and other is bank directed. Here we will use Current bank command therefore that is selected from Poly selector. It sends the command and also verifies the returned status.
  3. Relay Number control is connected to select relay in current bank.
  4. A true value is passed to On/Off terminal which indicates that Relay On command should be sent.
  5. Read Status Poly VI is placed. This polymorphic VI supports 3 types of commands. Here we will use Current bank command. It sends command to read status of relay and returns it.
  6. Status returned is displayed both as numeric and Boolean in indicators.
  7. Next, 5 seconds delay is introduced by forcing dataflow using sequence structure.
  8. Relay On Off Poly VI is placed which was used in Step 2.
  9. This time a False value is passed to On/Off terminal to send relay Off command.
  10. Read Status Poly VI is placed as done in Step 5 to read new status after Off command.
  11. Status result is passed to indicators.
  12. Port is closed.
  13. Text boxes for TX and RX data are placed and their references are passed to the Instrument VI which display the serial data sent and received by the instrument driver.

 

Front Panel during Operation (Relay ON)

Labview usb relay bank

Front Panel during Operation (Relay OFF)

labview relay status


B) Setting All Relays ON/OFF in Current Bank

This guide shows how to turn all relays On or Off in currently selected relay bank.

Current bank can be set with another command.

Related Example in Driver: Relay on off all Current Bank.vi

VIs Required:

–> Initialize (Main Palette)

–> Relay On Off All Current Bank (Action Status->Current Bank Directed Palette)

–> Close (Main Palette)

Following figure shows the steps for this guide. Their detail follows the figure.

Details of steps is as under.

  1. Port is initialized in Initialize VI with fixed baud rate of 115200.
  2. Relay On Off All Current Bank VI is placed. It sends the command and also verifies the returned status. A true value is connected to On/Off terminal to send relay On command
  3. Next, 5 seconds delay is introduced by forcing dataflow using sequence structure.
  4. Relay On Off All Current Bank VI is placed which was used in Step 2. This time a False value is passed to On/Off terminal to send relay Off command.
  5. Port is closed.
  6. Text boxes for TX and RX data are placed and their references are passed to the Instrument VI which display the serial data sent and received by the instrument driver.

 

Front Panel during Operation

Since Status is not fetched in this guide, therefore front panel will show no change, however, you can observe relay switching on hardware.


C) Setting a Relay ON/OFF and getting Status in Selectable Bank

This guide shows how to turn a relay ON take status, then waits 5 seconds, turn it OFF and again take status from selectable bank.

Related Example in Driver: Relay on off Selectable Bank status.vi

VIs Required:

–> Initialize (Main Palette)

–> Relay On Off / Relay On Off Poly (Action Status->Selectable Bank Directed Palette)

–> Read Relay Status / Read Relay Status Poly (Action Status->Selectable Bank Directed Palette)

–> Close (Main Palette)

Following figure shows the steps for this guide. Their detail follows the figure.

Details of steps is as under.

  1. Port is initialized in Initialize VI with fixed baud rate of 115200.
  2. Relay On Off Poly VI is placed. This polymorphic VI supports 2 types of commands, one is for Current Bank and other is bank directed. Here we will use the Bank directed command, selected from Poly selector. It sends the command and also verifies the returned status.
  3. Relay Number and bank number control is connected to select relay in current bank.
  4. A true value is passed to On/Off terminal which indicates that Relay On command should be sent.
  5. Read Status Poly VI is placed. This polymorphic VI supports 3 types of commands. Here we will use Bank directed command. It sends command to read status of relay and returns it.
  6. Status returned is displayed both as numeric and Boolean in indicators.
  7. Next, 5 seconds delay is introduced by forcing dataflow using sequence structure.
  8. Relay On Off Poly VI is placed which was used in Step 2.
  9. This time a False value is passed to On/Off terminal to send relay Off command.
  10. Read Status Poly VI is placed as done in Step 5 to read new status after Off command.
  11. Status result is passed to indicators.
  12. Port is closed.
  13. Text boxes for TX and RX data are placed and their references are passed to the Instrument VI which display the serial data sent and received by the instrument driver.

 

Front Panel during Operation (Relay ON)

Front Panel during Operation (Relay OFF)


D) Setting All Relays ON OFF in Selectable Bank

This guide shows how to turn all relays On or Off with bank selection.

Related Example in Driver: Relay on off all Selectable Bank.vi

VIs Required:

–> Initialize (Main Palette)

–> Relay On Off All (Action Status->Selectable Bank Directed Palette)

–> Close (Main Palette)

Following figure shows the steps for this guide. Their detail follows the figure.

Details of steps is as under.

  1. Port is initialized in Initialize VI with fixed baud rate of 115200
  2. Relay On Off All Current Bank VI is placed. It sends the command and also verifies the returned status. A true value is connected to On/Off terminal to send relay On command
  3. Next, 5 seconds delay is introduced by forcing dataflow using sequence structure
  4. Relay On Off All Current Bank VI is placed which was used in Step 2. This time a False value is passed to On/Off terminal to send relay Off command
  5. Port is closed
  6. Text boxes for TX and RX data are placed and their references are passed to the Instrument VI which display the serial data sent and received by the instrument driver.

 

Front Panel during Operation (Relay ON)

Since Status is not fetched in this guide, therefore front panel will show no change, however, you can observe relay switching on hardware.


E) Setting a Relay ON/OFF and getting Status using Relay Address

This guide shows how to turn a relay ON, take status, then waits 5 seconds, turn it OFF and again take status by using Relay address. There is no requirement of incorporating bank in these commands.

Related Example in Driver: Relay on off Relay Addressable status.vi

VIs Required:

–> Initialize (Main Palette)

–> Relay On Off Relay Addressable (Action Status Palette)

–> Read Relay Status Relay Addressable (Action Status Palette)

–> Close (Main Palette)

Following figure shows the steps for this guide. Their detail follows the figure.

Details of steps is as under.

  1. Port is initialized in Initialize VI with fixed baud rate of 115200.
  2. Relay On Off Relay Addressable VI is placed. It sends the command and also verifies the returned status for the Relay addressed. Relay Number control is connected to select relay. A true value is passed to On/Off terminal which indicates that Relay On command should be sent.
  3. Read Relay Status Relay Addressable VI is placed. It sends command to read status of relay and returns it. Status returned is displayed both as numeric and Boolean in indicators.
  4. Next, 5 seconds delay is introduced by forcing dataflow using sequence structure.
  5. Relay On Off Relay Addressable VI is placed which was used in Step 2. This time a False value is passed to On/Off terminal to send relay Off command.
  6. Read Relay Status Relay Addressable VI is placed as done in Step 3 to read new status after Off command. Status result is passed to indicators.
  7. Port is closed.
  8. Text boxes for TX and RX data are placed and their references are passed to the Instrument VI which display the serial data sent and received by the instrument driver.

 

Front Panel during Operation (Relay ON)

Front Panel during Operation (Relay OFF)

 

To Download the Labview Relay Driver and relay controller checkout Installing Labview relay controller Driver.

 

ControlAnything.com and ControlEverything Site Migration Notes

©2017 National Control Devices, LLC

ncd.io

To learn something new, take the path that you took yesterday. ~John Burroughs

Log in with your credentials

or    

Forgot your details?

Create Account