Arduino/x10 Home Automation over WiFi tntadmin March 25, 2012 Tech Life 9 Comments Introduction On an episode of Hak5 they discussed setting up a garage door to be opened with a mobile device. Unfortunately, the audio was missing on the section where they discussed building/configuring the actual hardware to operate the garage door. This episode inspired me to start working on some home automation that could be accessed with any internet capable device without the need to install any software on the device. I wanted to be able to control several lights throughout my house and my garage. I decided to use x10 to give me a starting point. X10 is an international and open industry standard for communication among electronic devices used for home automation, also known as domotics. It primarily uses power line wiring for signaling and control, where the signals involve brief radio frequency bursts representing digital information. A wireless radio based protocol transport is also defined – wikipedia Hardware Arduino 10KΩ Resistor x10 PSC04 x10 Lamp Module x10 Universal Relay Module RJ11 Cable RJ11 Jack A LAMP server with an open USB port Step 1: Building and Configuring the Arduino Follow the wiring schematics below for wiring your Arduino to an RJ11 Jack. Data Pin = Pin 8 Zero Crossing Pin = Pin 9 First, wire the 5v connection on the arduino to the 10KΩ resistor. This will be wired to the data pin 8. Second wire data pin 8 to the black wire on the RJ 11 surface jack. Wire the green and red wires on the RJ11 surface jack together and wire them to the ground pin on the arduino. Finally wire the data pin 9 to the yellow wire on the surface jack (sometimes you may have to swap the data pin and the zero crossing pin depending on if the RJ11 cord is a cross over or not) Grab the x10 Library from arduino. Clone my github repository https://github.com/jfurcean/House-Control.git. Push the arduino/x10House.pde to the arduino. This code reads data in the form of ascii characters over the USB. It converts the characters into x10 byte codes that are used with the x10 Library. It then uses the x10 Library to push x10 commands out to the PSC04 moudle over RJ11. Step 2: Configuring the Webserver A webserver running PHP with an open USB port is required. I used a LAMP server running Ubuntu 11.04. Drop the contents of www from my github repository into your active web directory. Inside index.php you must set $serialPath to the path that your arduino is connected to. For example $serialPath = “/dev/ttyUSB0″; If your using Apache as your webserver you must allow Apache to write to that path name. sudo chgrp www-data /dev/ttyUSB0 sudo chmod 775 /dev/ttyUSB0 The web application reads config files to display certain x10 actions. When viewing the web application you need to make sure userName set. For example: http://192.168.1.101?userName=john. This will then use john.xml as the config file. The config file determines what stuff you can control. <modules> <module name=’Living Room’ house=’a’ unit=’1′ type=’light’/> <module name=’Bed Room’ house=’a’ unit=’3′ type=’light’/> <module name=’Garage’ house=’a’ unit=’2′ type=’button’/> </modules> Web Interface Step 3: Add/Wire x10 Modules All that is left is to plug any lamp into a lamp module, an appliance into an appliance module or wire a garage door, sprinkler, etc to the universal relay module Step 4: Enjoy Enjoy being able to control your house from any internet capable device connected to your network Light Control via iPod Touch [youtube]http://www.youtube.com/watch?v=yTxf_4_6YGE[/youtube] Garage Door Control via iPod Touch [youtube]http://www.youtube.com/watch?v=GZcRaz-DZq4[/youtube] Questions? Comments? Suggestions? Please feel free to contact me John@Furcean.com @jfurcean Google+ m4s0n501 9 Responses steve March 25, 2012 Love it! def giving this project a go. Log in to Reply John Furcean April 3, 2012 My next step/goal for this project is to try to reduce the cost, size, and complexity. I am currently running the web server on an old laptop running ubuntu. This requires more power than is necessary and takes up more room than necessary.I want to try to make this project smaller so I am looking into using a router running [url=”https://openwrt.org/”]OpenWrt[/url]. I have already ordered the Atheros AR9331 SoC (http://www.data-alliance.net/-strse-640/Alfa-Hornet-dsh-UB-Atheros-AR9331/Detail.bok), which is the same router used to create theWiFi Pineapple Mark IV (http://hakshop.myshopify.com/products/wifi-pineapple). In the first stage of this project. I used a full size arduino (http://arduino.cc/en/) board. To try and shrink the overall size of this project I am going to try to use a Teensy board (http://www.pjrc.com/teensy/). Any thoughts? Log in to Reply Chris April 4, 2012 Try and embed a chip programed to match the arduino instead of spending the money on an arduino that is not going to be used again for sometime. keep the arduino handy for testing code. Log in to Reply John Furcean April 4, 2012 Chris that’s a great idea, and I hope to pursue it. I am a software developer by trade and am a self taught hardware hacker. This has forced me to rely on easy to manipulate “out of the box” solutions. Do you have any contacts I could work with to develope a cheaper embedded chip solution, or at least work with me to develope one? Home Automation Article Featured on TheNewTech.tv | John Furcean April 4, 2012 […] Automation Article Featured on TheNewTech.tv Posted on April 4, 2012 by jfurcean My Home Automation over Wi-Fi article was featured on TheNewTech.tv. This entry was posted in Uncategorized by jfurcean. […] Log in to Reply antmoney999 May 3, 2012 Can this be used with a WAMP server if not can you tell me how to rewrite the code for it? Log in to Reply John Furcean May 3, 2012 It should be able to run just fine a WAMP server (i have not tried it though). You wold have to modify the $serialPath (located in index.php) to point at the appropriate windows COM port. On my LAMP server its set to ‘/dev/ttyUSB0′ so you would switch it to say ‘COM1′. You would also have to make sure Apache has permission to write to the COM port. Log in to Reply antmoney999 May 3, 2012 Thanks 아두이노 | 서재홍(Jaehong Seo) September 9, 2012 […] Arduino X10 Home Automation Over WiFi […] Log in to Reply Leave a Reply Cancel Reply You must be logged in to post a comment.