Going Wireless – Connecting HMI to PLC via ZigBee

Going Wireless - HMI to PLC (872KB).pdf

In this guide, we will look at how to setup a wireless communication between an HMI and a PLC via ZigBee modules.

What you need

All of these:

  • A Programmable Logic Controller (a Homer XL7 series is used)
  • An HMI (a PanelMaster PT043 is used)
  • Two ExpertDAQ Serial to ZigBee Converters (EX-9212-ZigBee-S)
  • Cscape 9.6 installed on a PC (free download link from our website)
  • PM Designer installed on a PC (free download link from our website)

For RS-485 connection

  • Loose wires
  • An Ethernet cable

For RS-232 connection

  • Horner Programming Cable (HE500CBL300A)
  • RS-232 serial cable
  • Null Modem cable
  • RS-232 male-to-male gender changer

Introduction

ZigBee is a communication protocol for low power radio networks. It has a transmission distance of up to 200 meters line-of-sight with a defined rate of 250 Kbit/s. High power modules are also available to transmit up to 800 meters. This suitable for a wide range of applications covering industrial and domestic use. It includes:

  • Point-to-point cable replacement
  • Security systems
  • Environmental control
  • Lighting control
  • Home automation (e.g. doors, gates, curtains and blinds)
  • Industrial automation (e.g. plant monitoring and control)

ZigbeeAn overview of the connection is shown at left.

These Serial-to-ZigBee Modules are capable of converting any signals from serial connections to ZigBee protocol, which can then be transmitted wirelessly.

In this case, we are connecting the HMI and PLC to the ZigBee modules via serial cables using Modbus RTU protocol. The signals will be transmitted wirelessly by ZigBee so a communication can be established between the HMI and PLC.

 

 


 

Horner PLC Modbus RTU Configuration

We will setup the PLC as a Modbus slave.

RS-485

Open Comm Port 400Open Cscape and create a new project for the PLC. Under Tools > Project Toolbox > Comm Operations, select Open Communication Port, and place it in a rung with an always on contact in front of it. Open the configuration box and use the following settings.

 

 

 

 

 

 

 

Comm Modbus Slave 400Under the same category, place Modbus Slave Communications in a rung with an always-on contact at the beginning of the rung. Use the following settings.

Note: the slave ID is unique for each Modbus slave module; use different IDs for multiple slaves. Select a register of your own choice for the status. Refer to Cscape Help for detailed status code.

 

 

 

 

 

 

 

RS-232

For RS-232 connection change the Port to MJ1


 

PanelMaster HMI Configuration

The PanelMaster HMI will be setup as a Modbus Master device. It allows the HMI to monitor and control multiple PLCs and end devices. In this case, we are only connecting it to one PLC.

RS-485

Link Properties 400First, create a project in PM Designer. Use these settings for Link 1.

Note: multiple links to slave modules can be created on RS-485, just use the same Slave ID in the PLC Address box.

 

 

 

 

Link Properties 2 400

 

 

 

 

 

 

 

 

RS-232

For RS-232 connection, change the link port to COM1.


Connection to ZigBee Modules

ZigBee modules are paired and configured prior to shipping. The transmission parameters are set as the following: baud rate – 9600, data bits – 8, parity – none, stop bits – 1.

RS-485

Horner PLC

RCX116~251 400On the side of the Horner RCX unit, set configuration switches 2 & 3 on for RS-485 connection according to RCX Datasheet.
image2 400

 

 

 

 

 

Take a regular Ethernet cable, cut the connector off on one side and strip the two wires that will be connected to Pin 1 & Pin 2 of the MJ port. For RS-485, Pin 1 is Rx/Tx+ and Pin 2 is Rx/Tx-. Plug the cable into the MJ port on the side of the PLC and connect Pin 1 to D+ and Pin 2 to D+ terminals on the ZigBee module. See the connection below.

 

 

 

 

 

PanelMaster HMI

image1 400Get two pieces of wire and strip both ends off. On COM2 at the back of the HMI, connect 485 + and 485 – to the D+ and D+ terminals on the ZigBee module accordingly. It should look like this.

 

If a communication is established, we should see the RX and TX lights flashing on both ZigBee modules.

 

 

 

 

RS-232

For RS-232 connection, follow the instructions below:

HMI COM1 port — male-to-male gender converter — RS-232 serial cable — Null Modem cable — ZigBee Module RS-232 port

Horner RCX MJ1 port — Horner Programming Cable (HE500CBL300A) — ZigBee Module RS-232 port

Note: RS-232 connection only allows one-to-one communication.


 

Data transmission test

To test the connection, we will set up a simple program to verify that the HMI can read and change register values in the PLC.

Cscape Help 400To control coil m1 and holding register r1 in the PLC, we have to use Modbus Master Addresses in the HMI, which is 3001 and 43001 according to Cscape Manual.

 

 

 

 

 

 

Tag Table (AP_1) 400In PM designer, go to Tags and create two tags as left. Place a toggle switch and a numeric entry object on the screen and assign these two tags to them.

Cscape - Rung 400In Cscape, create two rungs as the following.

 

 

 

Now, if we toggle the switch or change the value in the data box in the HMI, the corresponding bit and register value should also change in the PLC and vice versa.

Zigbee Demo_AP_1 400When debug mode is turn on in Cscape while the PLC is connected to it. The states and values of bits and registers can be viewed in Cscape. In the screenshots , we can see the values on the HMI screen match those in the PLC.

 

 

 

 

 

 

Cscape 400If the values are changed in the PLC, they will also change in the HMI. To change a register or bit value, right click on the rung and add them to watch, the values can then be changed in the watch box. If the values are changed in the PLC, they will be also updated on the HMI screen.

 

 

 

 

 

 


 

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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