Monday, February 22, 2010

Home Automation on Synology NAS

I am the proud owner of a Synology DS209j NAS. This NAS has firmware that allows much more than just storage. While I only wanted one computer on 2/47 in the house. I also wanted a home automation server. Unfortunately, the Synology NAS devices weren't intended to be home automation servers. Therefore, a lot of modification has been required to get it to act as a home automation server. These next few posts have been up in the Synology forum for a while now, but I wanted to add my work to my own blog so please click 'read more' to expand this post...


http://forum.synology.com/enu/viewtopic.php?f=27&t=19788#p81040

I have a Synology DS209j, and I'll always run the latest firmware.

I've installed Xubuntu 9.04 in a virtual machine on my mac.

Following this page:
http://www.synology.com/us/support/3rd-party_application_integration.php

There is a document:
http://download.synology.com/download/ds/userguide/Synology%20NAS%20Server%203rd-Party%20Apps%20Integration%20Guide.pdf

Following the document I've downloaded the latest toolchain from Synology as well as the latest GPL source:
http://www.synology.com/us/gpl/index.php

As far as usb to serial hardware goes, I am using this product from Parallax as it give you proper RS232 levels and is very affordable:
http://www.parallax.com/tabid/768/ProductID/378/Default.aspx

From that page I followed the link to the external FTDI drivers for linux.

I renamed the ftdi_sio header and c file to .orig and placed these new files in their location in the synology source. From their I followed the document and made the modules.



Now i've got usbserial.ko and ftdi_sio.ko somewhere on my DS209j

Now you have to load the modules into the kernel and create the devices:
insmod usbserial.ko
insmod ftdi.ko
mknod /dev/usb/ttyUSB0 c 188 0
mknod /dev/usb/ttyUSB1 c 188 1

Also, add some lines like these to /etc/rc.local to make it persistent over reboot:
insmod /volume1/archive/usbserial.ko
insmod /volume1/archive/ftdi_sio.ko
mknod /dev/usb/ttyUSB0 c 188 0
mknod /dev/usb/ttyUSB1 c 188 1

run the command 'dmesg' and you should see something like this:
usb 1-2.1: new full speed USB device using ehci_hcd and address 15
usb 1-2.1: configuration #1 chosen from 1 choice
ftdi_sio 1-2.1:1.0: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT232RL
drivers/usb/serial/ftdi_sio.c: Number of endpoints 2
drivers/usb/serial/ftdi_sio.c: Endpoint 1 MaxPacketSize 16384
drivers/usb/serial/ftdi_sio.c: Endpoint 2 MaxPacketSize 16384
drivers/usb/serial/ftdi_sio.c: Setting MaxPacketSize 16384
usb 1-2.1: FTDI USB Serial Device converter now attached to ttyUSB0

The X-10 device I got working for now is known as the Firecracker CM17a, and the HD11A/CM11A 2-way computer interface

11 comments:

  1. Hi, can You send to my email sp7dpt@gmail.com all drivers to FTDI?. I using Synology DS210j and DSM 2.3-1139 Linux DiskStation 2.6.24.

    ReplyDelete
  2. hi, I want to solve a similar problem ... see http://forum.synology.com/enu/viewtopic.php?f=66&t=26042 ... can You send me to email bad@centrum.cz compiled driver ftdi for DS210J (same version as last comment - DSM 2.3-1139, kernel 2.6.24)

    ReplyDelete
  3. The basic purpose of home automation is to make things for the human beings more easy and comfortable. It is almost like in fairy tales where you clap and you get whatever you want without any effort.

    ReplyDelete
  4. What's the current status of this project? Have up updated your dsm? Did that break anything?

    ReplyDelete
  5. I have switched HA servers twice since this article. I am now using a Mac Mini with Indigo Pro. Sorry everyone!

    ReplyDelete
  6. I'm using DS209j and was wondering if there's a possibility to get those 2 modules - usbserial.ko and ftdi_sio.ko?
    I'm not very good at compiling and module making ...

    ReplyDelete
  7. Nice post.Thank you for taking the time to publish this information very useful! I’m still waiting for some interesting thoughts from your side in your next post thanks.
    top home alarm systems

    ReplyDelete
  8. I have turned HA hosts twice since this content. I am now using a Mac Small with Indigo Pro.

    ReplyDelete
  9. Hy there

    Do you have the modules for 4.2 version?
    I have a ds210j model.

    Thanks

    ReplyDelete
  10. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.
    Home Automation in Chennai
    smart home in Chennai
    Home security in Chennai
    Burglar alarm in Chennai
    Door sensors Chennai

    ReplyDelete
  11. I surely acquiring more difficulties from each surprisingly more little bit of it home security laredo texas

    ReplyDelete