Presentation

KNX is an open communication protocol standard for intelligent buildings.This KNX device library is a free open-source (GPL v3) software that allows you to create your “self-made” KNX bus device. For that, you need an Arduino board and a Siemens TPUART chipset for the physical coupling to the KNX bus… and of course a home KNX installation (or at least a prototyped one like I have)!
The code is available in the GITHUB REPOSITORY.
The API and the general usage of the library are described in the Library API page.
This blog aims at presenting and discussing concrete (future) realizations, shown in Realizations page.

Actors introduction

Let’s make the concrete actors introduction.  As explained in the Github page, we use an Arduino Mini Pro (5V, Atmega328)  and a TPUART2 “BTM2-PCB” board (from Opternus company) to create KNX devices. Both fit in a standard (67mm diameter) flush-mounted wall box :

Mini Pro and TPUART boardSo they are the ideal companions to create flush-mounted wall devices like push buttons/detectors/sensors.

How to connect the Arduino Mini Pro to the TPUART?

The datasheet of the used TPUART2 board is available here.

Since the Arduino Mini Pro (5V, Atmega328) is powered by the KNX bus, we shall connect the Arduino GND and VCC (5V) pins to the Supply ouput pins of the TPUART. Then connect the Arduino Rx pin to the Tpuart Tx pin and Arduino Tx to Tpuart Rx.

On TPUART side :TpuartOn Arduino side :ArduinoMPFritzing view :TPUART_Connection_bb

22 Responses to Presentation

  1. karlismoto says:

    thanks for good information and ideas!
    I’m olso interested about the build diy knx devices.
    do you have continiue your arduino projects?
    I’m interesting a relay plate building for lights and etc.

    • FranckMarini FranckMarini says:

      Hello Karlismoto, sorry for my late reply. Yes, I’ve planed building new devices soon : a touchless button should come soon. A relay plate is a nice idea, can you tell more?

  2. adm1024 says:

    Hello,
    on my side I plane to build diy temp/humidity sensors and digital I/O to manage garage doors.
    But when I ask Opternus for the device, they tell me that they don’t want to deal with individuals.
    I found siemens 5WG1117-2AB12 that looks to be the same, but after I saw that it exist more than one type of connector pin-out (usage).
    Can you explain the way you used to have this device ?
    Thank a lot for you job. I will share my production.
    Regards

    • FranckMarini FranckMarini says:

      Hello,
      Indeed, Opternus sell to Professionals only. I managed to get some samples by buying through an electricicity reseller located in my town.
      I’ve not played with 5WG1117-2AB12, but surely a TPUART/TUART2 chip is used inside. Do you have a reliable source regarding its pinout to share? The pinout may or may not be same as BTM2-PCB board one, at least the 8 pins (to be identified) should have the same functions.

      I’ve been thinking about a kind of weather station as well. My Knx house is almost done, and I see an outside luminosity sensor could be very helpful to better control the lightings.

  3. Sypro says:

    Very nice work !

    I used your code and it works like a dream.
    I used a homemade TP-UART board (https://bitbucket.org/dka/arduino-tpuart), Arduino UNO and some Gira, Siemens KNX products.
    This makes it possible to easly inject code on the fly onto the KNX BUS line.

    My knownledge of C++ is quite rough, and playing with the code is quite a challenge.
    Next steps for me are playing around with the code and buying a Arduino Mega.

    Thanks for the work done so far it’s something i’ve been looking for.

  4. Theo says:

    Hi, i am Theo, i am an KNX installer with a small experience in arduino. Last year got involved with arduino platform and i had the idea of ARDUINO – KNX interfacing in order to build cheap small custom solutions and i started to look around for it. I didn’t found something for the physical connection (except the Daniels Blog! and optenus site) So i decided to build my own KNX-Arduino interface and asked for the help of an engineer! We started to design the PCB but after a series of changes (and after a couple of months) he stopped responding to my messages (i do not know why!) and the project has stopped.I still find your idea extremely useful, not in a professional level (at the moment) but for hobbyists.I believe to this idea and i am looking forward to help you in any way i can! Hope to continue this Project!

  5. Matthias says:

    Hi,
    I love your work, it is great :-)
    But I have problemes with the DPT-Types 7 and higher. That are U16 V16 types = _longValue.
    I will send a temperature value (DPT 9_001), but that is not possible. With ETS5 i can not see the message. All other message DPT <7 are recieved correct.

    // Definition of the Communication Objects attached to the device
    KnxComObject KnxDevice::_comObjectsList[] =
    {
    /* Index 0 */ KnxComObject(G_ADDR(1,1,1), KNX_DPT_9_001 /* 9.001 F16 DPT_Value_Temp */ , COM_OBJ_SENSOR /* Sensor Output */ )
    }

    void loop(){
    Knx.task();
    Knx.write(0,19.9);
    //Delay;
    }

    I hope you can help me :-)

    • FranckMarini FranckMarini says:

      Hi Matthias,

      nice to hear this project is used by some people!
      Mhmm, there might be an issue with the handling of 2 bytes long objects (I haven’t played a lot with them so far). Let me check on my side, I hope to find the root cause soon!

      By the way, could you tell a bit more about the device you’ve planed to build ?

      • FranckMarini FranckMarini says:

        Hi Matthias,

        I’ve checked and so far, F16 DPT formats were not supported, that’s why it was not working.

        I’ve just pushed on github a new version (v0.1) of the library,
        which supports all the usual DPT formats (F16 included). Please check and let me know!

  6. Pit007 says:

    Hello, I got the following errors (use Arduino 1.6.0) – can you help ?

    In file included from D:\Arduino_IDE\libraries\KnxDevice/KnxDevice.h:29:0,
    from KnxDevice_PushButton.ino:12:
    D:\Arduino_IDE\libraries\KnxDevice/KnxComObject.h:169:16: error: prototype for ‘boolean KnxComObject::UpdateValue(byte)’ does not match any in class ‘KnxComObject’
    inline boolean KnxComObject::UpdateValue(byte newValue)
    ^
    D:\Arduino_IDE\libraries\KnxDevice/KnxComObject.h:137:7: error: candidates are: byte KnxComObject::UpdateValue(const KnxTelegram&)
    byte UpdateValue(const KnxTelegram& ori);
    ^
    D:\Arduino_IDE\libraries\KnxDevice/KnxComObject.h:133:7: error: void KnxComObject::UpdateValue(const byte*)
    void UpdateValue(const byte ori[]);
    ^
    D:\Arduino_IDE\libraries\KnxDevice/KnxComObject.h:121:7: error: byte KnxComObject::UpdateValue(byte)
    byte UpdateValue(byte newVal);
    ^
    Error compiling.

    • FranckMarini FranckMarini says:

      Hi Pit007 ,

      I’m using an old IDE (1.0.6, it’s time to change!). The compiler with 1.6.0 seems stricter, because indeed, there was a mismatch in the UpdateValue() function header between declaration and definition.

      It is fixed in the new version (v0.1) I’ve just pushed on Github, can you check please?

  7. Bernd says:

    I have a siemens 5wg1 110-2ab11. does anybody have experience with that one? i can’t get it to run. is there anywhere a forum where i can ask, too?

  8. Bernd says:

    That 5wg1 110 does have a PEI interface on his 10 pin connector. others wrote about that 5WG1 117. that one has a bti interface. which interface is implemented in your class?

  9. Alex says:

    The fritzing-view contains a mistake:

    The header on the BCU has 10 pins, and not just 8.

    regards,
    Alex

  10. Paolo says:

    Hi Frank,
    compliments for the good work.
    Is there any library version written in “C” for porting on my own microcontroller?

    Thanks
    Paolo

    • FranckMarini FranckMarini says:

      Hi Paolo,

      no, the library is written in C++ only and relies on Arduino libraries. The easiest way is to migrate onto Arduino boards ;-)!

  11. Speriator says:

    Hello !

    I’d like to use an Arduino Nano (clone) and a siemens 5WG1117-2AB12 from EIBMarkt.

    http://www.eibmarkt.com/cgi-bin/eibmarkt.storefront/576bc09a005b57cc274c4debae3806c4/Product/View/NS6512716

    the signal is coming on the RX line, I verify with an oscilloscope, but no action with the sample code.

    I use an Arduino as ISP to inject the code, because of the occupied RX/TX line, but how do you debug it to trace ? :-)

    Many thanks.

    Marc
    PS : Are you French ?

    • FranckMarini FranckMarini says:

      Hi Marc,

      I’m afraid it will not work on Nano because of the onboard FTDI chipset linked to RX line. In order to debug your installation, the best is to use a Mega board : it owns several serial ports: Serial0 is used to program and debug (serial monitor) while Serial1 is connected to the tpuart.
      Oui je suis français :-)!

  12. Christian Alessi says:

    Hello. I’m having problems with the functionality of arduino and pcb tpuart.
    I’m using Arduino UNO and Vcc is provided by usb connection (I’m not using tpuart Vcc output because my consumption is around 50mA.) Ground pin is connected in order to reference signals.
    I have downloaded the program to turn on an output according to my knx certified keyboard, using your example.
    Nothing happens, no event can be detected. Do you know if I am doing something wrong? What could be my mistake?

    • FranckMarini FranckMarini says:

      Hi Christian,

      By connecting the USB ground to the tpuart ground, you may damage your arduino board or tpuart or whatever!
      In your case, the only right way is to use optocouplers between the arduino serial port (rx & tx pins) and the tpuart.

  13. Manne says:

    Hi Franck,

    I’m using Mega 2560 due to that I need several HW serial ports. I will need to use optocoupler since I will Power the board from USB, and not from the KNXUART.
    Could you confirm that this schematic will work as optoisolator between the BTU and the Mega2560? I will use MCT6 couplers.
    http://rago600.sourceforge.net/generic_com.pdf

    • FranckMarini FranckMarini says:

      Hi Manne,

      I’ve had a look on the MCT6 datasheet, it looks fine with its bandwitdth of 150KHz (>19200 baud TPUART speed).
      Regarding your schematic, both TPUART and Mega board sides should be symetric, in particular the OK1B output should be idententical to OK1A one. I suggest the following :
      – R2 removed, pin 5 connected to “REGO GND”
      – “REGO RX” is pin 6
      – R1 = R4 = 470 ohms
      – R3 = R5 = 4,7 Kohms

      Franck

Leave a Reply to FranckMarini Cancel reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>