| Index >> Technical support & download >> Application notes
AN27: I/O Controller - connecting relay to 230V AC
I/O Controller can read states of digital inputs and control 8 outputs over network. Inputs and outputs are designed for low voltage up to 50V. This application note describes how to connect relay to I/O Controller. You can control 230V AC (110) device over external relay or detect voltage over switching contact of 230V AC relay.
I/O Controller product offers:
- 8 inputs for voltage 5 to 20V DC
- 8 transistor outputs for voltage circa 12V / 300mA (max. 50V)
- serial port RS-232/485
This application note describes:
- Measuring of voltage 110/230V (2x 230V relays)
Two 230V relays, contacts are connected to I/O Controller inputs.
- Control of 110/230V voltage (2x 12V relays)
Two 12V relays, controlled I/O Controller outputs, relay contacts control voltage area 110/230V
- Applications of SW solution
Overview of application that can be used for control
Note: I/O Controller inputs can be controlled from any contact, for example from button or switch that uses 12V power supply I/O Controller. Here are used Relay contacts for clearness.
Connecting scheme
Details of inputs and outputs connecting to I/O Controller:

Inputs
We connect 2 relay contacts to inputs I.0 and I.4. We use I/O Controller as a power source (typical 12V).
- Connect collective ground of inputs (I.GND) to device ground (GND) - marked (a) in scheme.
- Connect I/O Controller input (for instance I.0) to relay contact (see relay number terminal 14)
- I.0 input connect to power supply (PWR) (see terminal 21)
- Connect contact of the second relay to I.4 - see scheme
Outputs
Connect inductor of 2 relays relay to outputs O.2 and O.4. We use I/O Controller as a power source (typical 12V) to control relay.
- Connect output of surge guard (O.COM) to device power supply (PWR) (marked as b in scheme)
This connection protects I/O Controller from spike of relay inductor.
- Connect I/O Controller output (O.2) to relay inductor (relay terminal A2)
- Connect the second relay inductor (see A1) to power supply of I/O Controller (PWR)
- Connect the second relay controlled from output O.4 same way - see scheme.
If you need control output relays to other voltage than I/O Controller device power is (up to 48V DC), check the scheme: Power for the output relays from external 24V DC power source.
SDK library control
SDK (Software Development Kit) is available for free upon request to simplify control of I/O Controller. This library will save your time and money for developing own applications for I/O Controller.
SDK consists functions as:
- Network search for I/O Controller (UDP Search)
- Device IP address setting (UDP Config)
- I/O pins control (read bit/byte, set bit/byte)
- Remote setting of serial port parameters (speed, parity, etc.)
- Receive information of I/O Controller input state change without established TCP connection (I/O Controller is TCP client)
The library contains transparent manual describing interface. Examples in different program (MS Visual Basic, Delphi, Borland C++, C# etc.) languages are available for free to illustrate applications of SDK library.
>> HWg SDK (Software Development Kit)
Control of relay over HW Virtual Serial Port
- Connect I/O Controller to Ethernet and power supply.
- Install HW Virtual Serial Port (download from HW Virtual Serial Port)
- Click “HW_VSP.exe“ to run application
- Click on Find Modules button on UDP Search tab and select MAC address of your device from list
- Switch to Binary I/O tab where all I/O Controller inputs and outputs are displayed
- Click Read Values to reload values of outputs and inputs.
- Set switches to desired values and click Set Values. By doing this you change of device outputs You can hear a click in case you change output that relay is connected to.
Different program languages examples to control relay
You can use basic program language application to control relay connected to I/O Controller. Sample examples for program languages are available on I/O Controller page for free.
Relay control over C++
Simple communication examples with common TCP/IP device in Borland C++ Builder 6.00. The example demonstrates simple terminal client and basic NVT commands (Network Virtual Terminal).
Relay control over Delphi
Simple communication example with common TCP/IP device in Borland Delphi 5 demonstrates simple client terminal including basic NVT commands (Network Virtual Terminal) and extention for I/O functions.
Relay control over MS Visual Basic
Very simple routines for using NVT commands and TCP/IP device through Winsock in MS Visual Basic 5.0. Very simple commands for remote control of I/O Pins are implemented, TEA not.
Relay control over Java
Very simple method to control remote I/O pins via JAVA application. The application can be modify according to your wish
Relay control over PHP
Very simple method to control remote I/O pins of I/O Controller. User loads a WWW page from PHP server which takes following actions before response: opens connection to IP address and port, reads values, closes connection to binary device and displays loaded values to the user on the WW page.
Related products and links
- HW Virtual Serial Port
Virtual serial port for PortStore, PortBox and serial line converter firmware of Charon modules. HW VSP is designed for Win 2000 higher.
- I/O
Controller
I/O Controller is a unit connecting to Ethernet, managing 8x binary inputs, 8x binary outputs and RS-232/485.
All interfaces are available over network via M2M protocol via TCP/IP.
- HWg SDK
HWg SDK is a library of functions and examples and applications for UNIX and Windows
We are looking forward for your comments and more ...
Zdenek Stupnanek -
Stupnanek@ hwg.cz |