In my previous blog post I have covered some basic information about the KNXnet/IP interface device. I have explained that there are two different communication interfaces that can be used: KNXnet/IP Tunnelling interface and KNXnet/IP Routing interface. I have also covered types of messages used for each of the two interfaces.
In this blog post I will explain how you can use the IP interface device to communicate with the KNX network. I will cover tools which are most commonly used in the KNX world.
First thing first, let us remove one obvious thing out of the way. In order to use IP interface device to communicate with the KNX network, you need to properly connect the device. This means that you need to:
- Connect the IP interface device to the KNX network,
- Usually there is a need to connect additional power supply,
- And last, connect the network cable to the network switch.
There is always an instruction that comes with the device. I’m sure that this step will not be a problem for you or any other KNX user. After all this is done, IP interface device is powered up and ready to be used.
Programming the device in ETS
After properly connecting the device, next thing you need to do is to setup the device. This is done with a tool called ETS. ETS stands for Engineering Tool Software. ETS application is build by the KNX organization and you can use it to configure all the devices in the KNX network.
In order to configure the IP interface device with the ETS tool, you need to download the ETS product database for your IP router. ETS product database contains all the details about a certain hardware. You can download product database from the official site of the KNX device manufacturer.
After downloading the ETS product database, you need to import it into your ETS application. After that, you can select the device and add it to your ETS project. This will give you opportunity to configure parameters of your IP interface device.
Most important parameters you need to configure are:
- Physical address – unique address in the KNX network which will be used by device,
- IP address assignment – method used by device to get the IP address (DHCP or manual assignment),
- IP Routing multicast address – multicast address used by the device Routing interface,
- Routing interface filters – filter options for the incoming and outgoing traffic over device Routing interface.
When all the parameters are set, you need to download the parameters to the IP interface device and you are ready to start using it.
IP interface device and ETS
Besides configuring the KNX device, you can use ETS tool for KNX network diagnostics. In order to achieve this, you need to connect the ETS tool to the KNX network. You can use IP interface device to establish the connection
I already explained that there are two interfaces to communicate with the KNX network over an IP interface device. ETS tool can use both of this options.
Tunnelling interface connection
There are two options to establish the connection over the Tunnelling interface. You can use a discovery mode. While running, ETS will periodically check for the available IP interface devices. It will keep track of the found devices.
You can go to Bus -> Interfaces screen and select desired device in the list of Discovered interfaces. In most KNX installations there will be only one available discovered interface and it will be easy to decide which one you want to use.
There is another option to use the Tunnelling interface, and that is through the manually configured connections. Again, you need to go to Bus -> Interfaces screen. There is a green “+” button which you can use use to create manual connection. When creating the connection you need to select the IP Tunnelling option. After this, you need to manually enter connection name, IP address and port number. You can additionally choose to use the NAT connection mode. This parameter is important since it enables connection with the IP interface device over a NAT network configuration.
Manual tunnelling connection is important because it enables you to establish the connection even when the KNXnet/IP server and client are not in the same IP network .
Routing interface connection
The other option is to establish the connection over the IP interface device’s Routing interface. To do this, you need to go to Bus -> Interfaces screen and choose the Routing interface connection from the list of discovered interfaces.
In most cases default multicast address is used for the Routing interface: 188.8.131.52.
After configuring the connection which will be used to communicate with the KNX network, there is one more thing you need to do. You need to check if the connection is ok and ETS tool can use it. The easiest way to do this is to go to Bus monitoring screen and start listening for the KNX traffic. Bus monitoring screen can also be used to send the message to the KNX network.
IP interface device and PNX Monitor
Similar to ETS tool, you can use PNX Monitor application to monitor the KNX traffic. Besides this, you can use PNX Monitor application to send messages to the KNX network.
Tools like this one are very important and are often used by KNX installers and system integrators. You can use PNX Monitor to monitor the KNX network. All the telegrams sent in the KNX network are received by the application and will be shown to you. You can decide to filter all the telegrams and see only the important ones. This will help you to figure out what the problem is and to identify things that need to be improved.
The tool can also be used to generate desired traffic in the KNX network. In a way, it acts like a simulator of the KNX network. By using the PNX Monitor, you can simulate certain network conditions and check that the smart house behaves like it is intended.
To establish connection with the KNX network over an IP interface device, PNX Monitor has a couple of options. The options are similar to the options available in the ETS tool.
Tunnelling interface connection
First option is to choose from the discovered tunnelling connections. To achieve this:
- Go to Connection -> IP interface and select KNXnet/IP tunnelling
- Discovered tunnelling connections will be shown in the list
- Select one of the discovered tunnelling connections
- Press the Connect button
After this, the tunnelling connection is open and it can be used by the PNX Monitor application.
The second option is to use the manually configured tunnelling connection. You need to:
- Go to Connection -> IP interface and select Configured interface in the menu,
- Enter IP address, port number and choose if the NAT network configuration will be used,
- Press the Connect button.
After this, the connection is open and if everything is ok (green check mark on the top indicates that the connection is opened) application can communicate with the KNX network.
Routing interface connection
Similar like the discovered tunnelling connection, routing interface connection is established by:
- Go to Connection -> IP interface and select KNXnet/IP routing,
- Discovered routing connections will be shown in the list,
- Select one of the discovered routing connections,
- Press the Connect button.
When the connection is opened successfully, it can be used by the PNX Monitor application.
No matter which connection type is used, you can easily verify if the connection with the KNX network is ok. Just go to the Bus Monitor screen and start bus monitoring (press the play button near the top of the grid). If everything is OK, telegrams will be shown in the table when there is any traffic in the KNX network.
IP interface and Falcon
Falcon is a high performance communication library developed by the KNX organization. It offers an API for sending and receiving telegrams across the KNX network. Falcon supports access to the KNX network through RS232, USB and IP.
Using KNXnet/IP interface device with Falcon library is similar to using USB interface device with Falcon library. In my previous post, USB interface device, I have covered basic idea behind using the Falcon as communication library while building your application. For more information check my previous blog.
Same as the ETS application, Falcon library supports both of the KNXnet/IP interfaces. Also it supports both discovered tunnelling KNXnet/IP interface and routing KNXnet/IP interface. This is no surprise having in mind that ETS application uses Falcon library to communicate with the KNX network.
In order to use the Falcon library in your application, you need to add reference to the library. After that, you need to initialize the Falcon and your are ready to go.
IP interface – low level approach
There is another available approach that you can take while building your KNX enabled application. You can write your own communication library to communicate with the KNX network. This is of course a lot of work, but it gives you a lot of flexibility.
You have two options to establish communication with a KNX network over IP interface device. You can implement tunnelling interface, routing interface or both.
There are a number of messages that you need to be implement to support each of these KNXnet/IP interfaces. KNX specification defines in details all the messages that need to be implemented for KNXnet/IP interfaces. I have covered KNXnet/IP protocol messages in more details in my previous blog and you can check it here.
KNXnet/IP interface device uses cEMI protocol to encode the telegram information. This means that you will need to implement cEMI protocol on top of KNXnet/IP protocol to implement the client which will be able to communicate with a KNXnet/IP server.
This sounds like a lot of work.
And it is.
But it is also a lot of fun and I recommend that you do it.