Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
Hello,
I finally succeeded to run my home automation system on the DNS-323. As I haven't found any other 'finished' tutorial to do so on our little NAS, I will share my experience with you.
The main idea is to be able to plug a CUL device and to run the FHEM software on the NAS, to control all your device which communicate at the 868MHZ frequency with certain protocol and take full advantages of the DNS with a full internet connection. With this system, you will be able to : turn on/off heating from work, to close the windows shutter 30 min after the sun set, monitore your power consumtion etc.
To do so you need :
* a NAS with the 2.6.12.6 kernel (firmware version 1.08 and 1.09 ok)
* a CUL dongle
* some 868MHZ devices (as a FHT-80 set to control the heating system in a room)
Warning :
This topic is not here to :
* explain how ffp works
* explain you how to design your home automation system
* discuss about the better communication protocol
* explain how to use linux command
* explain how to use FHEM
I. Flashing the CUL device (On a windows PC)
Download FLIP software at ATMEL website:
http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3886
Install it. Plug your CUL device in the pc usb port. When prompt for driver install, do not install windows default driver.
Choose the driver from FLIP's '/usb' directories
Download the good firmware from :
http://culfw.de/culfw.html
Follow this tutorial to flash the device :
http://code.google.com/p/micropendous/wiki/LoadingFirmwareWithFLIP
Refer to this page to choose the proper Atmel references :
http://busware.de/tiki-index.php?page=CUL
The firmware should be in the Device folder of the downloaded archive.
II. Install Fonz' fun_plug
Install Fonz_Plug :
http://www.inreto.de/dns323/fun-plug/0.5/
or
http://nas-tweaks.net/40/installation-of-the-fonz-funplug-0-5-for-ch3snas-ch3mnas-dns-323-and-many-more/
Connect to the NAS by ssh or telnet. Get all the fun_plug base packages, needed to build program later (source)
mkdir /ffp/packages cd /ffp/packages /ffp/bin/rsync -av inreto.de::dns323/fun-plug/0.5/packages .
Get also all the perl packages
mkdir /ffp/packages/perl cd /ffp/packages /ffp/bin/rsync -aLv inreto.de::dns323/fun-plug/0.5/extra-packages/perl .
(note the 'L' in the last command line, to resolve symbolic link)
Before installing the packages, you need to first update the packages which are already installed with fun_plug
cd /ffp/packages funpkg -u packages/funpkg*.tgz funpkg -u packages/*.tgz funpkg -u perl/*.tgz
Install then install all the remaining packages
funpkg -i packages/*.tgz funpkg -i perl/*.tgz
III. Configure PERL
Now we will check if the perl packages is correctly set-upsource
/ffp/bin/perl -MCPAN -e shell
Say yes the first time. Then we are going to change all the directories to point to ffp directories. Type
o conf init
Put everything directories in /ffp/. I.E. replace /.cpan/prefs with /ffp/.cpan/pref etc.
When prompt for 'YAML' enter 'YAML::Syck' to point to the installed version of YAML. Put also the 'YAML deserialisation' option ON
Then install the 'Device::SerialPort' for FHEM (that can take up to 5 hour). This is required as the CUL dongle contain is in fact a serial device.
sudo cpan Device::SerialPort
IV. Load driver for CUL device
Then we need 3 drivers to be able to plug the CUL into the NAS.
First create the folder to store those drivers
mkdir /ffp/lib/modules mkdir /ffp/lib/modules/2.6.12.6-arm1 mkdir /ffp/lib/modules/2.6.12.6-arm1/kernel mkdir /ffp/lib/modules/2.6.12.6-arm1/kernel/drivers mkdir /ffp/lib/modules/2.6.12.6-arm1/kernel/drivers/usb mkdir /ffp/lib/modules/2.6.12.6-arm1/kernel/drivers/usb/serial/
then download them:
cd /ffp/lib/modules/2.6.12.6-arm1/kernel/drivers/usb/serial/ wget http://dev.skcserver.de/dns323/modules_v1.03/kernel/drivers/usb/serial/usbserial.ko wget http://dev.skcserver.de/dns323/modules_v1.03/kernel/drivers/usb/serial/ftdi_sio.ko wget http://dev.skcserver.de/dns323/modules_v1.03/kernel/drivers/usb/serial/pl2303.ko
and copy also the dependencies files:
cd /ffp/lib/modules/2.6.12.6-arm1
V. Install FHEM on the NAS
Then we install FHEM on the NAS. Unpack http://fhem.de/fhem-5.1.tar.gz on the NAS. Modify the 6 first lines of the Makefile to point to ffp directories, as follow :
BINDIR=/ffp/usr/bin MODDIR=/ffp/usr/share/fhem VARDIR=/ffp/var/log/fhem DOCDIR=/ffp/usr/share/doc/fhem MANDIR=/ffp/usr/share/man/man1 ETCDIR=/ffp/etc
And then install FHEM with the pgm2 interface source :
cd /mnt/YOUR_DISK/FHEM_FOLDERS/ make install-pgm2
V. Install the USB serial drivers on the NAS
Now load the drivers for the CUL dongle on the NAS source :
insmod /ffp/lib/modules/2.6.12.6-arm1/kernel/drivers/usb/serial/usbserial.ko vendor=0x03eb product=0x204b insmod /ffp/lib/modules/2.6.12.6-arm1/kernel/drivers/usb/serial/ftdi_sio.ko insmod /ffp/lib/modules/2.6.12.6-arm1/kernel/drivers/usb/serial/pl2303.ko
Plug the CUL dongle on the NAS. If he doesn't show up int /dev/, you can force it source :
mknod /dev/ttyUSB0 c 188 0 ls -l /dev/ttyUSB0
VI. Launch FHEM
To start fhem server then :
perl /ffp/usr/bin/fhem.pl /ffp/etc/fhem.cfg
And add the CUL device in FHEM command line:
define CUL1 CUL /dev/ttyUSB0@9600 1422
VII. Enjoy your system !
Enjoy!
VIII. Annex
To still have everything working at reboot, you should add the last 6 command to our /ffp/etc/fun_plug.local file :
insmod /ffp/lib/modules/2.6.12.6-arm1/kernel/drivers/usb/serial/usbserial.ko vendor=0x03eb product=0x204b insmod /ffp/lib/modules/2.6.12.6-arm1/kernel/drivers/usb/serial/ftdi_sio.ko insmod /ffp/lib/modules/2.6.12.6-arm1/kernel/drivers/usb/serial/pl2303.ko mknod /dev/ttyUSB0 c 188 0 ls -l /dev/ttyUSB0 perl /ffp/usr/bin/fhem.pl /ffp/etc/fhem.cfg
Last edited by Zdai (2011-12-11 14:15:05)
Offline
Very cool man. Excellent tutorial and a brilliant use of material to make life a little easier.
Offline