Example Code

On/Off Relay Controller Program using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
On/Off Relay Controller Program


Description
The program is setup for 4 analog input channels, 4 analog output channels. The program reads the AI in a loop controlled by the Wait function (software timed data acquisition). The analog data is then passed to the On-Off Control function, which turns on or off the relay based on the input set points and dead band. The Wait function constant is in ms, and can be changed based the need speed of control. On a Windows computer, the max loop speed is 10-100 Hz, depending on system hardware. This example could be modified to use PID control instead of On/Off control.


Requirements

Software:

  1. LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Download RelayController and On-Off Relay programs
  2. Open RelayController and configure the AI and AO channels
  3. Configure logging settings and setpoints.
  4. Connect AI to voltage transducers monitoring your process
  5. Connect AO lines to 5 V relays controlling your process
  6. Run program.

 

Additional Information or References
VI Block Diagram

1.png

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.