Stelios's Place

A place for thoughts and ideas

Web-enabled Home Control



   As an extension on my previous project (USB Home Automation) I wanted to control the remote plugs using my mobile phone and also be able to do it over the Internet. I had to find a way to have the device connected to USB port on a PC and then connect through my mobile phone to the PC and send the commands. That would mean that I had to have my PC turned on 24/7, which isn't a good idea. I had a Bifferboard lying around and I choose to use it instead of using my PC.

   For those who are not familiar with the Bifferboard it's a small embedded device which runs Linux. The Bifferboard has one USB port available (or two USB ports depending on the version you have) and also has a very low power consumption which made it an ideal PC replacement for this project. Having the Bifferboard connected on my home network and the mobile phone connected through WiFi it would be pretty straight forward to make them talk to each other. Configuring port-forwarding on the broadband modem I will be able to access the device from the internet as well. As for the user interface the basic idea is to have the Bifferboard run a small web server serving a tiny web page and then have a CGI script handle the requests from the mobile phone and send them out to the USB device through the USB port.


This is how the USB remote control looks connected to bifferboard

   On the Bifferboard you need to have the httpd server running (might already be installed on the bifferboard with the stock firmware) and also have Lua installed for the CGI script. You also need to have stty available on the Bifferboard to setup the serial port. You might need to change the serial port on the CGI script if the USB remote controller is not identified as /dev/ttyUSB0. Use the dmesg command to check or just ls -l /dev/ttyUSB*.

   For the web front-end I used the iWebkit framework to give an iPhone app style along with the Prototype JS framework for AJAX calls. For the back-end a Lua based CGI it's used to communicate over a serial connection with the USB remote control. The CGI script receives the plug ID and the command (on/off), opens the /dev/ttyUSB0 device and forwards the commands to the USB device Picaxe chip.

   The picture below displays the Web interface of the application. Since the USB remote control is able to handle up to 6 plugs I have configured the Web interface to display 6 buttons.


Web Interface

   Note: If you don't have a Bifferboard lying around you can get this functionality by using any embedded or not device running Linux which has a web server and a Lua available.

Comments and suggestions are welcomed.


~steliosm

Downloads:
  • Web GUI files (includes Lua CGI & Web Front-end) link.


Search

Navigation