Every journey starts with the first step. No matter what you are doing and no matter what the journey is, this is the universal truth. KNX, a standard for home and building control, is no exception to this rule.
Software developers are used to starting a new adventure. New technology or programming language, unfamiliar development environment. We have all been there. At least I have.
In the beginning everything seems overwhelming. You have no idea where to start. You have no idea if you are on the right path. It can seem hopeless at times. You just want to quit and go back to the technology and domain you are familiar with.
But you know that first step is the most difficult one. Once you get the environment set-up and you get that first example working, everything will get easier. At that point, you have made it through the gate, and new incredible world is opening before you.
In software development, we call this the “Hello World” stage. Whenever you start learning something new, first goal is to create a Hello World example. After successfully completing this task, you know that everything is going to get easier.
So, let’s get started.
Let’s create our “Hello World” KNX example.
The test board
As I have mentioned, KNX is a standard for home and building control. This means that KNX is used to create so called “Smart house”. This simply means that KNX is used to automate various functions of the house.
Every house has an electrical installation. Electrical installation consists of high number of electrical devices. Devices like lights and light switches, power sockets, electrical blinds and shades. All of these devices are connected through the electrical wiring around the house.
House with KNX capabilities is no different. It has all of the regular electrical devices same as any regular house. In addition to electrical devices, KNX house has KNX devices installed in the house. These KNX devices add advanced capabilities to a regular house.
There are a couple of types of KNX devices:
- Power supply – these devices are responsible to provide power for the KNX bus;
- Sensors – sensors are responsible to listen for events and to provide information when a certain event happens. For example, push button sensor can sense that user has touched a certain part of the sensor, and it can send information in the KNX network about this event;
- Actuators – Actuators are devices which execute a certain function in the house. For example, turn the light switch on or off. Actuators are consumers of the messages in the KNX network which are created by sensors;
- Communication devices – Communication devices can be considered as gateways to a KNX network. On one side, they communicate with the KNX network. On the other side, they communicate with an outside world. Communication devices are used by software applications to communicate with the KNX network;
- Line couplers and repeaters – These devices are used to separate different parts of the KNX network. Separation is physical and logical. In every segment separated by line coupler or repeater, there is a power supply which gives power for that part of the network. On logical side, line couplers and repeaters have filtering capabilities and messages which are intended only for devices in that network segment and are not forwarded to other network segments.
Now when you know what type of KNX devices exist, it is time to create our first KNX test environment. In order to achieve this, you will need some electrical devices and some KNX devices.
Regarding electrical devices you will need:
- Couple of halogen lights used for switching and dimming purpose,
- Couple of power sockets,
- Couple of power switches,
- Couple of automatic fuses,
- Automatic blind or shade (this is optional but nice to have),
- Electrical wires.
From the KNX devices you will need:
- Power supply,
- Binary input,
- Dimming actuator,
- Switch / Blinds actuator,
- Push button sensor,
- KNX wires.
The next step is to assemble your KNX test environment. You can put all the components on the table or a floor, but this would not be very nice. Also, it would be pretty difficult to move your test environment around. Because of this, you can take a large wooden board and mount all the devices on the board.
Steps to assemble your KNX test board:
- Position KNX devices on the board. Most of the KNX devices are intended to be mounted on a DIN rail and it would be a good option to do the same;
- After that, you can position all of the electrical devices on a board. It is a good practice to organize parts of the board with certain functionality. For example, you can put all the lights in the top part of the board, light switches and sockets in the middle of the board, blind can be positioned on the right and fuses can be positioned in the lower left part of the board.
- And the last thing you need to do, is to add the wiring. It doesn’t make any difference if you do the KNX wiring or the electrical wiring first. Good practice for the wiring is to drill holes near the devices and do all the wiring on the back side of the test board. This way the mesh of cables will be located on the back side of your test board living you with test board which is safer and better looking.
Detailed explanation on how to do the electrical and KNX wiring is outside of the scope of this blog post. I’m sure that you will have no problem doing it by yourself or finding a certified electrician to do the wiring for you.
Here is an example of a KNX test board similar to the one I have explained. This type of board is frequently used during the KNX training sessions.
Minimum hardware components
Wait just a second Branislav, you said that we will cover bare essentials. The minimum we need to do in order to get our KNX network up and running. And now you are making me create KNX test board with all sort of devices on it.
You are absolutely right. Sometimes I get carried away when I start thinking about KNX. Sorry about that. Let’s go back to our Hello world example.
I would say that the bare minimum for the working KNX network is to be able to turn a simple light on and off. To achieve this you will need:
- KNX power supply,
- KNX Switch actuator,
- KNX Push button sensor,
- KNX USB interface device (or KNXnet/IP interface device),
- Signal light bulb,
- Power cable with electrical jack,
- KNX cables,
- Electrical cables.
After you have all of the components from the list above, you can create your KNX network. You don’t need to use any fancy layout and wooden board. Just simply put all the components on the floor or a working table.
Assembly steps are:
- Connect power cable with the jack to the KNX power supply,
- With KNX cable connect KNX power supply bus connectors to KNX Switch bus connector,
- With KNX cable connect KNX Push button sensor bus connector to KNX power supply or KNX Switch bus connector (it makes no difference which one),
- With KNX cable connect USB interface device bus connector to any previously used KNX device bus connector,
- With electrical cable connect power neutral directly to the light bulb (you can get power neutral from cable with jack),
- With electrical cable connect power line to the KNX Switch output connector and other output connector of the KNX Switch connect to the light bulb (you can get power line from cable with jack).
On the picture bellow, you can see how everything should be connected. You will have to forgive me for having no natural talent for painting.
After assembling your example KNX network, you can proceed with the next step. You need to program the KNX devices and achieve incredible accomplishment of turning the light on and off when push button sensor is used.
Test board commissioning
When you buy the KNX devices from the store, they are delivered unprogrammed. This means that you need to program the device before they can be used.
Engineering Tool Software (ETS) is the tool which is used to program the KNX devices. You need to sign in to knx.org site to be able to download ETS 5 tool. For your example you don’t need any license for the ETS tool since the free license support up to 5 devices which is more than enough.
To be able to do anything with the ETS tool, you need to establish connection with the KNX network. For this, you can use the communication device that you have, USB interface device or IP interface device. Go to Bus tab -> Interfaces ->Configured Interfaces and select your communication device from the list and press Select button. If you have a problem establishing connection with the KNX network, you can check out my blogs for USB interface device and IP interface device.
After starting the ETS tool, first you need to create a project. This is pretty straight forward. Press the green “+” button which will open a dialog for creating a new ETS project. Enter project name, select TP as Backbone medium, uncheck Create Line 1.1 and select Three Level group address style. Press Create Project button and your example project is created.
Next step is to add the devices to the ETS project you have just created. To do this, you need to open the topology view. Right click on the Topology node in tree view on the left and select Add -> Devices. After this catalog windows will be opened.
Since this is the first time you are using ETS on this computer, your Catalog view will be empty. You need to import product databases for your devices (Switch actuator and Push button sensor) in the ETS. Product database is typically downloaded from official device manufacturer website. For example, if you have KNX devices from Gira, you can find product database files for your device here.
After downloading product database files, you need to import them into ETS. You can do this by pressing the Import button in the Catalog view. Select the database files you want to import and follow up the import process.
After successfully importing product database files, imported devices will be shown in the Catalog window. Now you can add the devices to your project Topology view. The easiest way to do this, is to drag and drop devices from Catalog view to the Topology node in the Topology view.
Next step is to implement the “smart” logic into your devices. This is done by using the group addresses and assigning them to devices endpoints. I’m not going into details about group addresses here but if you are interested in more details you can check my previous blog about Physical addresses and Group addresses here.
First you need to create group address that which we are going to use. To achieve this, you need to:
- Open the Group Addresses view,
- Execute “Add Main Groups” action and create Main group,
- Select Main group, execute “Add Middle Groups” action and create Middle group,
- Select Middle group, execute “Add Group Addresses” and create Light Switch group address.
When you are done, you screen should look something like this:
Next step is to use the created Group address. You need to link the group address with the port which will be used on the Switch Actuator. Also you need to link the group address to the push button device. When you are done this should look something like this:
There is one more thing to do and you are done. You need to configure the devices (Switch actuator and Push sensor) with the new settings. For this, the Download function is used. To do this, right click on the device you want to configure -> Download -> Full download. Message will be shown on the right that you need to press programming button on the device to proceed. There is a programming button on the face of the KNX device that you need to press at this point. After you press the programming button, red light will turn on the device, ETS will program the device and turn the red light off. You need to execute the same procedure for both devices in the list.
Wait for a couple of seconds after programming the devices for them to reboot and you can test you KNX installation. Now, when you press the push button, the light should go on and off.
And that is it.
You are done.
If you have successfully finished all the steps, you have a working KNX test environment.
Now you can continue playing with your KNX setup.
Have fun. 🙂