Connecting a Radio-Window-Shutter-Contact to KNX with RFM12B, mbed and freebus

Description

I'm trying to connect a cheap Radio-Window-Shutter-Contact to my KNX-Installation in my home.

/media/uploads/charly/_scaled_radio-shutter-contact.jpg

The Radio contact can be found here for example:

http://www.conrad.at/ce/de/product/616101/FUNK-FENSTERKONTAKT-F-ENERGIESPARREGLER

or

http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=26278&flv=1&bereich=&marke=

The installation-bus in my home is a KNX-System http://www.knx.org/knx/what-is-knx/ and uses some self-made components from http://www.freebus.org/

I read the signals from the radio-contact with a Radio-module "RFM12B" from HopeRF(http://www.hoperf.com/rf_fsk/rfm12b.htm)

All these components are not too expensive and this is a way to expand my KNX-wire-bus to places where I have no knx-wires (windows for example)

On the knx-side (freebus) one can use any freebus-controller-board with the RS-Interface-Software http://www.freebus.org/index.php/de/software/lpc-rs-interface

What / How the radio-shutter sends..

The shutter sends the actual status of the contact on every change and then every 10 minutes (only when open). Every Message is repeated for about 20seconds. The Message contains:

  • a counter-number 1 Byte (increased with every message)
  • a device-ID (3 Bytes)
  • the status of the magnet contact
  • the status of the battery
  • a crc (2 Bytes)

For an example message see the section below.

-----------------------------
7E 0D 20 00 21 77 41 67 15 CRC: 6715 OK
Counter: 0D
 Dev-ID: 00 21 77
Window : OPEN

Status as of 11.1.2011:

  • RFM12B connected to mbed via SPI
  • preliminary software can read and understand the signal from the radio-shutter

/media/uploads/charly/_scaled_p1030793.jpg

The RFM12B is on the front-right side. In the back right side there is a RFM22B module which I failed to get to read the radio-signals (the lcd, rotary-encoder and DS1820 are for testing only)

TODOs

  • create a class for the radio-shutter which uses the rfm12b class - Done
  • connect and communicate with the freebus-rs-interface (serial) - Done
  • find a way to configure the group-addresses being sent to knx - Done

Software

Here is the Software for decoding the signals and printing the results to the pc:

Import programeth_comfort_test

Programm for decoding radio-signals sent by a ETH-Window-Shutter-Contact, received with a RFM12B-module

And here the program to receive the signals from ETH and send to knx via a freebus-rs-interface:

Import programeth_comfort_freebus

Program for decoding radio-signals sent by a ETH-Window-Shutter-Contact, received with a RFM12B-module. The messages are sent to KNX via a freebus rs-interface. Details see http://mbed.org/users/charly/notebook/connecting-a-radio-window-shutter-contact-to-knx/

Connecting

Connection on the freebus-Controller:

ISP-Interface:

  • Pin4 TXD (yellow)
  • Pin5 RXD (green)
  • Pin6 GND (black)

Connection freebus-rs on the mbed-side

serial-interface:

  • Pin9 TXD (green)
  • Pin10 RXD (yellow)
  • GND GND (black)

Connection of RFM12B

SPI-Interface:

  • p11 mosi
  • p12 miso
  • p13 sclk
  • p14 cs
  • p18 rxdata

Connection of LCD-Display TextLCD::LCD16x2(optional)

  • p30 rs
  • p29 e
  • p28 d0
  • p27 d1
  • p26 d2
  • p25 d3

Configuration-file: knx.cfg

Example:

#
# Configuration file for knx on mbed
#

# Format:
# ETH-Device-ID=knx-Group address
# ETH-Device-ID: 3 Byte HEX in Uppercase
# knx-Group address: 01/01/01
# example:
# 0026D1=3/0/2


002177=3/0/1
0026D1=3/0/2

Which says: The ETH-Device 002177 sends a on/off message to the KNX-Group-address 3/0/1

My test-configuration:

/media/uploads/charly/_scaled_eth_knx-test.jpg

  • green KNX-bus-wire from my house-installation system comes from the right hand side
  • connected to a 8-Out relais-Module (as I had only this for testing)
  • connected to the freebus controller (with the 8 red leds on the bottom side) - here runs the freebus rs-interface software
  • and this connected via the grey cable to serial-interface of mbed
  • connected via air with the ETH-Comfort Radio-Window-Shutter-Contact :-)

A message shown on the lcd

/media/uploads/charly/_scaled_eth-message.jpg

and :-))))) I can switch on and off the light in my room! A lot of work for replacing a traditional light-switch :-)


6 comments on Connecting a Radio-Window-Shutter-Contact to KNX with RFM12B, mbed and freebus:

01 Mar 2011

I'm trying to get a RFM12B talking to a mbed as well...any chance you could share your code or library that you use to communicate with it? I'm trying to port the JeeLabs RFM12B library to mbed now but its slow going.

Tim

02 Mar 2011

Hi Tim!

Yes I'll publish my pre-pre-beta-code for the rfm12b. But be aware, that it is a special version , where all the decoding is done by the mbed-controller and not by the rfm12b. This is because the used Radio-Window-Shutter-contact sends with a varying bitrate and bit-lenght. Details see the discussion on http://www.mikrocontroller.net/topic/172034 (in german)

Regards Charly

15 Mar 2011

Thanks!

Tim

24 Nov 2014

HI I AM WORKING ON KNX PROTOCOL AND RFM12B HAVE YOU ANY DOCUMNET ABOUTH THIS PROTOCOL TO SEND ME?? OMEGA.ADIBAN@GMAIL.COM

12 Jan 2015

Hi! Sorry, but I missed your post!

I stopped working with the RFM12B and changed to RFM22 and actually am using another module (www.busware.de) for !MAX-Wireless-Devices (by ELV www.elv.de) . So I have no actual infos. But what protocol do you mean? KNX-protocol (wire) is very popular - should be available on the net The protocol for the wireless devices is another story but everything I know about it is mentioned on this page.

Charly

12 Nov 2015

Can I get some more details concerning the pin connection of the RFM12B. Especially is there a resistor from DATA/nFSS to Vdd and what means the pin rxdata in the code.

Hans

Please log in to post comments.