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
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)
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.
Open 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.
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.
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.
Note: multiple links to slave modules can be created on RS-485, just use the same Slave ID in the PLC Address box.
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.
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.
If a communication is established, we should see the RX and TX lights flashing on both ZigBee modules.
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.
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.
When 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.
If 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.