Close
0%
0%

KNXduino

KNX-compatible device based on STM32 MCU with Arduino flavour

Similar projects worth following

Make DIY components for standard-based wired home automation / smart home. 

KNX/EIB = the only world-wide wired building automation bus standard.

You can easily mix DIY (KNXduino) components and profesional KNX bus components produced by ABB, Busch-Jaeger, Siemens, Loxone, etc.

  • Toggle KNX binary group values like never before

    Pavel Kriz05/13/2020 at 14:56 0 comments

    New Group Value API is here. Using BinaryValue, you can easily read and write binary values (eg. Lights ON/OFF). Blink over KNX now looks really simple. No more hassles with telegrams 😃.

    Short example follows (setup, includes etc. omitted).

    BinaryValue binaryGroup001(0, 0, 1, &changeListener); // binary group 0/0/1 defined
    
    void loop() {
      delay(5000);
      binaryGroup001.setValue(!binaryGroup001.getValue()); // toggle binary group 0/0/1
      bcu.loop();
    }

  • Updater ("OTA") lightning fast

    Pavel Kriz02/14/2020 at 15:26 0 comments

    The tool to update KNXduino firmware Over-the-Air, well, Over-the-Wire actually, is called knxduino-updater. Until today, it supported the full image update only. It took 7 minutes to update full 25kB firmware 😞.

    Now the updater can perform "diff" update in case it has the old firmware that is currently in device. Only different bytes are sent over KNX bus thus the update is much faster when there are minor changes in the firmware eg. 30 seconds 😀. See the log below.

    java -jar knxduino-updater-1.0-SNAPSHOT-all.jar -nat 192.168.0.100 -fileName "/tmp/arduino_build_369255/KNXduinoBlinkOverKNX.ino.hex" -uid 05:B0:01:02:E9:80:AC:AE:E9:07:47:55 -device 15.15.208
    Restart device in programming mode...
    Unlock device... done (0).
    Hex file parsed: starting at 0x8008000, length 25984 bytes
    Old firmware's descriptor from MCU: startAddr=0x8008000 endAddr=0x800e580 crc=0x82a71ef8
    Olf firmware found in cache (switching to diff upload mode): /home/pavkriz/.cache/knxduino-updater/0.4/image-8008000-25984-82a71ef8.bin
    Sending application data (116 diff bytes) 
    ..........
    Program device next page diff, CRC32 0x55fcba92 ... done (0).
    Sending application data (5 diff bytes) 
    .
    Program device next page diff, CRC32 0xe368b554 ... done (0).
    Sending application data (5 diff bytes) 
    .
    Program device next page diff, CRC32 0x538968ed ... done (0).
    Sending application data (5 diff bytes) 
    .
    Program device next page diff, CRC32 0x36258d52 ... done (0).
    Sending application data (5 diff bytes) 
    .
    Program device next page diff, CRC32 0x792de65c ... done (0).
    Sending application data (5 diff bytes) 
    .
    Program device next page diff, CRC32 0x4e2ea853 ... done (0).
    Sending application data (5 diff bytes) 
    .
    Program device next page diff, CRC32 0x1dd01214 ... done (0).
    Sending application data (5 diff bytes) 
    .
    Program device next page diff, CRC32 0x2d459147 ... done (0).
    Sending application data (5 diff bytes) 
    .
    Program device next page diff, CRC32 0x8d70ed87 ... done (0).
    Sending application data (5 diff bytes) 
    .
    Program device next page diff, CRC32 0x8793dcbc ... done (0).
    Sending application data (5 diff bytes) 
    .
    Program device next page diff, CRC32 0x92f7da61 ... done (0).
    Sending application data (5 diff bytes) 
    .
    Program device next page diff, CRC32 0x62fe847a ... done (0).
    Sending application data (5 diff bytes) 
    .
    Program device next page diff, CRC32 0x1e370c38 ... done (0).
    Compressed (diffed) stream length = 186
    Preparing boot descriptor with start address 0x8008000 end address 0x800e580 with CRC32 0x98fe67cd APP_VERSION pointer 0x0 ... 
    ..
    Update boot descriptor ... done (0).
    Restarting device ... 

  • Two Git repos are better than one

    Pavel Kriz07/11/2019 at 15:18 0 comments

    Today, I've split the code, docs , etc. into two Git repositories:

  • KNXduino board finally up and running

    Pavel Kriz07/10/2019 at 18:48 1 comment

    While I started my prototyping using a Nucleo-F303RE board, I switched to STM32G0 line recently and now have a working custom board based on STM32G071 :)

    All bells and whistles working:

    and ABB binary output understands very well to our commands:

    Leason learned today: Do not let a KNX+ wire hang around. 30 volts accidentally touching a GPIO will kill your STM32 in a millisecond.

  • Hooray, STM32 Arduino Core supports STM32G0 MCUs

    Pavel Kriz07/10/2019 at 15:59 0 comments

    While I started to design a KNXduino 1.0 board with a new hacker-friendly STM32G0 MCU, I waited for STM32 Arduino Core support. Now, the STM32G0 line is supported since version 1.6.0.

    Why we love STM32G0:

    • LQFP32 package - manually solderable
    • Fair amount of Flash and RAM while promising more in year 2020
    • Single power rail - ie. only two power pins, single decoupling capacitor needed (+1 for Reset pin), thus simpler PCB, fewer components and more IOs available
    • Accurate internal RC oscillator - no Xtal needed for many applications, thus simpler PCB, fewer components and more IOs available
    • In short - True replacement for 8-bit MCUs

View all 5 project logs

Enjoy this project?

Share

Discussions

ztliu wrote 09/26/2020 at 06:47 point

Hi, Pavel. Love this project! I am new to KNX, but I am interested in its TP physical layer.

Just a little remark concerning the inductor( L3 in you schematics ). 

It has another significant function, that is, as an impedance modulator.

If this inductor is not present, as the transmitter turned off, the back EMF high voltage (caused by the choke module in the KNX power supply, also called equalization pulse in the standard) will soon the absorbed into the bulk capacitor (C4 in your sch) through rectifier diode (D11 in you sch). 

This would cause a lot of troubles, not just violating the di/dt specified by the standard, also that makes the transmitter waveform become load-dependent. A simple big inductor (hundreds of mH, about 10 times the inductance in the power supply) simply does the job, as an inductor is simply reluctant to change current.  

I don't know how KNX transceiver ICs, like STKNX or NCN51x0, manage to do this impedance control without using a big inductor. 

Hope someone can answer this.

  Are you sure? yes | no

Laurent Martin wrote 07/07/2020 at 12:12 point

Any plan to have the module talk with ETS and support compatibility with 8 input ?

  Are you sure? yes | no

Pavel Kriz wrote 07/30/2020 at 19:48 point

It's not on my roadmap ;-) I like to write the complete logic and configuration in Arduino (C++ actually). But it's definitelly feasible to write a sketch emulating 8bit input and configurable via ETS.

  Are you sure? yes | no

renatocostaferreira wrote 05/05/2020 at 20:09 point

How to set up Arduino IDE to compile STM32G071KB (32 pins) ?  It is not in device list .

  Are you sure? yes | no

Pavel Kriz wrote 05/13/2020 at 14:44 point

Add https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json to your Additional Board Manager URLs. See 'How to install a third party core' at https://www.arduino.cc/en/guide/cores

Then, you have two options:

1) Select "Nucleo G071RB" board, which has 64 pin package, but never mind, it will work with STM32G071KB as well. Just don't use the pins unavailable in 32pin package ;-)

2) Copy 'hardware' folder from https://github.com/pavkriz/knxduino to your sketches folder (eg. ~/Arduino). Then you can select KNXduino board. In this board, the Comparator HAL is enabled and you have option to compile sketch for bootloader support. With bootloader, the sketch is allocated at 0x8000 instead of 0x0000, because the bootloader sits at 0x0000. Bootloader can update your sketch "in field" via KNX bus :-).

  Are you sure? yes | no

Pavel Kriz wrote 01/03/2020 at 12:22 point

@dgajew The project currently requires an MCU with DAC (sets the voltage threshold for signal detection) and analog comparator (detects the bus signal) build-in. STM32F103 lacks both of them. I wanted to target the project to bluepill and it would be feasible but it would require too many compromises and the final solution would be suboptimal. It's better and easier to use STM32G0, ST sells cheap Nucleo boards if you want a dev board.

  Are you sure? yes | no

dgajew wrote 01/12/2020 at 17:10 point

Thank you Pavel for information, one more question about hardware: are elements D6 and L3 really necessary? 150 mH inductor is quite big and I don't understand function of diode D6. What type of transistor T1 did you use? I choosed MMBF170LT1G but voltage between gate and source in this type should be higher than 3,3 V to achieve on state..

  Are you sure? yes | no

Pavel Kriz wrote 01/13/2020 at 16:34 point

The transceiver part of the schematic is heavily inspired by selfbus / freebus projects. Here is a short description of one of the original circuits: https://www.freebus.org/content/freebus-grundschaltung

I'm quite beginner in analog circuitry, so here is my humble explanation. 

1) inductor "separates" the power supply from the bus and "filters" the signal (hi-speed changes on bus vs. stable power output on the other side), C4 charging should also not draw much current from the bus (which would may lead to false low "signal"). I think one could replace it with a resistor in case of really low power consumption of the device (did not try). 

2) D6 protects the receiver from reversed polarity (in case of human error during installation etc.) and is intentionally separated from power-supply reverse polarity protection (D11) in order not to discharge C4 and stress L3 while T1 pulls the bus low during transmission. 

3) I think I use DMN6140L as T1 now, which should be "quite well on" 😉 at 3,3V Vgs.

  Are you sure? yes | no

Pavel Kriz wrote 01/13/2020 at 16:49 point

The guy here https://guiott.com/KNX/C-Hardware/Hardware.htm uses no inductor at all, but I'm not sure it's a good idea. All selfbus / freebus  designs use an inductor.

  Are you sure? yes | no

dgajew wrote 01/02/2020 at 23:20 point

Hello, is it possible to use popular "bluepill" module with STM32F103 uC or I have to use STM32G071KBT6 uC? I found bluepill hardware example in the repository but there is no way to compile source code for boards other than "Nucleo G071RB"

  Are you sure? yes | no

renatocostaferreira wrote 10/13/2019 at 02:19 point

Hello Pavel

Great job.  How specification to RTC xtal 32768 kHz and load capacitor to STM32G071KB (LGQP32).

  Are you sure? yes | no

Pavel Kriz wrote 01/13/2020 at 16:01 point

Hello, I do not use xtal. The hi-speed (typically 8MHz) oscillator in the schematic is only "proposed" in case someone would need it. Actually it has to be integrated oscillator (not xtal) with output having logic levels. 32-pin STM32G0 does not have hi-speed xtal pins. OSC32_IN pin can be switch to hi-speed-oscillator input. 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates