« Close

Datasheets and User Guides

App Notes

Software & Driver


Controlling Relays (App Note)

Using a LJTick-RelayDriver Accessory

An LJTick-RelayDriver is a low cost option for controlling relays.  Each LJTRD provides 2 low-side switches that can hold off up to 50V (DC only) and pass up to 200mA, so it can control almost any mechanical or solid-state relay.  You can get 5V from the LabJack and control that with the LJTRD, but if your relays require a different control voltage you will have to provide that.


Using a PS12DC Accessory

The PS12DC provides 12 high-side switches that can source 5V from the LabJack or control any DC voltage up to 28V provided by your external supply.  In some cases, the relay itself isn't even needed since the PS12DC can switch power (up to 28V, 750mA) directly. Please see the PS12DC datasheet for details. 


Using an RB12 Accessory

The RB12 is a good option for controlling up to 12 loads with high voltage (AC or DC) and/or high current.  The PS12DC tops out at 1.5A, but some modules that are compatible with the RB12 are rated up to 3.5A. If you buy an RB12, you will have to purchase the relay modules separately. Please see the RB12 datasheet for more details.


Directly with Analog Outputs (DAC lines)

Per the specifications in each devices datasheet, the DACs can generally source more current that digital outputs.  They can source enough current to control almost any SSR and even some mechanical relays, and thus can be a convenient way to control 1 or 2 relays.  With the DACs you would typically use a sourcing configuration (DAC/GND) rather than sinking (VS/DAC).


Directly with Digital I/O

Controlling standalone relays using solely digital I/O requires a little more attention to details, but is still very easy.  The important detail to note is that all of the digital I/O lines on a LabJack have series resistance that restricts the amount of current they can sink or source.  This being known, most solid-state relays (SSRs) can still be controlled directly by the digital I/O.  The best way to control relays is to connect the positive control terminal of the SSR to the LabJack’s VS (~5 volts) terminal and connect the negative control terminal to a digital I/O pin.  This is known as “sinking configuration” and essentially inverts the logic necessary to control the relay.

Using a LabJack USB/Ethernet/WiFi Multifunction DAQ device to control Solid-State Relays with digital I/O channels

Figure 1. Relay Connections (Sinking Control, High-Side Load Switching)

Our devices have "tristate" digital I/O.  To control an SSR in the sinking configuration as shown above, the two important states are:

  • Output-Low:  Causes the control current to flow which turns on the relay.
  • Input:  Causes the control current to stop flowing which turns off the relay.

The third available digital I/O state, which is not recommended, is:

  • Output-High:  Might put the SSR control voltage in a region that is not defined by most manufacturers.


Jameco is a good source for bargain SSRs.  We use the 176719 often for AC output control, and they also have DC output relays.

For the following example, the Series 1 (D12/D24) or Series T (TD12/TD24) relays from Crydom were used.  They are specified to have a max turn-on of 3.0 volts, a minimum turn-off of 1.0 volts, and a nominal input impedance of 1.5kΩ. The following is how a U3/U6/UE9/T7 performs in each of the three modes when modeling the relay as a simple resistor:


When the digital line is set to output-low, it is the equivalent of a ground connection with 180 Ω (EIO/CIO) or 550 Ω (FIO) in series.  When using an EIO/CIO line, the resulting voltage across the control inputs of the relay will be about 5*1500/(1500+180) = 4.5 volts (the other 0.5 volts is dropped across the internal resistance of the EIO/CIO line).  With an FIO line the voltage across the inputs of the relay will be about 5*1500/(1500+550) = 3.7 volts (the other 1.3 volts are dropped across the internal resistance of the FIO line).  Both of these are well above the 3.0 volt threshold for the relay, so it will turn on.

Input Mode:

When the digital line is set to input, it is the equivalent of a 3.3 volt connection with 100 kΩ in series.  The resulting voltage across the control inputs of the relay will be close to zero, as virtually all of the 1.7 volt difference (between VS and 3.3) is dropped across the internal 100 kΩ resistance.  This is well below the 1.0 volt threshold for the relay, so it will turn off.


When the digital line is set to output high, it is the equivalent of a 3.3 volt connection with 180 Ω (EIO/CIO) or 550 Ω (FIO) in series.  When using an EIO/CIO line, the resulting voltage across the control inputs of the relay will be about 1.7*1500/(1500 + 180) = 1.5 volts.  With an FIO line the voltage across the inputs will be about 1.7*1500/(1500+550) = 1.2 volts.  Both of these in the 1.0-3.0 volt region that is not defined for these example relays, so the resulting state is unknown.


Optional Configuration (to fix pull-up or turn off issues):

Having problems with your SSR not turning off?  This is not common, but due to the details of some SSR's input circuitry, they can't be modeled properly as a simple resistor.  Even with all parameters seemingly within the SSR specifications, the SSR does not turn fully off.  It seems like small leakage currents can cause the internal diode of some SSRs to remain in a "semi-on" state.  If you think you have this problem, install a pull-up resistor in parallel with the relay control (from the appropriate digital I/O pin to VS).  A resistor between 10k and 27k should be used ... anything larger might not help and anything lower might cause relay turn-on problems.

Note that the most common reason for an SSR to be stuck on is when you are controlling a DC voltage, but are using an AC SSR.  To control a DC load you need a DC-DC SSR (DC control and DC load), not a DC-AC SSR.


Extra notes about SSRs

If you have an AC load that is inductive (motors, transformers..), you need to choose a Random Turn On AC relay. If your load is resistive (light bulbs, toasters...), choose a Zero Crossing AC relay.

If your load is DC, make sure you select a DC relay, since an AC relay will never turn off a DC source.


Extra notes about Digital Outputs

Note that sinking excessive current into digital outputs on the U3 can cause noticeable shifts in analog input readings.  For example, the FIO sinking configuration above sinks about 2.4 mA into the digital output to turn on the SSR, which could cause a shift of roughly 1 mV to analog input readings.  This effect is unique to the U3, but in general sinking or sourcing substantial current on any device can cause slight ground shifts.

Mechanical relays require more control current than SSRs, and cannot be controlled directly by the digital I/O on most LabJacks.  To control higher currents with the digital I/O, some sort of buffer is used.  Besides the LJTRD, PS12DC, or RB12, some options are a discrete transistor (e.g. 2n2222), a specific chip (e.g. ULN2003), or an op-amp.

For specific information about how much current each device can source/sink on digital I/O, refer to the User's Guide or Datasheet:

  • U3 (note #13)
  • U6 (note #13)
  • UE9 (note #15)
  • T7 (note #2)
  • U12 (notes #8 & #9, and see section below)

U12 Notes

The above information applies to the UD-series (U3/U6/UE9) and T-series.

The LJTick-RelayDriver, PS12DC, and RB12, are not designed for the U12. The RB16 relay board is a U12 accessory similar to the RB12.

AO lines:  Like the DAC lines on our other devices, the AO (analog output) lines on the U12 can source substantial current.  They can control all SSRs and even many mechanical relays.  They would typically be used in the sourcing configuration with AOx connected to +RelayControl and GND connected to -RelayControl.

D lines:  The D lines on the DB25 connector do not have any added protection resistors and thus can source/sink substantial current ... up to 25 mA.  They can directly control any SSR in the sourcing or sinking configuration.

IO lines:  The IO lines have 1500 ohms of series resistor that makes them unable to directly control most relays.