Connecting the Extension xG18 to Mervis IDE

Are you looking for an affordable temperature measurement solution, need to read the temperature at longer distances, or want to automate a boiler room? Then the Extension xG18 is the ideal solution.

This compact module is designed as a simple and reliable tool capable of reading temperature from up to 8 Unipi 1-Wire temperature sensors (DS18B20). Modbus RTU protocol on RS-485 serial line is used to provide the data to the control system.

Patron
Neuron
Gate
Axon
Extension

Each 1-Wire channel is dedicated for just the one 1-Wire sensor with a RJ45 connector, which highly increases reliabily of the measurements.

The following guide will lead you through both hardware and software settings, and will also show you how to set it up in Mervis IDE.

Prerequisites:

Extension xG18 communicates with the PLC using a two-wire RS-485 connection. The module can be powered by the same power source as the PLC (if the power supply's specification allows it). Alternatively, you can use a standalone 5-24 V⎓ power supply. As to temperature sensors, simply plug them into the available RJ45 ports.

Create a new project or integrate the device into an already-existing one. Follow the steps below:

In case of adding the module to an already existing Modbus RTU channel, make sure the communication parameters (parity speed, etc.) are set correctly. If so, continue with Chapter 2.1.

Alternatively, create a new channel. Right-click on the PLC's name and choose Add Channel. Set its name to Modbus_RTU.

Set the newly added channel to Modbus.

Now you need to set up serial communication parameters. Go into channel properties and set the link protocol to Serial. Scroll down to Serial line parameters and enter the number of the RS-485 port the xG18 is connected to. Enter bitrate value and set parity (must correspond with the module settings). Set the number of stop bits to ONE and Data bits to 8.

Deploy the solution to upload the channel into the PLC.

Now we need to add a device to the channel. You can do it bu Autodetection, or, if you don't have the xG18 at hand, manually.

2.1 Automatic detection using module autodetect

Right-click on the Modbus_RTU channel and choose Unipi - modules autodetect.

PLC has to be switched into a so-called Commissioning mode. Click on Next.

Now enter the address range for autodetection and click on Next. By default, Extension xG18 is set to address 15.

After the autodetection finishes, a list of detected Unipi devices will appear. Tick the Import box next to the xG18 and click on Next.

2.2 Manual addition using a library device

Right-click on the Modbus_RTU channel and click on Add Library Device.

Expand the Unipi technology folder and then the underlying RS-485 Extensions folder. A list of devices will appear where you will find the Extension xG18. Add it to the Selected devices it either by double-clicking on it or by using the > button. Confirm by clicking on OK.

The Extension xG18 is added to the project. Now we have to set the correct Modbus address, which has to correspond with the actual address configured in the xG18 (by DIP switches or via SW configuration). Select the xG18 in the Left panel and move over to the Properties. Look for the section called “Modbus Device Parameters” and set the “Modbus address”.


If you successfully added the device using any of the above-mentioned methods, click on Deploy Solution. All changes will be uploaded to the PLC.

The device is now added and ready for use. Start the debugging mode to test the communication between the PLC and xG18. Click on Start Debugging and switch to Variable Browser. Enter a channel number into the search tab, for example, CH1. As variable generated by Autogen for the xG18 are labelled CH1 to CH8, you can easily find all info about sensor connected to the selected channel, such as its value, measuring period or value validity.

The module communicates via Modbus RTU communication protocol on top of the RS-485 serial line. The communication parameters can be configured either using DIP swiches or via the Mervis IDE function Configure Unipi modules (via Modbus registers). DIP swich configuration provides enough space for most applications while Configure Unipi modules provides additional options - wider range of Modbus addresses, RS-485 parameters, measurement interval and more.

The following communication parameters can be set via DIP switches:

  • Address ……………………………. 1–15 (Address 0 = SW configuration from Modbus registers is used)
  • Baud rate …………………………. 9600 / 19200 baud
  • Parity ………………………………… none / even

Default communication parameters:

  • Number of data bits ……….. 8 bits (cannot be changed)
  • Modbus Address ……………. 15 (default value in Modbus register)
  • Baud rate …………………………. 19200 baud (default value in Modbus register)
  • Parity ………………………………… None (default value in Modbus register)

3.1 Configuration of the module in Mervis IDE

Select the Extension_xG18 device. In the right column check to the Properties tab containing all available settings for the module. Here, you can set Master Watchdog, software Modbus address of the module, baud rate and measurement interval of each 1-Wire channel.

Once everything is set, right click on the Extension_xG18 and select Unipi - Configure module. This will save the configuration to the module.

Upon completing the configuration, make sure to unite the address in device settings and communication parameters in the Modbus channel settings according to the just saved configuration.

3.2 Hardware configuration of communication parameters through DIP switches

DIP switches are used to for so-called HW configuration of the communication parameters. This is OK for most applications and also when the configuration of in Modbus registers is not known. In order to take effect of the DIP switch configuration a power-cycle is needed.

Configuration options of the DIP swiches is described in the table below:

If all switches are set to OFF, (eg. the address is set to 0), the address, baud rate, and parity are determined by the register settings. DIP switch settings are ignored.

DIP switches are intended to set the communication parameters physically. They are useful especially if you don't know register parameters of the device. After setting the switches, save the configuration by rebooting the device - unplug the power supply and plug it back.


If you set everything right, you can start the Debugging Mode and use the Variable Browser to check the communication between xG18 and the PLC.

The temperature regulator project can serve as a perfect example of connecting 1-Wire devices.

Further general info about Unipi Extension modules is available in the Connecting to an Unipi Extension