Relay interface circuit for Vector VN5640 DAIO PORT

At times it is necessary to drive the relay through programming interface to automate some tests.

This post provides an implementation hint to work with CAPL and an interface circuit to drive a relay using Vector DAIO /DIO interface.

It is advised to read CAPLQuickstart_Generic_2018_Final.PDF as a preparation to understand CAPL usage in the context of CANoe. The document is available in vector website for download.

Vector IO configuration

Please use Vector I/O configuration page to set the pin mode correctly. after the configuration, each pin is accessible through system variables.

Please refer to VN5000_Manual_EN.PDF for additional details.

Interface circuit

This interface circuit is compatible with vector VN5640 port IO19. PIN 2 (DIN2) is used as digital output. This digital output has is push-pull arrangement to drive output.

Relay interface circuit to use wtih VN5640 port IO19

GROUND LOOP & Protection circuit

To reduce potential device damage due to ground loops and potential differences between different devices in the test setup, some additional protection measure is necessary.

For this example, the following measures take care in the interface circuit.

  • PIN 9 (Digital GND) is connected to relay card GND using 100R serial resistor.
  • PIN 2 (DIN2) is connected to relay driver input pin using 100R serial resister. The relay driver itself has 1K serial resistor to drive the 12V relay. Relay when driven consumes about 30mA.

Simulation setup for CANoe

Minimal Simulation setup for DIO(DAIO) control

CAPL program

According this example program, when key ‘a’ is pressed, the output is turned OFF and when key ‘b’ is pressed, the output is turned ON.

on key 'a'
{
 @IO::VN5600_1::DIN2 = 0;
}

on key 'b'
{
  @IO::VN5600_1::DIN2 = 1;
}

Hope this helps. For typical use-case, instead key-press event, any other available events can be used by adapting the CAPL. However, the concept remains same.

Leave a Reply

Your email address will not be published. Required fields are marked *

Jayakumar Sengottuvel
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.