4-Noks ZB-Connection Gateway and Plug

4-Noks ZC-GW-ETH-EM & ZR-PLUG-UK-M

In my previous blog post I wrote about the difficulties I experienced finding any ZigBee based home automation devices on eBay. It almost became an obsession for me to find a ZigBee device which was not either a Xbee, development kit or a book. When I came across a cheap 4-Noks ZC-GW-ETH-EM Ethernet to ZigBee gateway and ZR-PLUG-UK-M plug socket I could not resist putting in a bid on them in order to have a play.

The majority of my Home Automation setup is Z-Wave with the exception of my smart meters which are ZigBee (which is another story), so although I would not be able to integrate these 4-Noks devices with my setup, I was interested to at least have a little play with a ZigBee device, I was also intrigued whether I could communicate with the  ZC-GW-ETH-EM and ZR-PLUG-UK-M using a XBee module and Arduino.

4-Noks ZC-GW-ETH-EM – Gateway Modbus Ethernet

4-Noks ZC-GW-ETH-EM

The ZC-GW-ETH-EM is part of the 4-Noks wireless ZigBee device family. Its purpose is to act as a interface between IP based Ethernet connected devices and the 4-Noks ZigBee connected devices (such as the ZR-PLUG-UK-M plug). Being IP based this also provides the opportunity to communicate with the devices remotely over the internet.

When I purchased these I automatically assumed they would work with ZigBee’s Home Automation (HA) Profile and would be compatible with other ZigBee devices of the HA standard, unfortunately this was not the case. 4-Noks have developed their own propriety protocol  based on an older serial communication protocol called Modbus which they have re-branded ‘ZB-Connection’. This means the 4-Noks ZigBee devices are only compatible with other devices in their ZB-Connection range.

The ZC-GW-ETH-EM acts as a ZigBee network coordinator which is responsible for creating the network and maintaining network organisation and can function as parent device for battery powered sensors. It has an Ethernet port used to connect to your LAN and powered by a 24V DC power adapter.

4-Noks ZR-PLUG-UK-M – Plug Sensor

4-Noks ZR-PLUG-UK-M

The ZR-PLUG-EU-M plug is also part of 4-Noks ZB-Connection range. Designed to be inserted into a standard UK 230V socket it includes an electric energy meter and a relay to turn on and turn off loads up to 2.5 kW.

There is a small button on the plug to manually turn the load on and off, this same button is also used to put the plug into setup/discovery mode in order to form a network with the ZC-GW-ETH-EM coordinator.

Once associated with the coordinator you can send simple Modbus commands to the plug to remotely switch on and off the device as well as retrieve active power and total energy used. You can set a power limit under which the device is meant to be in stand-by killer mode and so can be automatically turned off. The device is continuously powered by the 230V socket; therefore it may also act as a repeater or a parent device for other battery-powered sensors.

Associating the Plug and Gateway

In order to associate the two devices the ZC-GW-ETH-EM gateway must be placed into ‘open network mode’ (allowing joining of new devices), to do this you need to unscrew the 4 screws and remove the top cover where a small button and 3 status LEDs can be found within.  Pressing the button puts the ZC-GW-ETH-EM into ‘open network’ mode, during which the first of the LEDs will flash faster indicating it is ready for other devices to join its ZigBee network. The following table describes the status indicated by the 3 LEDs:

  • Led “A”: Working State
    • Slow flashing (1Hz) -> Closed Gateway 
    • Fast flashing (4Hz) -> Opened Gateway
  • Led “B” (middle led): Radio Link
    • Turned off -> No router with good link in the proximity
    • 1 flash -> One router with good link in the proximity
    • 2 flashes -> Two routers with good link in the proximity
    • 3 flashes -> Four or more routers with good link in the proximity
  • Led “C”: Radio Activity
    • Usually turned off
    • Shortly Lighted on transmitting or receiving a radio message

The network will remain open until the button is pressed again or will close automatically after 15 minutes.

While the gateway is in ‘open network’ mode… pressing the small button on the ZR-PLUG-EU-M plug then instigates it to search for,and associate with, the open network, a colored LED indicates the connection status:

  • Orange flash: Device joined, default address (127)
  • Green flash: Device joined, address assigned, relay off
  • Red flash: Device joined, address assigned, relay on

Now that the pair are associated we can now send Modbus commands to the network.

Sending Modbus Commands

Reading a little [Wikipedia] about Modbus

Modbus is a serial communication protocol originally developed in 1979 for use with programmable logic controllers (PLCs). Openly published and royalty-free Modbus has become a common means of connecting electronic devices in industrial environments. Modbus enables communication between many devices connected to the same network, for example a system that measures temperature and humidity and communicates the results to a computer.

So it would seem that Modbus is in fact the grandfather of home automation, so I now understand why 4-Noks opted to implement alongside ZigBee. However as Modbus was originally developed for industrial applications it is slightly more complex to implement requiring a more advanced knowledge of computer and communication fundamentals.

Now, I am far from being an expert on the subject of Modbus so I will just explain it as best I understand… The basic concept of Modbus hails back to the early days of computing where resources such as memory and bandwidth were at a premium and when programmers had to know about the low level (very technical) in’s and out’s of how a computer worked in order to maximise on these resources. Every Modbus device contains (up to) 4 small areas of memory, known as registers, these 4 registers are called:

  • Coil
  • Discrete Input
  • Input Register
  • Holding Register

Each one of these registers is then split down further addressed slots (think of them like variables), each one holding different type of data relating to a function, status or setting of the device.

Using a Modbus application installed on your computer (which I surprisingly found quite difficult to find a simple (and free) version for Windows) you can then communicate with Modbus devices across the network allowing you to ‘set’ and ‘get’ the values in the above registers to send commands (e.g. turn plug on / off) and retrieve values (e.g. get energy used).

The manual for the ZR-PLUG-EU-M plug contains tables detailing which registers [and address #’s] contain device status and setting information:

  • InputRegister [#1] contains the Firmware version.
  • InputRegister [#5] contains the Active Power (Watts).
  • InputRegister [#14] contains the network address.

The manual also details which registers [and address #’s] are used to set and configure the device:

  • CoilStatus  [#1]  setting to 1 turns the plug on.
  • CoilStatus  [#2]  setting to 1 turns the plug off.
  • HoldingRegister [#0] setting to 6512  resets the device to manufacturer defaults.

The manual for the ZC-GW-ETH-EM gateway contains a similar set of tables detailing its own registers options and settings.

In an age of plug-and-play, the above seems a little archaic albeit robust. With a lacking in compatibility with the Zigbee Home Automation profile and a reliance on a knowledge of Modbus programming and associated application I leads me to believe that the 4-Noks ZB-Connection range is possibly more suited to industrial applications and in situations where a Modbus is already present acting as a wireless extension to existing wired installations.

4 Comments

Add a Comment

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