Raspberry PI: EIB/KNX IP Gateway and Router


this Post is a tutorial to build an IP EIB/KNX Gateway based on a Raspberry Pi completely from the scratch. The core components are the eib daemon from the bcusdk in conjunction with the TPUART EIB Bustranceiver module.

The Hardware

3 components are needed:

  • A Raspberry PI
  • A EIB Buscoupling Unit
  • Adapter Board to connecting both

You can use A or the B Model of Raspberry Pi. The eibd daemon has minimal hardware requirements.


There are two possibilities for connecting a computer to the EIB/KNX Bus over a RS232 serial interface. Both are supported by eibd.

  • Buscoupler 2 with FT12 protocol
  • TPUART module

I use the second one. It has the best price¬†and is stablest solution.¬† You can buy the TPUART modul decretely for about 40‚ā¨ or you order a Siemens Bustranceiver Module BTM UP117 5WG1117-2AB11 where a TPUART module is inside and which is available for about 25‚ā¨.

The Hardware

For connecting the TPUART module to the fruit I developed a adapter board which also provides galvanic isolation between EIB bus and Ethernet Network.
The galvanic isolation is done by a ADUM1201 Analog devices dual-channel digital isolator.
The board has a 10 Pin header which is pin compatible with the Raspberry and another 10 pin header to plug-on the TPUART.

Raspberry Pi KNX Board Top

The Schematic and PCB are available in Eagle format and can be downloaded above.

Raspberry Pi KNX Board Schematic

Raspberry Pi KNX Board Layout

The part list of the board is very short ? The screwed connection on the board an be used to suppling the Raspberry Pi with 5V.

Part Device Type Costs
IC1 Integrated Circuit ADUM1201 2,50‚ā¨
C2 Capacitor 1¬ĶF 10Cent
C3 Capacitor 10¬ĶF 10Cent
J1,J2 Header 10pin header 50Cent

Connect the Raspberry pi KNX Board

Raspberry KNX IP Gateway Router


The Software part

Update: eibd is no longer under development please install knxd.
Install Raspbian as operating system for Rasperry Pi. All developing tools to compile the eibd daemon are already included. For the current version you need a SD card with at least 4GB. The installation of rapbian is described here in detail. Its simple:-)

When your operating system is up, login as user pi and set a static IP Address to ensure the gateway is always reachable at the same IP Address.

For Debian 7 Wheezy edit the following files with your favorite editor. For me its vi :-). For Debian 8 and systemd based network configuration scroll down.

1 pi@raspberry~: $ sudo vi /etc/network/interfaces

comment the following line

# iface eth0 inet dhcp

insert your static TCP/IP parameter.

allow-hotplug eth0
iface eth0 inet static

On Debian 8 Jessie also add the route to the eibnet mulicast address (in debian wheezy this is set by the init script) and set the interface eth0 from ‚Äúallow-hotplug‚ÄĚ to ‚Äúauto‚ÄĚ so it will not be handled by systemd, to activate the old style debian network config.

auto eth0
iface eth0 inet static
post-up route add -net netmask eth0
pre-down route del -net netmask eth0

adjust address, subnetmask and gateway. Open /etc/resolv.conf to set a DNS Server. In home environments this is usually the DSL Router.

1 pi@raspberry~: $ sudo vi /etc/resolv.conf


Reboot your device and login again. I preferred a remote login over ssh from my workstation.
I wrote a script install_eibd.sh which compiles and installs the eibd daemon. You can download it below. The script needs an active internet connection. Check the connection

Network configuration for Debian 8 Jessie
1 pi@raspberry~: $ sudo su -
2 root@raspberry:~#

Create new file /etc/systemd/network/eth0.network. Name is not importend, just the prefix network.

# You can also use wildcards. Maybe you want enable dhcp
# an all eth* NICs
# static IP
# netmask
# Route for Multicast Address EIB/KNX

Disable the old way to configure the network, enable systemd based network configuration, enable systemd generated resolve.conf (DNS resolution) and disable dhcpcd.

1 root@raspberry:~# mv /etc/network/interfaces /etc/network/interfaces.save
2 root@raspberry:~# systemctl enable systemd-networkd.service
3 root@raspberry:~# systemctl enable systemd-resolved.service
4 root@raspberry:~# systemctl disable dhcpcd.service

Set an link from the system wide resolve.conf to systemd

1 root@raspberry:~# mv /etc/resolv.conf /etc/resolv.conf.save
2 root@raspberry:~# ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

Reboot to get the config active

1 root@raspberry:~# reboot
Check the connection.
1 pi@raspberry~: $  ping -c 2 www.heise.de
2 PING www.heise.de ( 56(84) bytes of data
3 64 bytes from icmp_req=1 ttl=128 time=8.551 ms
4 64 bytes from icmp_req=2 ttl=128 time=9.680 ms
6 --- ping statistics ---
7 2 packets transmitted, 2 received, 0% packet loss, time 1002ms
8 rtt min/avg/max/mdev = 0.551/0.615/0.680/0.069 ms

Note: Some rasbian version has a bug that the permissions for /bin/ping were not set correctly. The following error occurs: ‚Äúping: icmp open socket: Operation not permitted‚ÄĚ. The setuid on /bin/ping is missing, because only root can open sockets.

1 pi@raspberry~: $ sudo chmod u+s /bin/ping

Installing eibd
The script must be run as root because some files are copied and modified in locations where only root have the appropriate permissions.

What the script does:

  • Check for root permissions
  • Download and compile pthsem
  • Download bcusdk, but compile eibd only
  • installing eibd binaries to /usr/local/bin
  • create a init script /etc/init.d/eibd
  • Add a user eibd with group membership dialout (to access serial device /dev/ttyAMA0)
  • Disable¬†bootmessages on serial interface /dev/ttyAMA0
  • Disable¬†console on serial interface /dev/ttyAMA0
  • Disable console on serial interface /dev/ttyAMA0
  • On Raspberry Pi 3 it disable the bluetooth module because its uses ttyAMA0 by default

On a Raspberry Pi 3 it is strongly recommended to update to the latest Kernel to addressing some issues with the serial device ttyAMA0

1 pi@raspberry~: $ sudo su
2 root@raspberry~: # rpi-update
3 root@raspberry~: # reboot

Start a root shell, get the script.

1 pi@raspberry~: $ sudo su
2 root@raspberry~: #

The highlighted eibd features are enabled. Alter the script if you need additional features.
‚Äďenable-ft12¬†¬†¬†¬†¬†¬†¬†¬† enable FT1.2 backend
‚Äďenable-pei16¬†¬†¬†¬†¬†¬†¬† enable BCU1 kernel driver backend
‚Äďenable-tpuart¬†¬†¬†¬†¬†¬† enable TPUART kernel driver backend (deprecated)
‚Äďenable-pei16s¬†¬†¬†¬†¬†¬† enable BCU1 user driver backend (very experimental)
‚Äďenable-tpuarts¬†¬†¬†¬†¬† enable TPUART user driver backend
‚Äďenable-eibnetip¬†¬†¬†¬† enable EIBnet/IP routing backend
‚Äďenable-eibnetiptunnel¬†¬†¬†¬†¬†¬† enable EIBnet/IP tunneling backend
‚Äďenable-usb¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† enable USB backend
‚Äďenable-eibnetipserver¬†¬†¬†¬†¬†¬† enable EIBnet/IP server frontend
‚Äďenable-groupcache¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† enable Group Cache (default: yes)
‚Äďenable-java¬†¬†¬†¬†¬†¬†¬†¬† build java client library

Start the script. This should be run about 20 minutes. Do not execute update-rc.d on debian jessie.

1 root@raspberry~: # chmod +x ./install_eibd.sh
2 root@raspberry~: # ./install_eibd.sh && update-rc.d eibd defaults

After the script has finished. eibd, vbusmonitor2, groupwrite and some other stuff should be installed at /usr/local/bin, the init script eibd in /etc/init.d and the startup links in /etc/rc3.d must exists. At the end of the script a warning message ‚Äúinsserv: warning: script ‚Äėmathkernel‚Äô missing LSB tags and overrides‚ÄĚ is shown. This can be ignored.

1 root@raspberry~: # ls -l /usr/local/bin
2 .....
3 -rwxr-xr-x 1 root staff 471140 Feb 18 22:14 eibd
4 -rwxr-xr-x 1 root staff  10788 Feb 18 22:14 vbusmonitor2
5 .....
6 root@raspberry~: # ls -l /etc/init.d/eibd
7 -rwxr--r-- 1 root root 2142 Feb Feb 18 22:14 /etc/init.d/eibd
9 root@raspberry~: # ls -l /etc/rc3.d/*eibd
10 lrwxrwxrwx 1 root root 14 Feb 18 22:14 /etc/rc3.d/S18eibd -> ../init.d/eibd

Reboot your device

1 root@raspberry~: # reboot

The eibd options and features are defined at variable EIBD_OPTIONS in file /etc/init.d/eibd. Currently are defined:

  • EIB Busaddress of the daemon 1.1.128
  • EIBnet/IP server
  • EIBnet/IP Routing
  • EIBnet/IP Tunneling
  • Answer discovery and description requests
  • Listen on UNIX domain socket /tmp/eib
  • Listen on TCP port, default 6720

This gets a detail list of command line parameter

1 root@raspberry~: # eibd -?

After the reboot and if your Raspberry KNX Board is connected the eibd should running

1 root@raspberry~: # ps ax|grep eibd
2 2996 ?        Ss     0:00 /usr/local/bin/eibd -d -D -T -R -S -i -u --eibaddr=1.1.128 tpuarts:/dev/ttyAMA0

If the process is running. Check if you see EIB packets on wire.

1 pi@raspberry~: # vbusmonitor1 ip:localhost
BC 11 17 00 03 C1 00 81 06 :L_Data low from 1.1.23 to 0/0/3 hops: 04
T_DATA_XXX_REQ A_GroupValue_Write (small) 01 LPDU: CC :ACK
BC 11 17 00 03 81 00 81 46 :L_Data low from 1.1.23 to 0/0/3 hops: 00
T_DATA_XXX_REQ A_GroupValue_Write (small) 01 LPDU: CC :ACK

Thats it. Comments are welcome!

I’ve writted another post if you want to use Raspberry Pi and eibd with a KNX USB Interface.

Update 09.06.2016: I’ve added the first release of a script to compile and install knxd. knxd is a fork of eibd. Any comments are welcome. Configfile is /etc/default/knxd, Socket /tmp/knx. See this EIB/KNX Router with knxd


Source: Raspberry PI: EIB/KNX IP Gateway and Router

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

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

Scroll to Top