EIB/KNX: KNXNet/IP Gateway with calimero server on Raspberry Pi/Orange Pi PC

Hi,

as an alternative to knxd the calimero project also supplies an KNXnet/IP server.


The calimero server is based on Java so you have to ensure that the device which should host the server has enough CPU/RAM. A Raspberry Pi or Orange Pi PC should be sufficient.

I’ve written a script which do all necessary tasks to get the server running.

The requirements:

  • A running Debian 9 installed, i.e. raspbian (Raspberry Pi) or armbian (Orange Pi),
  • A TPUART modul as descripted here is connected. PCB and schematic
    Raspberry KNX IP Gateway/Router

    Raspberry KNX IP Gateway/Router

    Raspberry Pi KNX Board Schematic

    Raspberry Pi KNX Board Schematic

  • You can also use KNX USB devices or an IP Tunnel connection but I have not tested it yet. Any experiences or feedback are welcome.

What the script does:

  • Recognition on which platform the script runs
  • Setup the serial device depending on the platform
  • Gets all sources for calimero server and –tools from github
  • Complies all sources
  • Patches calimero server to run in background(detached stdin)
  • Installs binaries to /opt/calimero-server
  • Moves/installs config files to /etc/calimero
  • Alters config to use a TPUART Module
  • Adds 8 KNX Client Addresses
  • Sets the Servername
  • Creates a user and group knx under which the server runs
  • Adds a systemd service knx.service
  • Installs calimero tools and a wrapper script knxtools to /usr/local/bin
  • New: The script can configure calimero to use a KNX USB device or a Tunnel connection

To install calimero KNXNet/IP server download the script. In the header adjust the variables

  • KNX_ADDRESS
  • KNX_CLIENT_ADDRESS_START
  • LISTEN_NETWORK_INTERFACE
  • KNX_SERVER_NAME
  • ….

to your needs and run it as root. It can configure calimero server for using TPUART- or KNX USB device and for establish a Tunnel connection. To use a TPUART Module start the script without a parameter

michael@debdev ~ # sudo su -
root@debdev ~ # wget https://michlstechblog.info/blog/download/shell_scripts/calimero.sh
root@debdev ~ # bash calimero.sh

For the use of the first found USB Device:

root@debdev ~ # bash calimero.sh usb

To establish a tunnel connection to 192.168.56.200 start it with:

root@debdev ~ # bash calimero.sh tunnel 192.168.56.200

After script has finshed. Reboot your device. The calimero server starts automatically at boot.

The location of the config file is /etc/calimero/server-config.xml

OrangePi PC with TPUART

OrangePi PC with TPUART

Some basic checks after reboot
Check if the java process is running

root@debdev ~ # ps ax|grep tuwien.auto.calimero.server.Launcher
 429 ? Ssl 0:04 /usr/bin/java -cp /opt/calimero-server/* tuwien..........

Check systemd log

root@debdev ~ # journalctl -xu knx
java[429]: 19:02:45:852 WARN calimero.server - network interface eth0 not found, using system default
java[429]: 19:02:47:090 INFO calimero.server - KNXnet/IP discovery network interfaces: listen on [all], send on [all]
java[429]: 19:02:47:127 INFO calimero.server - Service container '/dev/ttyS0':
java[429]:         listen on any, KNXnet/IP routing multicast group 224.0.23.12
java[429]:         tpuart connection: TP1 medium, device 3.1.0
java[429]:         Group address filter []
java[429]: 19:02:47:178 INFO calimero.server - connect to /dev/ttyS0
java[429]: 19:02:47:378 INFO calimero.serial.tpuart:/dev/ttyS0 - setup serial port: baudrate 19200, even parity, 8 databits, 1 stopbits, timeou
java[429]: 19:02:47:393 INFO calimero.link.tpuart:/dev/ttyS0 - hop count set to 6
java[429]: 19:02:47:579 INFO calimero.server.gateway.knx-server - main-line group address forward setting set to 1
java[429]: 19:02:47:581 INFO calimero.server.gateway.knx-server - sub-line group address forward setting set to 1
java[429]: type 'stop' to stop the gateway and shutdown the server
java[429]: Detached from STDIN. Running in daemon mode
java[429]: 19:02:47:587 INFO calimero.server.knx-server - launch KNXnet/IP server 'Calimero KNXnet/IP Server'
java[429]: 19:02:47:724 INFO calimero.knxnetip.KNXnet/IP routing service 224.0.23.12 - multicast loopback mode enabled
java[429]: 19:02:47:726 INFO calimero.server.knx-server - KNXnet/IP discovery listens on interface enp0s8
java[429]: 19:02:47:739 INFO calimero.server.knx-server - KNXnet/IP discovery listens on interface enp0s3
java[429]: 19:02:47:739 INFO calimero.server.knx-server - KNXnet/IP discovery listens on interface lo

Check if the KNXnet/IP gateway is found.

root@debdev :~# knxtools discover
Using /127.0.0.1 at lo
----------------------
Control endpoint 192.168.200.1:3671 (IPv4 UDP) "Calimero KNXnet/IP Server"
KNX address 1.1.150
KNX medium TP1
Installation 0 - Project 0 (ID 0)
KNX IP multicast address 0.0.0.0
MAC address 8a:e4:30:04:f1:81
S/N 0x000000000000
Supported services: Core (v1), Device Management (v1), Tunneling (v1)

Using /172.16.1.200 at eth0
---------------------------
Control endpoint 192.168.200.1:3671 (IPv4 UDP) "Calimero KNXnet/IP Server"
KNX address 1.1.150
KNX medium TP1
Installation 0 - Project 0 (ID 0)
KNX IP multicast address 0.0.0.0
MAC address 8a:e4:30:04:f1:81
S/N 0x000000000000
Supported services: Core (v1), Device Management (v1), Tunneling (v1)

Check if groupmonitor can connect and see packets on the bus.  Replace 192.168.200.1 with the IP Address of your calimero server.

root@debdev :~# knxtools groupmon -m knxip 192.168.200.1
19:26:50:994 INFO calimero.knxnetip.KNXnet/IP Tunneling 192.168.200.1:3671 - establish connection from /127.0.0.1:58235 to /192.168.200.1:3671
19:26:51:123 INFO calimero.knxnetip.KNXnet/IP Tunneling 192.168.200.1:3671 - connection established (channel 1)
19:26:51:132 INFO calimero.knxnetip.KNXnet/IP DevMgmt 192.168.200.1:3671 - establish connection from /127.0.0.1:58045 to /192.168.200.1:3671
19:26:51:137 INFO calimero.knxnetip.KNXnet/IP DevMgmt 192.168.200.1:3671 - connection established (channel 2)
19:27:03.600 0.0.1->5/3/1 A_Group.write 00: 0 counter pulses [5.010], 0 % [6.001], 0 [17.001], activate 0 [18.001], inactive (no message sent) [20.606], [21.106], [28.001]
19:27:03.745 1.1.59->2/2/26 A_Group.write 0c 7c: 31960 ms [7.003], 22.96 mV [9.020]

This is the first release. Script is also available at github. Any feedback is welcome. If you have improvments feel free to send a pull request.

Michael

Place for Advertisment to support michlstechblog.info

Script to install calimero KNXnet/IP Server
Script to install calimero KNXnet/IP Server
calimero.sh
Version: v20180418-214000
28.1 KiB
27 Downloads
Details...

Add a comment »2 comments to this article

  1. I am from China. Where I can buy the Siemens Bustranceiver Module BTM UP117 5WG1117-2AB11 ?

    It is appreciate that you could give a directly web address to buy it.

    THX!

    Reply

Time limit is exhausted. Please reload CAPTCHA.

Original Theme by Schiy · Powered by WordPress