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.
The Radio contact can be found here for example:
http://www.conrad.at/ce/de/product/616101/FUNK-FENSTERKONTAKT-F-ENERGIESPARREGLER
or
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
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:
- 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
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:
Please log in to post comments.
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