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.

 

 

 

 

 

 


 

Getting Started – Horner All-in-One Controllers

Note: If this is your first time using Cscape, please download the Cscape starter guide and follow the steps.

Getting Started with CsCAPE - Autech.pdf

In this guide, we will look at how to setup a Horner All-in-One Controller with Cscape 9.6 software and download a project to it.

Getting Started - Horner All-in-One Controllers (694KB).pdf

What you need

All of these:

  • Horner All-in-One Controller (an XL7 series (HE-XW1E2) is used here)
  • A PC installed with Cscape 9.6 (free download link from our website)

and one of these:

  • An Ethernet cable and switch/router – for download via Ethernet
  • An HE5000CBL300A programming cable and a RS232 Serial cable – for download via MJ programming port
  • Micro SD card – for SD card download
  • USB memory stick – for USB stick download

Project NavigatorCreate a new project

Open Cscape and a project will be automatically created. Go to Tools and bring up the Project Navigator.

 

 

 

 

 

 

Hardware ConfigurationGo to Hardware configuration in the project navigator and select the correct model under Series, Device Type and Model #.

 

 

 

 

 

 

Lan Config

 

Go to LAN1 Config and put in an IP Address that is not being used in the network. Put 255.255.255.0 as the net mask and the gateway address of your network.

 

 

 

 

 

 


Network SetupIP Address Setting

Press the system button on the side of the screen and go to set networks.

In System Menu, go to Set Networks and Change the IP Address to an IP that is not currently in use. Net Mask is 255.255.255.0 and the gateway is the IP address of the Modem to which the controller is connected.

 

 

 

 


 Connection 400pDownload via Ethernet

First, we need to make sure that the controller is plugged in with an Ethernet cable and connected to a switch/router. The PC needs to be connected to the same switch/router so that they are on the same network. Open a project in Cscape. Go to the menu bar and choose Controller > Connection Wizard. Choose Ethernet and type in the IP address manually.

 

Online

Once the controller is connected, you should be able to see the highlighted symbols become active. Click the symbol above the mouse in the picture blow to do a download.

 

 

 

 

 


 

Export 400pDownload Using Micro SD Card & USB Stick

Most models come with a Micro SD Card Slot and a USB port with a storage space no greater than 2GB. That can be used to download your program without the need of a PC.

Go to Cscape and choose File > Export to Removable Media. Save the file to the SD card or USB stick (formatted in FAT32).

 

 

 

 

SD & USBPlug the SD card or USB stick to the back of the device. Go to the setup menu and choose removable media. Select the previously saved program and click the Save PGM button.

 

 

 

 

 

 

 


 

Getting Started – PanelMaster HMI

Getting Started - PanelMaster (743KB).pdf

This is a start-up guide to take you through the process of setting up you first HMI and download a project to it.

What you need

All of these:

  • PanelMaster HMI (a PT104 with Ethernet is used in this demonstration)
  • A PC installed with PM Designer (free download from our website)

and one of these:

  • An Ethernet cable and switch/router – for download via Ethernet
  • RS232 Serial cable – for download via COM port
  • USB cable (type A male to type B female) – for download via USB port
  • Micro SD card – for SD card download
  • USB memory stick – for USB stick download

 Panel SetupPanel Setup screen

Power on your HMI to access the Panel Setup screen. In this screen, we have access to many useful functions such as network settings, program backup and update and some general settings for screen brightness, sleep time and so on.

 

 

 

 

Setup Mode 400

 

To access the panel setup when a program is running, the user is able to create a button in the HMI application that takes you to this page.

 

 

 

 

 

 

 

 


IP Address Setting IP Address Setting

Now we need to setup its IP address. Choose true to get an IP Address automatically. This setting allows the HMI to configure the network settings automatically. Next to the HMI name, put in a suitable name for your HMI.

Note: if get an IP address automatically is set true. The IP address of the HMI will change every time it is turned off and on. This might not be suitable for setting up remote download or VNC connections using port forwarding, because the IP address might change. For more advanced users, the IP address is recommended to be set manually.

 

 


 Download Data to Panel 400Download via Ethernet

First, we need to make sure that the HMI is plugged in with an Ethernet cable and connected to a switch/router. The PC needs to be connected to the same switch/router so that they are on the same network.

Open a project you have created in PM Designer. Go to the menu bar and choose Panel > Download. Choose Ethernet under Link Settings and in the drop down IP address menu, you should be able to find your HMI. Alternatively, you can type in the IP address manually.

If the HMI does not have an Ethernet port. The program can be downloaded via the serial COM port or a USB cable connected directly from the HMI to the PC.

Before downloading to the HMI. Under the download box, tick all three items. Run time data is the program file that runs on the HMI. Configurations data is the project file that runs on PM Designer. If configurations data is not ticked, next time you do an upload from the HMI you will not be able to see it in PM Designer. Hence, you cannot make any changes to it, and vice versa.

 

 


  PRP Download Using Micro SD Card & USB Stick

Most models come with a Micro SD Card Slot and all models come with a USB port. That can be used to download you program without the need of a PC.

Go to PM Designer and choose Panel > Build Panel Runtime Package (PRP). Save the .prp file to the SD card or USB stick (formatted in FAT32).

 

 

 

 

 

 

 

 

SD Download

Plug the SD card or USB stick to the back of HMI. Go to the panel setup screen and choose boot from file. Open the folder D:\, choose the .prp file and press OK. The HMI will download the program and update to the latest firmware if available.

Note: a download from SD card or USB will not allow you to view or edit the project when it is uploaded to PM designer in the future. As it only contains the runtime file for the HMI.