Project OctoBus (“The Kraken of Home Automation”) evaluates the use of 6LoWPAN for home automation. It is based on the Atmel AVR Raven hardware and runs Contiki as an operating system. This page describes the prototype. The goal is to use standard technology for solving the hard problems, i.e. routing, naming and adressing.
The description of our trade fair setup is here: HexaBusDemoSetup
The prototype consists of the AVR Raven Kit running Contiki. A wireless router running OpenWRT Router runs an IPv6 stack and mangles between IPv6 and 6LoWPAN. The setup looks like this:
I can use it to switch the lamp from my notebook. What happens is this: I create an UDP packet using a small C program. The packet is sent (over IPv6) to the router, which routes it to the AVR Raven board over the 6LoWPAN link. The Contiki system on the Raven receives the UDP packet and toggles the relay driver. This causes the relay to switch, et voilá: I can see what I type again.
This solution has several advantages:
Currently, the prototype uses 802.15.4 on 2.4 Ghz which is not suitable for links across several floors. A real implementation should use 868 MHz to improve in-house reliability. The rationale for 868 MHz is described in a good way at the OSIAN Wiki.
All software components are on Github: http://github.com/gonium/octobus
The router is a Buffalo WZR-HP-G300NH running OpenWRT. I followed the instructions at the OpenWRT Wiki for setting things up. I also use a simple shellscript for easy tftping:
sudo ifconfig eth0 192.168.11.10 netmask 255.255.255.0 sudo arp -s 192.168.11.1 00:24:a5:b0:07:d3 tftpfoo=`(cat <<-EOF binary\n rexmt 1\n timeout 60\n trace\n put openwrt-ar71xx-wzr-hp-g300nh-squashfs-tftp.bin\n EOF ) ` echo $tftpfoo
In addition, I installed several packages to get the IPv6 stack running, this is also documented in the OpenWRT wiki. I also found this page in the SIXXS Wiki helpful (but the router does not run aiccu currently.) You have to be careful while installing the radvd and the Raven USB stick:
An archive of /etc is here: octobus-router-etc.tar.gz
This is the complete package list of the router:
root@OpenWrt:~# opkg list-installed base-files - 42-r20728 busybox - 1.15.3-2 crda - 1.1.0-2 dnsmasq - 2.52-2 dropbear - 0.52-4 firewall - 1-10 hotplug2 - 1.0-beta-1 ip - 2.6.29-1-2 ip6tables - 1.4.6-2 iptables - 1.4.6-2 iptables-mod-conntrack - 1.4.6-2 iptables-mod-nat - 1.4.6-2 iputils-ping6 - 20071127-1 iputils-traceroute6 - 20071127-1 iw - 0.9.19-1 kernel - 2.6.32.10-1 kmod-ath - 2.6.32.10+2010-03-24-5 kmod-ath9k - 2.6.32.10+2010-03-24-5 kmod-button-hotplug - 2.6.32.10-1 kmod-cfg80211 - 2.6.32.10+2010-03-24-5 kmod-crc-ccitt - 2.6.32.10-1 kmod-crypto-aes - 2.6.32.10-1 kmod-crypto-arc4 - 2.6.32.10-1 kmod-crypto-core - 2.6.32.10-1 kmod-ide-core - 2.6.32.10-1 kmod-input-core - 2.6.32.10-1 kmod-input-gpio-buttons - 2.6.32.10-1 kmod-input-polldev - 2.6.32.10-1 kmod-ip6tables - 2.6.32.10-1 kmod-ipt-conntrack - 2.6.32.10-1 kmod-ipt-core - 2.6.32.10-1 kmod-ipt-nat - 2.6.32.10-1 kmod-ipt-nathelper - 2.6.32.10-1 kmod-ipv6 - 2.6.32.10-1 kmod-leds-gpio - 2.6.32.10-1 kmod-mac80211 - 2.6.32.10+2010-03-24-5 kmod-nls-base - 2.6.32.10-1 kmod-ppp - 2.6.32.10-1 kmod-pppoe - 2.6.32.10-1 kmod-usb-acm - 2.6.32.10-1 kmod-usb-core - 2.6.32.10-1 kmod-usb-net - 2.6.32.10-1 kmod-usb-net-cdc-ether - 2.6.32.10-1 kmod-usb-net-rndis - 2.6.32.10-1 kmod-usb-ohci - 2.6.32.10-1 kmod-usb-serial - 2.6.32.10-1 kmod-usb-uhci - 2.6.32.10-1 kmod-usb2 - 2.6.32.10-1 libc - 0.9.30.1-42 libgcc - 4.3.3+cs-42 libiptc - 1.4.6-2 liblua - 5.1.4-6 libncurses - 5.7-2 libnl-tiny - 0.1-1 libpcap - 1.0.0-2 libuci - 12012009.5-1 libuci-lua - 12012009.5-1 libusb - 0.1.12-2 libxtables - 1.4.6-2 lua - 5.1.4-6 luci - 0.9.0-1 luci-admin-core - 0.9.0-1 luci-admin-full - 0.9.0-1 luci-admin-mini - 0.9.0-1 luci-app-firewall - 0.9.0-1 luci-app-initmgr - 0.9.0-1 luci-cbi - 0.9.0-1 luci-core - 0.9.0-1 luci-http - 0.9.0-1 luci-i18n-english - 0.9.0-1 luci-ipkg - 0.9.0-1 luci-lmo - 0.9.0-1 luci-nixio - 0.9.0-1 luci-sgi-cgi - 0.9.0-1 luci-sys - 0.9.0-1 luci-theme-base - 0.9.0-1 luci-theme-openwrt - 0.9.0-1 luci-uci - 0.9.0-1 luci-uvl - 0.9.0-1 luci-web - 0.9.0-1 mtd - 12 netcat - 0.7.1-2 opkg - 513-2 ppp - 2.4.4-5 ppp-mod-pppoe - 2.4.4-5 radvd - 1.6-1 screen - 4.0.3-2 swconfig - 5 tcpdump - 4.0.0-2 uci - 12012009.5-1 udevtrigger - 106-1 uhttpd - 7 usbutils - 0.86-1 wireless-tools - 29-4 wpad-mini - 20100309-1 zlib - 1.2.3-5
The AVR Raven USB stick is installed as described in the Contiki tutorial - you can flash the firmware binary provided by them without any changes.
For a general tutorial, see here. I am using Mac OS for development. On my blog there are some notes on how to get the system running and how to flash the devices.
The little board you see in the picture is not really interesting: It provides a power connector with a little LED to indicate a working power supply. The screw terminal is the connector for the relay. The socket on the left is for a serial port connector (it has a little cable soldered to the Raven board). On the Raven board itself, I soldered the JTAG connectors and (on the backside) two ISP cables for programming.
The directory structure of Contiki is somewhat overwhelming. I am currently working in these directories:
The serial terminal for debugging output can be accessed like this:
screen -U /dev/cu.SLAB_USBtoUART 57600
http://senstools.gforge.inria.fr/doku.php?id=contiki:examples has also been a helpful resource.
For easy testing, I wrote a small program called 6switch that sends out commands to the AVR Raven. It just uses the socket API to send out an UDP packet with a command word in it. This is a custom protocol and can probably be replaced by command words from KNX etc.
In addition, I wrote a small GUI with Shoes. It looks like this:
The relay box just encapsulates all components directly connected to AC mains. It contains a relay in normaly open position, a fuse, a permanently connected socket and a switched socket (which is connected to the relay).
I want to know what the manufacturing cost of an IPv6 plug would be. The main components will be an embedded chipset and the relay. Custom parts like a plug enclosure etc. are estimated, but all other components can be procured directly. I assume 100 devices for the prices.
Part | Distributor | Quantity | Price | ||
---|---|---|---|---|---|
AT86RF212 | Farnell | 1 | EUR 4.11 | ||
ATMEGA1284P-AU | Farnell | 1 | EUR 4.95 | ||
FINDER 36.11.9.024.0000 | Farnell | 1 | EUR 0.56 | ||
PCB with Antenna 5x5cm 2-sided | Olimex | 1 | EUR 1,50 | ||
Socket Enclosure | n/a | 1 | EUR 2,00 | ||
Power Supply | n/a | 1 | EUR 3,00 | ||
Random Parts | n/a | n/a | EUR 3,00 | ||
SUM | EUR 19,12 |
NOTES:
Hint: Perhaps you will find a solution here: http://www.powerint.com/sites/default/files/product-docs/an37.pdf To trigger the line-relay you can use a solid-state-relay: http://www.sander-electronic.de/be00045.html Or you use a SSR directly as line-switch, but then you have no line-seperation. btw. the finder relay is obsolete. mfg Udo