WIZ550web interacting with professional homeautomation KNX bus

Prerequisite – Why KNX

I’ve been renewing a part of my house and as I always wanted to have some home automation – the decision was set. It was not easy and I was quite long considering what to take. There were so many wireless and wired solutions available. I did not want to go for wireless – at least not as primary system. I already used some remote controlled plugs – but I’m sick of changing empty batteries. Sometimes messages got lost, so I had to press the buttons twice. So the decision was set to take some bus system. There are a couple of vendors that provide actuators and sensors. There are also some free implementations available, like Freebus, which directly couple to the bus – so you can build your own devices.

For me there were some criteria important: reliable function of basics, no battery changes, interaction with my Fhem home server possible. The reliability was most important for me. Basic functions like switching light on and off, should always work. A worst case scenario, which I was thinking of, was: I’m in a bright house in the evening on the way to bed, and then the home server got messed up by some update or reconfiguration and I cannot switch my bedroom light on, and the other part of the house off! So my decision was, all the parts for basic functions have to be “off the shelf”. All the additonal functions (automatic light switching, automatic blind control, etc) don’t need the same level of reliability (Even i did not require that in the beginning, I reached a quite high level in the end). Even I like to hack or build stuff on my own – I want to have the possiblity to just “buy” spare parts if something breaks.

I thought this would be a good base. KNX is based on the EIB (European Installation Bus) and uses usually Green wires similar to telephone cables 2 x 2 x 0.8 mm2. Two of the wires are used for the bus communication and can also power devices with 29V. The other pair can be used for an auxiliary power source in case your device needs more power, or the bus communication is disturbing.

So finally my home got (at least partially) touch panels in the rooms for light, blind and heating control as KNX sensors. The lamps are controlled by KNX actuators directly from the mains distribution.

Based on that system I’m now able to implement fancy home automation stuff.

automated light – motion sensors control with server

My wife often complains that I do not shut the light off. But when I want to return soon, I let it on. So I decided to go for an automated solution with motion detectors- thanks to KNX it’s an easy task. You just set the actuator to stairway mode with. In that mode the light will go automatically off after, e.g., 90 seconds. As I have dimming actuators it’s even possible to set some warning time, so 20 seconds before the light will go off it will dim to 50% – so even something goes wrong I can still use the remaining light to switch back to 100%. So the configuration of actuator was an easy task, but when I wanted to order PIR sensors for the KNX bus, I almost fell of my chair. 100EUR each – and I wanted to have around 10! That’s why I thought here I go for my own development. I found on ebay some PIR sensor modules for around 1 EUR (!) each from China . As I was not in a hurry I ordered and around 3 weeks later they arrived. evb-pir

Right after the modules arrived I took one and connected it to one GPIO of a WIZ550web-EVB. The output of the PIR module is 3V so it can go to the GPIO of the module directly. This is good, as I don’t want to use an EVB for my “production” use and just the module itself. The WIZnet module has a preinstalled demo web page, which makes it possible to directly access the inputs and outputs. So after powering up I was immediately able to see that the Webpage showed Input D8 was high for some seconds,  when I was moving around.

First I thought there was an instability during boot. Whenever I pressed the Reset button on the board, the module did not come up and was waiting in the bootloader! But as I figured out this is not a bug but a feature. D8 has a second meaning during boot – in case you mess up the application code, you can pull D8 high during reset and the module will wait in the bootloader! This was not so good in my case, as soon as I moved my hand in direction of the Reset pin, the PIR module raised the level of D8 to high! To circumvent this for development, I just moved to another Input pin. (As look ahead to part2: I recompiled the bootloader and removed this feature, as i wanted to use all input pins without limitation – in case something really goes wrong during development, I can easily reflash the module via serial line – but if D8 is high during boot while in production use my application will “hang”)

Eibd on home server

Fine now I have a website with a virtual LED showing motion. I have an Alix-D3D board (this could be an Raspberry or something else today) hosting my FHEM server. To communicate with the KNX bus I need some Modem. I ordered a TUL from busware.de which can be connected via USB. The TUL is not standalone you still need an eibd on the system to communicate with the bus. There are also some gateways on the market that have already implemented it, but they cost more.  Eibd can also be a gateway to the ethernet. This is handled by multicasts, so the KNX bus is then available also as let’s say “virtual bus” on the ethernet also. IP devices can join that multicast group and get also all messages same as they were on the physical TP bus. gateway(look ahead: I will use that gateway function later)

Anyway, for my first try I don’t use that gateway functionality.But as the Eibd is running on that system it is possible to directly execute the “group(s)write” command on the command line and send a group message to the KNX bus.

Now I wrote a small script that is getting the output of WIZ550-web via php (php5-curl) every second. If D8 is “1” then ‘ON’ is sent to the actuator. This worked out of the box, but I’m not happy with it. I absolutely don’t like the polling every second. Even it’s my LAN that can easily manage that little data, it hurts my engineers heart if unneccessary data is constantly transmitted with http overhead every second. It’s a little bit like a dripping watertap. So as I had formerly seen, Eibd can be setup as a Gateway, so it’s possible to send directly a multicast to switch on the light…

Part2: Talk “Directly” to KNX devices via Gateway.

com-waysMy next idea was to write my own Firmware for the WIZ550web. systemAs the Eibd is transferring the KNX bus data to the ethernet, the module shall directly communicate with the KNX bus. So no more polling every second, just one packet for switching on the light.

Another goal for me is receiving multicasts on the module to get feedback. I wanted to control the module also. The module needs some information if it is currently night – because at night I don’t want to have a bright bed room in case the cat walks through…

(Look ahead: In part 3 I’ll also use this to control my projector and my power amplifier)

So first I had to install the toolchain and get the source code of WIZ550web.

Toolchain – Compiler and Eclipse

The following two articles describe how to install the Toolchain on a Linux System:



Import Source code to Eclipse

The following article is describing how to import an repository to eclipse. It also shows how to fork a repository. For further processing I suggest you sign up for a free github account, then fork the repository directly on github.com.Bildschirmfoto vom 2015-03-31 16:16:24 When you fork it to your account you are able to commit your changes to your repository so others can also participate. I have a branch “freebus” beside my “master” branch. That’s what you need to use when you are in eclipse.



Here you can see a picture of the Git Repository view of Eclipse:



Currently I use a small python script to catch the multicast packets that are already on the bus, and I replay them with my module. It would be even nice to configure the module via the ETS software but that’s something for the future. For the beginning I’m fine with it how it is currently.

The module is checking the status of the input pins, as soon as there is a rising edge on a watched pin my multicast is sent out and the light is on…

Using the plain module

powerregulator web-wpowerAs I don’t need the complete EVB for my “production use” I bought some 3V voltage regulators. I added some jumper cables, so I can connect the power source directly to the module. As i don’t have any parts beside the power regulation I skip a special EVB; all PIR outputs are connected directly to the input pins of the module. In the picture on the right side you see only one PIR.


Part3: Control of Projector, Projection Blind and AVR Power Amplifier

My next step is using a second module to control my home cinema in my living room.

I have:

  • Projection blind
  • Projector Epson
  • AVR Denon power amplifier

Projection blind control

My blind is motor driven and has a RF remote control. So I soldered just some cables in parallel to the buttons of my remote control. These are attached to the relays of the EVB. When I want to roll up or down, I just have to close the circuit via the relay for a certain time, e.g., 0.3 seconds similar to what a human would do.

Projector Epson

My Projector has a RS232 port. It’s possible to control many things on that port and ask for error codes. But my primary use case is just to switch it off and on. All the other settings stay currently the same. So just have to wait for “:” as command prompt then I can send “PWR ON” or “PWR OFF” with 9600 bps on the serial line and the projector is starting or shutting down. If I ask with “PWR?”, I can get “PWR=01” or “PWR=00” as answer. I ask this every couple of seconds, as I also want to send feedback to the KNX Bus in case someone is switching on my Projector manually – so my touch panel is showing always the correct state.

AVR Power Amplifier

The Denon AVR is in one thing ahead of the Projector. Every time some setting is changed (input, volume, power, etc) this information is directly sent to the serial line. So I do not need to ask the AVR regularly for changes. That’s quite nice. Beside that the protocol is documented and not very complex. Basically I need power on and off the main zone. I also need to select the input source, and I want to control the volume of the main zone.



This setup is working well. I do not regret that I went for this solution combining KNX with my self made addons. I’d go for it again if I had to choose. There is still plenty of room for enhancements. I’ll report when there is something new.