To build our basic KNX push button device, we simply use a push button and a resistor that we connect to the Arduino with a breadboard :
Fritzing view :
The push button is connected to digital pin 2 so that we can use interrupt service routine 0. The device will be programmed to drive a lamp switch off/on using a KNX actuator :
The application source is available at https://github.com/franckmarini/KnxDevice/blob/master/examples/KnxDevice_PushButton/KnxDevice_PushButton.ino.
This program manages the signal debounce, and bases on the switch feedback value of the actuator to always toggle the correct value (even after reset or when the switch is driven by several command devices). All the underlying KNX “machinery” is managed by the KnxDevice library.
In term of KNX configuration :
– Group address 0.0.1 drives (one of) the actuator channel. The corresponding communication object is configured to binary output (1.001 B1 DPT_Switch, Communicaion/Read/Transmit indicators).
– Group address 0.0.2 is the feedback value of the channel switch. The corresponding communication object is configured to binary input with init read (1.001 B1 DPT_Switch, Communication/Write/Update/Init indicators).
To finish, let’s watch a small demo :
Hi,
Congratulation for your work!!! It’s what I’m looking for a long time.
I have few questions, how do you define the flags and the the Adress Group, because I see 1.1.AA and in ETS I don’t have letters to define the Adress Group.
Thank’s in advance,
Sorry for my bad english, I’m french speaking
Hi Ivan,
you define the group address by using G_ADDR(a,b,c) for an object with address a.b.c (NB : or you can use G_ADDR(a,b) for a 2 level address object).
Indeed I used 1.1.AA address in my examples, “AA” in those cases refers to the hexadecimal value (written “0xAA” in C language), it equals 170 decimal value. It is actually a mistake : ETS (and the KNX standard in general) uses only decimal representation for the addresses. I will correct this soon in the code.
Regarding the flags definition, look at the flags section in file. If you’re not familiar with hexa values, that’s true it could be hardly understandable… “COM_OBJ_SENSOR” keyword means C/R/T flags, “COM_OBJ_LOGIC_IN” means C/W/U, “COM_OBJ_LOGIC_IN_INIT” means C/W/U/I, does this help ? I will add more explanation about the flags in the API section soon.
Hi Franck,
thx for the tutorials about arduino making use of the knx-bus. Great work!
I just tried to get it all working with the BTM2-PCB I just received and an Arduino Nano but unfortunately didn’t succeed. Do I need to change something in the example sketch about the RX/TX-ports because the Arduino Nano having a different pin layout with RX0 and RX1 or is there something else I am not aware of? So far I changed the physical address and group addresses of course?
Best regards
Jörg
Hi Jörg,
sorry for the late reply. On Nano boards, RX0 and TX0 pins are connected to the onboard FTDI chip, whereas no FTDI is present on Mini Pro boards. This is surely your issue rootcause.
Hello Franck ,
May I ask you a few questions ?
I have a couple of Arduino Megas , and a couple of SIM KNX ( the 250 Objects one ).
I have a PIR Sensor module and many many other sensors , relays and so on.
We have a knx bus running in our house and i am able to switch things on or off using
my Arduino Mega with the SIM KNX and command lines like”tds ($23d2) 1 ” and ”
” tds ($23d2) 0″ respectively…
Am I able to make a PIR motion detector to turn on a light in the hallway without having to use ETS ? I dont have ETS and our EIBPORT 3 is defective so i cannot login and do nothing.
Would you please provide me with a sketch and some simple instructions to make my motion detector switch on my hallway light ?
I have the Adress of the light in the hallway and i know how to change the physical adress of the sim knx. Please provide me with details.
I could pay you for your services using paypal
Or fix your computer issues ( if any ) …
Kind regards
Christian
Problem solved !
I know have a functioning PIR sensor that writes to the KNX Bus.
For Infos and the Sketch please email microwhatt@gmail.com
Kind regards
Christian